Loading...
Loading...
Generates and runs crash reproducers to verify security flaws. Use when viable findings exist and you need to write and execute a script or payload to verify the crash. Don't use for code auditing or patching.
npx skill4agent add google/mantis mantis-reproduce/mantis-reproduce [--reattack] [--finding_id=<uuid>] [--force] [--target_root=<path>] [--state_root=<path>] [--snapshot_root=<path>] [--snapshot_id=<SNAPSHOT_ID>] [--snapshot_pinned=<true|false>]--reattack--finding_id--reattack--force--target_root.--snapshot_root--state_rootworkspace/.--snapshot_root--target_root--snapshot_id--snapshot_pinnedfalsemantis-patch--target_rootstate_root/workspace/findings/target_root/state_root/workspace/archive/.repro_attempts.jsonstate_root/workspace/.mantis_state.jsonpoc_[uuid].pycrash_[uuid].payloadstate_root/workspace/reproducers/state_root/workspace/findings/"repro_status""repro_file_path""run_command""repro_output""VALID"--reattackstate_root/workspace/findings/"reattack_status""reattack_file_path""reattack_run_command""reattack_output""reattack_variants""reattack""repro_*""status"patch_statusVERIFIED_SECUREfailed_to_bypassreattack_statusstate_root/workspace/archive/.repro_attempts.json"repro_snapshot_id""reattack_snapshot_id".repro_attempts.json{count,last_snapshot}state_root/workspace/findings/state_root/workspace/archive/.repro_attempts.lockos.replacestate_root/workspace/archive/.repro_attempts.json.tmpfailed_to_bypassLOCATOR RESOLUTION (before reading ANY target code or artifact):
0. ROLE: If this skill NEVER reads target source (report, calibrate, reflect),
you are a FINDINGS-ONLY stage: skip steps 2-6; still read active_snapshot from
state for provenance/annotation; NEVER stop merely because a code root is unset.
1. Determine CODE_ROOT, in this priority order:
a. If --target_root is passed on THIS invocation, CODE_ROOT = --target_root.
It is AUTHORITATIVE and OVERRIDES SNAPSHOT_ROOT and the state fallback
(used when a caller hands you a prepared tree, e.g. a patched shadow).
b. Else if --snapshot_root (or SNAPSHOT_ROOT) is passed, use it.
c. Else read state_root/workspace/.mantis_state.json (state_root from
--state_root if passed, else ./workspace/... relative to the current dir)
-> active_snapshot.root / .snapshot_id / .snapshot_pinned.
d. Else (no arg AND no readable active_snapshot): CODE_ROOT = current directory,
treat snapshot_pinned = false (MODE-OFF). Do NOT stop.
2. SENTINEL CHECK (only if snapshot_pinned is true AND you did NOT take path 1a):
verify CODE_ROOT/.mantis_snapshot_id exists and equals SNAPSHOT_ID. If missing
or different -> STOP "snapshot sentinel mismatch". (A --target_root tree (1a) is
deliberately mutated and is sentinel-EXEMPT.)
3. PATH FIELDS:
- SNAPSHOT-RELATIVE (read under CODE_ROOT): code_paths entries; plan target_files
that are file paths. Strip ONLY a trailing ":<digits>". A code_paths entry
containing "://" is a URL/endpoint, NOT a file read. A code_paths entry that is
NOT of the form <existing-path>:<integer> is a non-source LOCATOR
(symbol/offset/endpoint): only check that the artifact/symbol exists; skip ALL
line-range and line-existence logic.
- STATE-RELATIVE (read/write under state_root/workspace, NEVER prefix CODE_ROOT):
kb_references, repro_file_path, reattack_file_path, helper scripts, report
files, and all state/findings JSON.
4. Never WRITE under CODE_ROOT when snapshot_pinned is true. Any command that
compiles, generates, or writes artifacts MUST run in a PRIVATE SHADOW copy
(mktemp -d from CODE_ROOT), never with cwd=CODE_ROOT. Read-only inspection may
cd into CODE_ROOT.
5. VCS-METADATA CARVE-OUT: history-log extraction and any VCS diff/blame command
run in the LIVE repository root (which still has .git/.hg/.repo), NOT CODE_ROOT
(the snapshot copy strips VCS metadata). Do NOT stop merely because CODE_ROOT
lacks .git/.hg/.repo.
6. Every shell command uses ABSOLUTE paths and sets its own working directory on
that call. Do NOT assume the working directory persists between calls.[!NOTE] CURRENT-PASS CHECK (defensive; the binding guarantee is on the harness perScenario 2): ifmantis-pipeline-adapteris present ANDactive_snapshot, treat the snapshot as STALE for this pass — STOP "stale active_snapshot: pass mismatch" or degrade as HALT (active_snapshot.pass != state.pass_numbereffectively false: no authoritative verdicts, Block B NOT_MATCHED, reproducesnapshot_pinned). This catches a custom harness that preservednot_attemptedacross the Stage 15 pass increment without re-pinning. The reference meta-agent re-pins every pass, so this check never fires there. Block B itself cannot detect this (it isactive_snapshot-only, notsnapshot_id-aware).pass
SNAPSHOT MATCH CHECK for finding F (decides MATCHED vs NOT_MATCHED):
1. If snapshot_pinned is false -> NOT_MATCHED. Stop.
2. Read F.discovery_commit:
- missing OR empty OR the literal "MIXED" -> NOT_MATCHED.
- not exactly equal to SNAPSHOT_ID -> NOT_MATCHED.
- exactly equal to SNAPSHOT_ID -> MATCHED.
There is no other route to MATCHED; never fuzzy-compare. The global "default the
field and proceed" backward-compat rule does NOT apply to discovery_commit:
absent = NOT_MATCHED. (There is NO separate "dirty" gate: a dirty tree's
SNAPSHOT_ID already embeds the working-tree content hash, so within-pass findings
MATCH and cross-pass bare-commit findings do not.)--target_root=<shadow>repro_snapshot_idreattack_snapshot_id--reattack--snapshot_idactive_snapshot.snapshot_id--finding_idstate_root/workspace/findings/<uuid>.json--reattack"status""VALID""PROVISIONALLY_VALID""repro_status""reproduced""patch_status""MITIGATION_PROPOSED"VERIFIED_SECUREfailed_to_bypass--reattack--force"status""VALID""PROVISIONALLY_VALID""production_viability""VIABLE""SAMPLE_OR_TEST""CONDITIONAL_VIABLE"--force--finding_id--reattack--finding_idstate_root/workspace/findings/"status""VALID""PROVISIONALLY_VALID""production_viability""VIABLE""SAMPLE_OR_TEST""CONDITIONAL_VIABLE"mantis-structural-indexquery_structural_index.pyfind_callersfailed_to_reproducerepro_snapshot_idpoc_[uuid].pycrash_[uuid].payloadstate_root/workspace/reproducers/target_rootstate_root/workspace/reproducers/mkdir -pfailed_to_reproducefailed_to_reproducenot_attemptedBUILD_ROOT=$(mktemp -d)cp -a CODE_ROOT/. BUILD_ROOT/state_root/workspace/reproducers/"run_command""reattack_run_command"-fsanitize=address,undefined-fsanitize=thread-fno-omit-frame-pointer-fsanitize=memory-fsanitize=memoryWARNING: MemorySanitizer-fsanitize=memoryVERIFIED_SECURErun_commandreattack_run_command{TARGET_ROOT}{TARGET_ROOT}CODE_ROOT--target_rootCODE_ROOT--target_rootactive_snapshot.root.mantis_snapshots/pass_<N>qemuunicornreproducedrepro_status = "reproduced""statically_confirmed"repro_status = "failed_to_reproduce""Internal Invariant Protection"state_root/workspace/archive/.repro_attempts.json--reattackschema.jsonreattack_variants--reattackVERIFIED_SECURElen = boundlen = bound + 1len = bound - 1len ± 1len = 0len = SIZE_MAX/api/v2/echo/api/v1/echo..%2fetc%2fpasswd..\\..\\'; EXEC-- UNION SELECTreattack_statusstate_root/workspace/reproducers/reattack_variant_[uuid]_[N].py--target_rootreattack_variants{"description": "...", "triggered": true/false}reattack_status = "failed_to_bypass"reattack_variantsVERIFICATION_INCOMPLETEinsufficient_variantsfailed_to_bypass[]failed_to_bypasstriggered = truebypassed_patchlen=SIZE_MAXtriggered = falsereattack_status = "bypassed_patch"VERIFIED_SECUREVERIFICATION_FAILEDreproducedfailed_to_reproducestatically_confirmednot_attemptedmalloc(15)png_malloc(rowbytes + 48)"failed_to_reproduce"failed_to_reproduce--reattackfailed_to_bypassREACHED-SINK EVIDENCE GATE (mechanical):
Each reproducer produces REACHED-SINK EVIDENCE via ONE channel, recorded in repro_hints:
(a) script/source harness -> write the exact bytes MANTIS_REACHED_ENTRYPOINT to a
sidecar file $SENTINEL_FILE and flush+fsync (or unbuffered write) BEFORE
invoking the sink. (A file survives a crash that truncates buffered stdout.)
(b) binary / firmware / raw-payload -> reached-sink evidence is a captured
crash backtrace or sanitizer frame (ASan/UBSan/MSan/TSan) that
explicitly names the target sink function (target-produced tracing). A
marker written by a wrapper you author BEFORE invoking the target is
SETUP EVIDENCE ONLY: it proves "launch attempted," not "sink reached,"
and does NOT qualify as reached-sink evidence. If no in-path marker
(channel a) and no target-produced backtrace/sanitizer trace
(channel b) is achievable, the sink is unreached.
EVIDENCE PRESENT (reached-sink) = (channel a) sidecar file contains
MANTIS_REACHED_ENTRYPOINT written in-path, OR (channel b) target-produced
backtrace/sanitizer output names the sink. A wrapper pre-launch marker alone is
NOT evidence present.
EVIDENCE ABSENT includes: any compiler/build nonzero exit; exit 127 (command not
found); exit 2 with a "No such file" message.
DECISION GATE (gate the DECISION, not specific verdict strings):
- Record repro_status = reproduced OR statically_confirmed ONLY if EVIDENCE is
PRESENT. If ABSENT -> repro_status = not_attempted (retry-eligible), STOP.
- In patch verification, EVIDENCE is required on the UNPATCHED baseline (Block G),
NOT on the post-patch attack run (a correct patch legitimately stops the input
before the sink).
- If NO evidence channel is achievable for this target, downgrade to
not_attempted / VERIFICATION_INCOMPLETE. NEVER synthesize the marker.repro_status = not_attemptedfailed_to_reproduce--reattackreattack_statusfailed_to_bypassactive_snapshotsnapshot_pinnedfalsefailed_to_reproducefailed_to_bypassrepro_status = not_attempted--reattackreattack_statusactive_snapshot200 OK0"reproduced"ERROR: AddressSanitizerruntime error:SUMMARY: UndefinedBehaviorSanitizerWARNING: MemorySanitizerrepro_hints-fsanitize=memory"reproduced"WARNING: ThreadSanitizer139134jqstate_root/workspace/findings/<id>.jsonstate_root/workspace/archive/.repro_attempts.jsonstate_root/workspace/archive/mkdir -p state_root/workspace/archive/signaturesignaturestable_key = normalized_title + "@" + primary_file_pathnormalized_titleprimary_file_pathcode_pathssrc/auth.c:120src/auth.c{count, last_snapshot}{count, last_snapshot}count=0pass_state_root/workspace/archive/.repro_attempts.lockfcntl.flockstate_root/workspace/archive/.repro_attempts.lockfcntl.flockfcntl.LOCK_EXwithstate_root/workspace/archive/.repro_attempts.json{}countsignaturestable_key{count, last_snapshot}countstate_root/workspace/archive/.repro_attempts.json.tmpos.replacewith--reattack--reattack"repro_status""reproduced""statically_confirmed""not_attempted""failed_to_reproduce""repro_file_path""run_command""repro_output""repro_snapshot_id""repro_hints"sanitizers_used: ASan+UBSanassertions_disabled: truebuild_profile: release/mantis-criticrepro_status"reproduced""statically_confirmed""status""PROVISIONALLY_VALID"triage_checklistoutcome == "UNKNOWN"passes == falsestatus"PROVISIONALLY_VALID"repro_statusupgrade-to-VALID-blocked: triage_checklist has UNKNOWN entries (re-review required)VALID ⇒ no UNKNOWNUNKNOWNpasses:falseVALIDtriage_checklisttriage_checklistUNKNOWNtriage_checklistreviewerUNKNOWNpasses:false"status""VALID""history"{
"stage": "reproduce",
"action": "reproduced",
"details": "Reproduction status evaluated as [reproduced/failed_to_reproduce] using command: [run_command]",
"pass_number": <current_pass_number>,
"timestamp": "<current_iso8601_timestamp>"
}--reattackrepro_*status"reattack_status""bypassed_patch""failed_to_bypass""inconclusive_baseline_changed""bypassed_patch"patch_statusVERIFIED_SECUREpatch_status = "VERIFICATION_FAILED""failed_to_bypass"failed_to_bypassVERIFIED_SECURE"inconclusive_baseline_changed"failed_to_bypasspatch_statusVERIFIED_SECUREpatch_status = "VERIFICATION_INCOMPLETE"VERIFIED_SECUREVERIFIED_SECURE => reattack_statusfailed_to_bypassfailed_to_bypassreattack_variantsVERIFICATION_INCOMPLETEpatch_statusVERIFICATION_INCOMPLETEinconclusive_baseline_changedVERIFICATION_FAILEDbypassed_patchVERIFIED_SECUREfailed_to_bypassreattack_statusreattack_snapshot_idrepro_snapshot_idreattack_statusSNAPSHOT_MISMATCHreattack_snapshot_idrepro_snapshot_idlive:mktemp -dactive_snapshot.rootmantis-patchreattack_status = "inconclusive_baseline_changed"failed_to_bypassreattack_file_pathreattack_run_commandreattack_outputVERIFIED_SECUREVERIFICATION_INCOMPLETEbypassed_patchfailed_to_bypassVERIFIED_SECUREVERIFICATION_FAILEDbypassed_patchfailed_to_bypassactive_snapshot.snapshot_idlive:--snapshot_pinned=falsereattack_status"reattack_file_path""reattack_run_command""reattack_output""reattack_variants""description""triggered"inputresultbypassedlabelname"reattack_variants": [
{
"description": "off-by-one: len=bound+1",
"triggered": false
},
{
"description": "alternate path via /api/v2/echo",
"triggered": false
},
{
"description": "boundary mutation: max INT_MAX",
"triggered": false
}
]"description""off-by-one: len=bound+1""alternate path via /api/v2/echo""triggered"triggered = falsereattack_variantsreattack_status = "failed_to_bypass"[]failed_to_bypassinconclusive_baseline_changed"reattack_snapshot_id""history"{
"stage": "reattack",
"action": "reproduced",
"details": "Re-attack status evaluated as [bypassed_patch/failed_to_bypass] using command: [reattack_run_command]",
"pass_number": <current_pass_number>,
"timestamp": "<current_iso8601_timestamp>"
}--reattackvariant_diversity_insufficientreattack_status