/security-agent-skills:hunting-orm-and-query-builder-injectionfrom security-agent-skills
Hunts ORM/query-builder injection where untrusted input reaches raw-query escape hatches, unparameterizable identifiers, or structured filter/update objects whose keys become query operators.
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.
Teams reach for an object-relational mapper or a query builder partly to avoid injection, then assume the abstraction handles it. It handles values: a bound parameter is safe no matter what it contains. It does not handle structure. The moment untrusted input becomes a column name, a sort direction, a raw fragment, or an operator inside a filter object, the placeholder machinery is bypassed and the query means something the developer did not write. Classic string-concatenation injection is largely gone from ORM codebases; the live risk moved to the escape hatches and the structured inputs. You find it by separating the calls that bind values from the calls that accept structure and tracing untrusted input into the latter.
Test injection only against databases and applications you own or are authorized to assess, on non-production data. Confirming an operator-injection read can expose records outside your test scope. If you can't name the authorization, stop.
Map the data-access sinks and separate them. Inventory where the mapper or builder is used, then split the calls into two groups: parameterized calls that bind values, and escape hatches that accept structure. The escape hatches are raw-query methods, methods that take a column, table, or order argument, and methods that accept a structured filter or update object. Only the second group can be injected.
Trace untrusted input into raw-query escape hatches. A raw method takes a query string or a fragment. If untrusted input is concatenated or interpolated into that string, it is classic injection even though the file is full of ORM calls. Parameter placeholders inside a raw fragment protect the values only; anything spliced in as text is live.
Trace untrusted input into identifiers. Column names, table names, sort fields, and sort direction usually cannot be bound as parameters. If any of them comes from the request, a sort field or a column selector, it must be checked against a fixed allowlist. An attacker-chosen identifier can read columns the caller was never meant to see, and in some builders can smuggle a subexpression.
Trace structured filter and update objects (operator injection). When a request body is passed directly as a filter, its keys can become operators or references the caller never intended: a comparison rewritten into an always-true condition, a key that names a different column, or a nested operator that changes the query's logic. Determine whether the object is constrained to an expected shape and set of fields, or merged in whole.
Find where value crosses into structure. The safe line is simple: untrusted data may be a value bound as a parameter, but untrusted data that becomes an identifier, an operator, a fragment, or a raw string must be allowlisted. Locate every place that line is crossed and whether an allowlist stands there. A cast or a type check is not an allowlist.
Confirm and record. Confirm by supplying an input that changes the query's structure in scope: an identifier that returns a column outside the intended set, a filter operator that makes a restricted query return everything, or a raw fragment that appends a condition. Kill the lead if every raw method takes only bound parameters, all identifiers and sort inputs are allowlisted, filter and update objects are constrained to an expected shape and field set, and no untrusted value becomes query structure. Record with the input, the call, and the change in the query's meaning.
sort by field taken from the request
and dropped into the query is not parameterizable, so without an allowlist it is injectable.where object lets the caller add operators and references, not just supply values.Confirm. A listing endpoint takes a
sortparameter and passes it straight into the builder's order clause, which does not parameterize identifiers. A craftedsortvalue injects a subexpression that orders by a boolean over a sensitive column, letting an attacker read that column one bit per request across the result set. Confirmed identifier injection to data exfiltration,high, remediation = map thesortparameter through a fixed allowlist of permitted columns and directions and reject anything else, and never pass request text into an order or identifier position.Kill. Every raw method receives only bound parameters, the
sortand column selectors are mapped through a fixed allowlist to known identifiers, and filter objects are validated to an expected field set and operator whitelist before reaching the builder. No crafted identifier, operator, or fragment changes the query's structure. Killed,kill_reason= "values bound, identifiers and sort allowlisted, filter objects constrained to a known shape; no untrusted input becomes query structure."
You need every data-access call split into value-binding and structure-accepting groups, the raw-query methods and their arguments, the identifier and sort inputs and whether each is allowlisted, and the filter and update objects and whether their shape is constrained. For each structure-accepting sink, ask whether untrusted input can reach it and whether an allowlist stands between. Reading the call shows the intent; supplying an input that changes the query's meaning shows whether the boundary holds.
hunting-mass-assignment-and-property-authz - the write-side sibling: an untrusted structured object
reaching fields it should not; here the same object shape reaches query logic.adjudicating-taint-paths - use it to confirm a request value actually reaches a raw method or
identifier sink through the mapper's indirection.auditing-graphql-attack-surface - a query API is a common source of the filter and sort objects that
land in these sinks; trace the two together.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