OWASP Hunting

Injection

XPath and XSLT Injection

XPath injection occurs when user input is concatenated into an XPath query against an XML data store, allowing authentication bypass and data extraction. XSLT injection occurs when input reaches a stylesheet or a transformation engine, which can lead to file read, SSRF and, with extension functions enabled, code execution. XQuery injection is closely related. These are distinct from XML injection in XML-Injection/ and XXE in XXE/.

Payloads are read from main at 35c1f2b (committed 22 Nov 2026). Project version 1.0.2.

These payloads are for authorized testing only: systems you own, authorized bug bounty programs, or controlled lab environments. Unauthorized testing is illegal.

Payload files

Folder on GitHub

Use the arrow keys to move between payloads. Press Enter or C to copy the focused payload.

xpath-xslt-payloads.txt

83 payloads · 5.1 KB
Source

Loading payloads for XPath and XSLT Injection…

Common Attack Vectors#

  • Login forms and search fields backed by XML documents
  • SOAP and legacy enterprise services that query XML stores
  • Report, invoice and document generators that apply XSLT stylesheets
  • Applications that accept a user-supplied stylesheet or <?xml-stylesheet?> reference
  • XQuery, XSLT 2.0/3.0 and eval or extension functions (Saxon, Xalan, libxslt)

Testing Approach#

For XPath, send a single quote or double quote and look for parser errors. Then use boolean differences (' or '1'='1 vs ' and '1'='2) to confirm injection. Use substring, string-length and count for blind extraction one character at a time. For XSLT, identify the processor with system-property('xsl:vendor') and system-property('xsl:version') and test document() and unparsed-text() for file read. Keep tests read-only and stop once the vendor or a harmless file is read.

References#

Responsible Use

All content in this reference is for authorized security testing only. Use only on systems you own or have explicit written permission to test.

  • Systems and applications you own
  • Authorized penetration testing engagements
  • Bug bounty programs with defined scope
  • Educational lab environments (DVWA, WebGoat, HackTheBox)