Xpath injection

From zakirkun/ice-tea · View interactive version

Xpath injection is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects XPath queries built from user input without escaping, enabling authentication bypass and data disclosure.

How to use this skill

Skill file

XPath Injection

Overview

XPath injection is analogous to SQL injection but targets XML documents. An attacker can manipulate XPath expressions to bypass authentication, access unauthorized data nodes, or cause denial of service.

Classic bypass: ' or '1'='1 in username field when query is //user[name/text()='{username}']

Remediation

Use parameterized XPath (XQuery with bound variables) or escape user input using library-provided escaping functions.

Vulnerable (Java):

String query = "//user[name='" + username + "' and password='" + password + "']";
NodeList nodes = (NodeList) xpath.evaluate(query, doc, XPathConstants.NODESET);

Safe (Java):

// Use parameterized XQuery or properly escape the input
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.