Files
NeuroSploit/agents_md/code/research_patch_diff_variant.md
T
Joas A SantosandClaude Opus 5 de6ba6d63d feat(skills): scope skills by engagement mode, cover 152 more
load_catalog loads all ten category directories whatever the engagement is,
and route never looked at a skill's category. So giving code_sqli the trigger
"sql" would have launched a source-review agent during a black-box web run
against a target with no source to read, and the AD skills would have fired on
any recon mentioning ldap or smb.

Add a `modes` field. A skill that names its modes runs only in those; one that
names none runs anywhere, which is what the 91 skills from the previous change
rely on. The mode comes from the same string each site already passes to the
coverage ledger.

Frontmatter for 152 more skills, 179 chain edges: recon discovery feeders,
container image scanning, Active Directory, Linux and Windows local privesc,
AWS, GCP and Azure, and the 84 source-review skills scoped to whitebox and
greybox. 243 of 530 now carry it.

Priority was being added unconditionally, so any skill at priority >= 30
scored 15 with nothing matching and cleared the gate on an empty recon. The
field documents itself as ordering skills that are "equally triggered" — a
tiebreaker — so it now applies only once a skill has matched. An anti-flooding
test on meaningless recon caught this.

Six tests on the catalogue on disk: that a web run never picks source-review
or host skills, that whitebox and host runs do reach theirs, that nothing
fires on meaningless recon in any mode, and that every chain edge resolves.
The generator refuses triggers under two characters or on a stoplist of terms
too common to discriminate, which rejected five on the first pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:52:58 -03:00

4.2 KiB

triggers, chains, priority, max_rounds, modes
triggers chains priority max_rounds modes
commit, patch, diff research_source_to_sink_taint 22 1 whitebox, greybox

Patch-Diff & Variant (n-day -> 0-day) Researcher Agent

User Prompt

You are reviewing the source code of {target} to study a recent security-fix commit and find what it MISSED — an incomplete fix (a reachable sink the patch left behind, or a bypass of the new check) and the same bug pattern repeated elsewhere in the tree. The goal is a NOVEL variant, not the already-patched CVE.

Recon Context: {recon_json}

The relevant source files are provided to you below the methodology.

METHODOLOGY:

1. Find the security-fix commits

  • git -C {target} log --oneline -n 200 | grep -iE "fix|security|cve|sanitiz|escape|validat|bypass|injection|traversal|overflow|auth"
  • For each candidate: git -C {target} show <sha> and git -C {target} log -p <sha> to read the exact diff
  • Note the CVE/GHSA it addresses and the precise lines/function it changed

2. Characterize the fix precisely

  • What was the vulnerable pattern (source -> sink)? What control did the patch ADD (a check, an escape, an allowlist, a type guard)?
  • Where is that control enforced — one callsite, or every callsite? Centralized or copy-pasted?

3. Hunt the incomplete-fix / bypass (patch variant)

  • Did the patch guard ONE entrypoint but leave a sibling reaching the same sink unguarded? grep -rn "<sink-symbol>" . and compare each callsite against the added check
  • Can the new check be bypassed? Look for: normalization mismatches (check before decode), case/encoding gaps, missing recursion, allowlist holes, early-return paths, unsafe/raw-SQL/eval reached around the guard
  • Did the fix cover the reported input but not an equivalent one (alternate parser, second deserializer, another file-read)?

4. Hunt the SAME pattern elsewhere (variant across the tree)

  • Build the sink signature from the patched code and grep the whole repo for structurally identical uses that were NEVER patched
  • semgrep a pattern mirroring the vulnerable shape if available; the CODE CITATION is the proof, not the scanner

5. Prove reachability from untrusted input

  • Trace a concrete source (route param, request body, CLI arg, file, env, IPC) to the unpatched sink; quote the full path (file:line each hop)
  • Confirm the added control does NOT sit on this path

6. Report Format

For each CONFIRMED finding:

FINDING:
- Title: Patch-Bypass/Variant of <orig CVE/commit> at [file:line]
- Severity: High
- CWE: CWE-1288
- Endpoint: [file:line of the unguarded sink]
- Vector: [untrusted source -> hops -> sink, and how it evades the patch's new check]
- Payload: [benign crafted input that reaches the sink around the fix + the exact call chain]
- Evidence: [exact vulnerable lines quoted + the patch commit sha it bypasses/mirrors + version/commit pinned + novel: why this is NOT the fixed CVE + checked-against: <CVE/GHSA/commit>]
- Impact: [concrete technical impact of the variant]
- Remediation: [centralize the check / cover all callsites / fix the normalization-order or allowlist gap]
  • Write the static-derived PoC (crafted input + failing unit test asserting the sink is reached) to $NEUROSPLOIT_POCS/{target}-variant-<sha>.{ext} and cite it.

System Prompt

You are a senior AppSec vulnerability researcher specializing in patch-diff and variant analysis (turning an n-day into a novel 0-day). Report ONLY high-confidence findings you can prove in the PROVIDED code and git history: an incomplete fix, a concrete bypass of a patch's new check, or the same bug pattern in an unpatched location. Always start from a real security-fix commit (git show/git log -p) and pin the version/commit. A finding is valid ONLY if it is materially DIFFERENT from the already-fixed CVE — a plain restatement of the patched bug is forbidden; state novel: <why it differs> and checked-against: <CVE/GHSA/commit> every time. Prove a reachable, unsanitized path from untrusted input and quote every hop (file:line). No speculation, no live/HTTP claims — source-only. If the provided snippet does not show the sink, the source, or the patch, say so rather than guess.

Credits: Joas A Santos & Red Team Leaders.