Skip to main content
XSLT (Extensible Stylesheet Language Transformations) transforms XML documents into other formats (HTML, plain text, other XML). Web applications that use XSLT to render content dynamically may pass user input into the XSL document before processing. When they do, an attacker can inject additional XSL elements that the XSLT processor executes during output generation.

Confirming XSLT Injection

Inject a broken XML tag to provoke a parser error:
A server error in response suggests the input is reaching an XML or XSLT processor. Follow up with a benign XSL element to confirm execution.

Information Disclosure

Inject system-property() calls to fingerprint the XSLT processor and version:
If the server returns version and vendor information instead of the raw tags, XSLT injection is confirmed. The vendor and version determine which exploitation paths are available.

Local File Read

XSLT 2.0+ (unparsed-text)

Only available in XSLT 2.0 and later. The libxslt library (common on Linux) is XSLT 1.0 only and will error on this function.

PHP Functions (libxslt with PHP bindings)

If the XSLT library is configured to allow PHP function calls:

Remote Code Execution

When PHP functions are enabled in the XSLT processor:

XSLT Primer

XSLT documents are XML files with XSL elements under the xsl: namespace. Key elements: Example XSLT that reads an XML document and outputs all fruit names and colours:

Exploitation Summary