Skip to content

Add NoSQL injection probe and detector#1871

Open
kenlacroix wants to merge 1 commit into
NVIDIA:mainfrom
kenlacroix:feat/exploitation-nosql-injection
Open

Add NoSQL injection probe and detector#1871
kenlacroix wants to merge 1 commit into
NVIDIA:mainfrom
kenlacroix:feat/exploitation-nosql-injection

Conversation

@kenlacroix

Copy link
Copy Markdown

What

Adds a NoSQL injection probe + detector to exploitation (CWE-943), extending the injection family alongside the existing Jinja and SQL probes.

  • probes.exploitation.NoSQLInjectionEcho — uses the established ECHO_TEMPLATE to get the target to echo a NoSQL injection. Ships a new nosql_injection payload set of MongoDB-style operators ({"$ne": null}, {"$where": ...}, [$ne]=1, server-side-JS breakouts, etc.).
  • detectors.exploitation.NoSQLiEcho — scores a hit on an echoed payload or an operator construct: key position ("$ne":), query-string bracket form ([$ne]), or server-side-JS (;return(true)). Operators are matched only in those structural positions so prose that merely names an operator (e.g. "use $ne for not-equal") does not false-positive.

Why

NoSQL/document-store injection is a common class with no coverage today, and it follows the exact same prompt-boundary measurement pattern as the existing SQLInjectionEcho / SQLiEcho pair: if a model echoes attacker-controlled query operators that an application then interpolates into a query filter, that's an injection sink.

Verification

  • pytest tests/detectors/test_detectors_exploitation.py — passes (new test_nosqli_echo covers payload echo, operator constructs, and benign-operator-mention negatives)
  • pytest tests/plugins/test_plugins.py — 361 passed (plugin metadata/tags/detector resolution)
  • black clean

Adds exploitation.NoSQLInjectionEcho probe and exploitation.NoSQLiEcho
detector (CWE-943), extending the exploitation injection family beyond
SQL and Jinja. The probe reuses the ECHO template with a new
nosql_injection payload set (MongoDB-style operators); the detector flags
echoed payloads plus operator constructs in key position ("$ne":),
bracket form ([$ne]), and server-side-JS (;return(true)) while ignoring
prose that merely names operators. Includes detector tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Kenneth LaCroix <53909268+kenlacroix@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant