/security-agent-skills:hunting-nosql-operator-and-where-injectionfrom security-agent-skills
Identifies NoSQL injection vulnerabilities where untrusted input becomes query operators or reaches server-side JavaScript evaluation ($where, mapReduce, aggregations).
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.
NoSQL injection rarely looks like classic SQL injection because there is no string to concatenate.
Instead, a document store filter is often built directly from a request object, so if the attacker sends
an object where the code expected a scalar, its keys become query operators. A login check that compares a
password to a request field can be turned always-true by sending an operator that matches anything. Worse,
some stores evaluate server-side JavaScript, in a $where clause, a mapReduce function, or an aggregation
expression, and untrusted input reaching that path is code execution inside the database. You find these by
separating filters that bind scalar values from those that accept a request-shaped object or an expression,
and tracing untrusted input into the latter.
$where, mapReduce, or an aggregation.Test NoSQL injection only against databases and applications you own or are authorized to assess, on non-production data. A confirming operator or expression can read or alter records outside the intended scope, so stay inside the authorized boundary. If you can't name the authorization, stop.
Establish the query sinks and split them. Inventory where the store is queried, then separate calls that bind scalar values from calls that accept a request-shaped filter object or evaluate a server-side expression. This is the false-positive killer: a query with typed scalar parameters cannot be operator- injected. Name the structure-accepting and expression-evaluating sinks first.
Trace untrusted input into filter objects. Follow request bodies and query strings into filters
built from them. The key question is whether a field expected to be a scalar can arrive as an object: if
the code does find({ user: req.body.user }) and req.body.user can be an object, the attacker sends
an operator that changes the match. Confirm whether the value is type-checked to a scalar before use.
Trace untrusted input into server-side expressions. $where, mapReduce functions, and some
aggregation expressions run code in the database engine. If untrusted input is concatenated into or
supplied as one of these, it is code injection with the database's privileges. These paths are rarer but
far more severe than operator injection.
Confirm the impact class. Operator injection typically yields authentication bypass, filter bypass, or blind data extraction by making a restricted query match more than intended. Expression injection yields code execution or heavy resource use. Determine which the reachable sink permits and how far it reaches.
Check the defenses that actually stop it. Casting each request field to its expected scalar type before it enters a filter, rejecting objects where scalars are expected, disabling server-side JavaScript evaluation, and validating the request body against a schema each remove the vector. A generic sanitizer that only strips characters does not, because the attack is structural, not textual. Determine which stands at the sink.
Confirm and record. Confirm by supplying an in-scope input that changes the query's meaning: a scalar field sent as an operator object that makes a restricted query match, or an expression that returns a distinguishable result, without exfiltrating out-of-scope data. Kill the lead if every filter binds type-checked scalars, if objects are rejected where scalars are expected, if no untrusted input reaches a server-side expression, and if server-side JavaScript is disabled. Record the input, the sink, and the change in the query's meaning.
$where, mapReduce, and some aggregation expressions run
code in the engine; untrusted input there is the most severe path.Confirm. A login endpoint queries the user store with
{ email: body.email, password: body.password }and never checks that the fields are strings. Sendingpasswordas an operator object that matches any value makes the query return the user without knowing the password. The response confirms authentication bypass. Confirmed NoSQL operator injection to authentication bypass,critical, remediation = castpasswordto strings and reject non-string values before building the filter, and validate the body against a schema that requires scalar types.Kill. Every request field entering a filter is cast to its expected scalar type and non-scalar values are rejected, the body is validated against a strict schema, and server-side JavaScript evaluation is disabled at the database. A field sent as an operator object is refused before the query. Killed,
kill_reason= "filter fields are type-checked scalars, non-scalar input is rejected, and server-side JS is disabled; no untrusted value becomes an operator or expression."
$where runs code.$where." → Confirm it, and check mapReduce and aggregation expressions too; any
server-side evaluation on untrusted input is the severe path.You need every query sink split into scalar-binding and structure-accepting groups, the server-side expression evaluations, the untrusted inputs that reach each, and the type-check or schema validation at each field. For each structure-accepting sink, ask whether a scalar field can arrive as an object, and for each expression sink whether untrusted input reaches it. Reading the query construction shows the intent; sending an operator object or a distinguishing expression shows whether the boundary holds.
hunting-orm-and-query-builder-injection - the same value-versus-structure distinction applied to
relational mappers; operator injection there rhymes with filter injection here.hunting-blind-and-second-order-sql-injection - a sibling extraction technique when the response reveals
only a boolean or a delay.hunting-search-engine-injection - another structured-query store where request objects become query
clauses.adjudicating-taint-paths - use it to confirm an untrusted field reaches a filter or a $where path as
structure rather than a bound scalar.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