hypnguyen1209/offensive-claude / skills/vulnerability-analysis
vulnerability-analysis
UnverifiedUse when auditing source code for vulnerabilities — drive CodeQL/Semgrep/Joern to taint untrusted data source-to-sink across injection, memory safety, deserialization/prototype-pollution, secrets/crypto/authz/race, and supply-chain risks
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.4 KB |
| references/deserialization-prototype-pollution.md | markdown | 8.3 KB |
| references/injection-source-patterns.md | markdown | 8.6 KB |
| references/memory-safety-c-cpp.md | markdown | 7.7 KB |
| references/secrets-crypto-authz-concurrency.md | markdown | 8.6 KB |
| references/supply-chain-dependency-audit.md | markdown | 7.3 KB |
| references/taint-engines-static-analysis.md | markdown | 11.0 KB |
| references/variant-hunting.md | markdown | 3.4 KB |
| scripts/dep_audit.py | script | 10.9 KB |
| scripts/deser_gadget_scan.py | script | 7.7 KB |
| scripts/evidence_kit.py | script | 13.0 KB |
| scripts/finding_dedup.py | script | 4.2 KB |
| scripts/joern_taint.sc | other | 3.6 KB |
| scripts/merge_runtime_evidence.py | script | 6.1 KB |
| scripts/path_conditions.py | script | 10.6 KB |
| scripts/provenance.py | script | 2.8 KB |
| scripts/sast_runner.py | script | 7.8 KB |
| scripts/secret_crypto_audit.py | script | 8.1 KB |
| scripts/taint_trace.py | script | 14.9 KB |
| scripts/validate_findings.py | script | 22.8 KB |
| scripts/variant_hunt.py | script | 11.8 KB |
| scripts/vocab_gate.py | script | 7.5 KB |
scripts/merge_runtime_evidence.py
View on GitHub#!/usr/bin/env python3
"""merge_runtime_evidence.py - fold Frida runtime observations back into findings.
A static-flagged sink that is *observed executing at runtime* is strictly stronger evidence than a
pattern match - it answers finding-validator Q3 ("did input actually reach the sink?") with a
machine artifact. This reads the `events.jsonl` produced by frida_universal.js (JSONL_MODE) and, for
each finding that names a runtime symbol/file it expects to fire, sets:
proof.runtime_sink_executed = true
+ a note citing the events file
IMPORTANT: this is a REACHABILITY booster, not a class-confirm. It does NOT by itself make a finding
CONFIRMED - the per-class impact bar in validate_findings.py still applies (an SSRF still needs the
internal response read, etc.). It strengthens the "reachable" half, nothing more. Matching is
explicit (a finding must declare `runtime_match`) so a coincidental call cannot silently promote an
unrelated finding.
Pure stdlib. Tolerates non-JSON / human log lines in events.jsonl (skips them).
CLI:
merge_runtime_evidence.py --events events.jsonl --findings findings.json [--out merged.json]
exit 0 ok (prints how many findings gained runtime confirmation), 2 error
"""
from __future__ import annotations
import argparse
import json
import os
import sys
def load_events(path: str) -> dict:
"""Return {'functions': set, 'files': set} of what executed. Skips noise lines."""
fns, files = set(), set()
with open(path, "r", encoding="utf-8", errors="replace") as fh:
for line in fh:
line = line.strip()
if not line or line[0] != "{":
continue # human log line / blank -> ignore
try:
ev = json.loads(line)
except ValueError:
continue
if not isinstance(ev, dict) or ev.get("type") != "runtime":
continue
event = ev.get("event")
if event == "call" and ev.get("fn"):
fns.add(str(ev["fn"]))
elif event == "dlopen" and ev.get("path"):
files.add(str(ev["path"]))
elif event == "file": # ONLY a dedicated file-touch event carries paths -
p = ev.get("path") # a 'call' event cannot inject arbitrary file paths
if isinstance(p, str) and p:
files.add(p)
fs = ev.get("files") # type-checked: a bare STRING is one path (not a
if isinstance(fs, str): # char-by-char iterable), a LIST is many, else skip
if fs:
files.add(fs)
elif isinstance(fs, list):
for f in fs:
if isinstance(f, str) and f:
files.add(f)
return {"functions": fns, "files": files}
def _match_tokens(finding: dict) -> list:
"""Symbols/paths a finding EXPLICITLY opts into via `runtime_match`. Opt-in only: descriptive
fields like `function`/`sink_symbol` are NOT used (they would auto-promote findings that never
asked for runtime correlation - e.g. a generic `open`). Blank tokens are dropped (an empty
string is a substring of everything)."""
rm = finding.get("runtime_match")
raw = [rm] if isinstance(rm, str) else (rm if isinstance(rm, list) else [])
out = []
for t in raw:
s = str(t).strip()
if s:
out.append(s)
return out
def _file_hit(token: str, file_set: set) -> bool:
"""Structured path match: the token must equal a path's basename or a full path component -
NOT a loose substring (which lets a short/forged token promote many unrelated findings)."""
for fp in file_set:
norm = fp.replace("\\", "/")
if token == os.path.basename(norm) or token in norm.split("/"):
return True
return False
def merge(findings: list, executed: dict, events_path: str) -> tuple:
confirmed = 0
fn_set, file_set = executed["functions"], executed["files"]
for f in findings:
if not isinstance(f, dict):
continue
toks = _match_tokens(f)
hit = next((t for t in toks if t in fn_set or _file_hit(t, file_set)), None)
if hit is None:
continue
proof = f.get("proof")
if not isinstance(proof, dict):
proof = {}
f["proof"] = proof
if proof.get("runtime_sink_executed") is not True:
confirmed += 1
proof["runtime_sink_executed"] = True
note = f"runtime: sink '{hit}' observed executing (see {events_path})"
notes = f.setdefault("runtime_notes", [])
if note not in notes:
notes.append(note)
return findings, confirmed
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description="Fold Frida runtime events into findings (reachability).")
ap.add_argument("--events", required=True, help="events.jsonl from frida_universal.js JSONL_MODE")
ap.add_argument("--findings", required=True, help="findings JSON (list or {findings:[...]})")
ap.add_argument("--out", help="write merged findings here (default: stdout)")
args = ap.parse_args(argv)
try:
executed = load_events(args.events)
with open(args.findings, "r", encoding="utf-8") as fh:
data = json.load(fh)
findings = data.get("findings", []) if isinstance(data, dict) else data
if not isinstance(findings, list):
raise ValueError("findings must be a JSON list (or {findings:[...]})")
except (OSError, ValueError, json.JSONDecodeError) as exc:
print(f"error: {exc}", file=sys.stderr)
return 2
merged, n = merge(findings, executed, args.events)
out_text = json.dumps(merged, indent=2)
if args.out:
with open(args.out, "w", encoding="utf-8") as fh:
fh.write(out_text)
print(f"[+] {n} finding(s) gained runtime_sink_executed -> {args.out}", file=sys.stderr)
else:
print(out_text)
print(f"[+] {n} finding(s) gained runtime_sink_executed", file=sys.stderr)
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |