/security-agent-skills:hunting-xpath-and-xml-query-injectionfrom security-agent-skills
Hunts XPath and XQuery injection where untrusted input concatenated into query expressions changes query structure. Covers predicate bypass, path rewriting, union injection, and blind/out-of-band variants.
Ships in security-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
XPath and XQuery are to XML what SQL is to a relational database, and they carry the same injection flaw. When an application builds a query by pasting untrusted input into the expression string, an attacker who supplies query syntax instead of a plain value changes what the query means. A login check that looks up a user node by matching a name and password predicate can be turned into a predicate that is always true, logging in as the first user with no credential. A lookup scoped to one node can be widened to walk the entire document and return records the caller should never see. Because XML documents have no table grants, the whole document is usually reachable once the expression is under attacker control. You find these by locating every expression built from request data and asking whether the input is bound as a parameter or concatenated as syntax.
Test XPath and XQuery injection only against applications you own or are authorized to assess, with test accounts and test data, because a confirming query can read other users' records out of the document. Prefer boolean and structural probes over bulk extraction, and coordinate before dumping data. If you can't name the authorization, stop.
Establish that the expression is concatenated, not parameterized, first. Locate every XPath or XQuery evaluation and read how its expression string is assembled. This is the false-positive killer: if the expression is a fixed literal and untrusted input is bound through a variable resolver or a precompiled expression with typed parameters, the input can only be a value and the query structure is fixed, so there is no injection. Name the evaluations where input is pasted into the string.
Locate the injection point in the expression. Determine where in the expression the untrusted value lands: inside a predicate string comparison, as part of a path step, inside a function argument. The position decides what breaking out of it costs and what syntax the attacker must supply to stay well-formed.
Test for structural break-out. Supply input that closes the current string or predicate and adds
syntax: a quote that ends a comparison followed by an always-true predicate, an or that widens a
match, a union or an additional path step that reaches sibling nodes. Confirm the evaluation accepts
the rewritten expression rather than treating the whole thing as a literal value.
Map the reachable document. Once structure is controllable, determine how much of the document the expression can walk: whether an always-true predicate returns the first node, whether a union or an absolute path reaches nodes outside the intended scope, and whether node names and counts can be inferred. This is what turns a bypass into data extraction.
Handle the blind and out-of-band cases. When the response only reflects success or failure, confirm a boolean channel: an injected predicate that is true for a guessed character and false otherwise, inferred one node and one character at a time. Where the evaluator supports document or URL functions, check for an out-of-band channel that sends inferred data to a host you control.
Confirm and record. Confirm by turning an authentication or lookup predicate always-true, or by
extracting a benign marker node the account should not reach, on a test document. Kill the lead if the
expression is a fixed literal with typed variable binding, if the input is strictly validated or
allowlisted to a value shape that cannot carry syntax, or if the evaluation is over a document with no
sensitive nodes and no auth decision. Record the evaluation site, the injection position, the break-out
used, and what it reached. Set kill_reason when killing.
Confirm. A login handler authenticates by evaluating an XPath expression that matches a user node on a name-and-password predicate built by string concatenation. A username value that closes the predicate and appends an always-true
orcondition makes the expression return the first user node regardless of the password. On a test document the handler signs in as that user with no valid credential. Confirmed XPath injection to authentication bypass,high, remediation = evaluate a fixed precompiled expression and bind the name and password as typed variables so input can never alter the predicate structure.Kill. A search feature evaluates a precompiled XQuery expression whose only input is bound through a typed external variable, and the input is additionally validated to an alphanumeric token. A value carrying quotes and predicate syntax is passed through as a literal string and matches nothing. Killed,
kill_reason= "expression is fixed and precompiled with the input bound as a typed variable, so query structure is not attacker-controllable."
You need every XPath and XQuery evaluation, how each expression string is assembled, and the origin of any interpolated value. For each, decide whether the input is bound as a typed variable or concatenated as syntax, where in the expression it lands, and what the document holds that a rewritten query could reach. Reading the assembly shows whether structure is fixed; a break-out probe against a test document shows whether the expression is rewritten, and a boolean probe confirms a blind channel.
hunting-orm-and-query-builder-injection - the relational sibling; the same concatenation-versus-binding
question decides both, here over XML instead of SQL.hunting-blind-and-second-order-sql-injection - the blind boolean and out-of-band extraction technique
transfers directly to an XPath oracle.hunting-xxe-and-xml-parser-trust - the same XML input often reaches both a parser and a query; check the
entity-expansion surface alongside the expression.adjudicating-taint-paths - use it to connect the request field to the exact evaluation site through the
string assembly.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub unboundcompute/security-agent-skills --plugin security-agent-skills194 skills in this plugin
/adjudicating-dependency-cve-reachabilityDecide whether a CVE in a dependency actually exposes your application before you scramble to patch: is the vulnerable function on a real call path from your code, do the trigger preconditions hold, and can an attacker control the input that reaches it. Use when an advisory, SCA scan, or dependency bot flags a CVE and you must separate a genuine exposure from unreachable noise, or justify why you are or are not affected. Covers pinning the vulnerable symbol, call-path reachability, precondition checks, and taint from your entry points./adjudicating-taint-pathsDecide whether a whitebox lead is a real bug by tracing taint from an untrusted source to a dangerous sink and confirming every hop against live source. Use after a scanner, a candidate list, or your own reading surfaces a "this looks dangerous" sink (SQL exec, system/exec, file open, deserialize, template render, redirect target, memcpy) and you must decide whether attacker- controlled input actually reaches it - or kill the lead with evidence. Covers forward and reverse taint, witness paths, sanitizer analysis, and the evidence rules that separate a finding from a false positive.Other plugins' skills for the same job