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/joern_taint.sc
View on GitHub// joern_taint.sc - CPGQL interprocedural taint queries for source->sink hunting.
//
// Joern builds a Code Property Graph (AST + CFG + PDG) and ships a reachableBy
// dataflow engine. This script defines source/sink/sanitizer sets and reports
// every flow where attacker-controlled data reaches a dangerous sink.
//
// Run via sast_runner.py:
// python3 sast_runner.py joern --src ./app --script joern_taint.sc --out joern.json
// Or directly:
// joern --script joern_taint.sc --param cpgPath=cpg.bin --param outPath=joern.json
//
// Works language-agnostically on the CPG; method-name patterns below cover
// C/C++, Java, Python, JS. Extend `sinks`/`sources` for your target.
//
// Reference: https://docs.joern.io/code-property-graph/ ; reachableBy dataflow.
@main def run(cpgPath: String = "cpg.bin", outPath: String = "joern.json") = {
importCpg(cpgPath)
// ---- Source set: parameters/calls that introduce untrusted data ----
def sources = cpg.call.name(
"getParameter|getHeader|getQueryString" + // Java servlet
"|recv|read|fgets|fread|scanf|gets" + // C/C++ I/O
"|getenv" + // env
"|loads|get_json" // python-ish
).argument ++ cpg.method.parameter.name("argv|args|query|body|params|request|req")
// ---- Sink set keyed by CWE for reporting ----
val sinkSpecs = Map(
"CWE-78" -> "system|popen|exec|execve|execvp|ProcessBuilder|Runtime",
"CWE-89" -> "execute|executeQuery|createQuery|createNativeQuery|mysqli_query|query",
"CWE-94" -> "eval|compile|Function|create_function|assert",
"CWE-502" -> "readObject|unserialize|pickle.loads|XMLDecoder|deserialize",
"CWE-787" -> "memcpy|strcpy|strcat|sprintf|gets|memmove", // buffer write
"CWE-22" -> "fopen|open|readfile|sendFile|include|require",
"CWE-918" -> "urlopen|HttpClient|RestTemplate|curl_exec|fetch"
)
// ---- Sanitizers: flows passing through these are downgraded, not dropped ----
def sanitizers = cpg.call.name(
"escapeshellarg|htmlspecialchars|parseInt|Integer.parseInt|prepareStatement" +
"|shlex.quote|html.escape|realpath|basename|normalize|filter_var"
)
case class Finding(cwe: String, sink: String, file: String, line: Int,
srcMethod: String, message: String)
val findings = scala.collection.mutable.ArrayBuffer[Finding]()
for ((cwe, pat) <- sinkSpecs) {
val sinkCalls = cpg.call.name(pat)
val sinkArgs = sinkCalls.argument
// reachableBy = is there a PDG path from a source into this sink argument?
val flows = sinkArgs.reachableBy(sources).l
flows.foreach { node =>
val callOpt = node.inAst.isCall.name(pat).headOption
callOpt.foreach { c =>
// Path-level sanitizer check: did the flow cross a sanitizer call?
val passed = c.argument.reachableByFlows(sanitizers).nonEmpty
if (!passed) {
findings += Finding(
cwe, c.name,
c.file.name.headOption.getOrElse("?"),
c.lineNumber.getOrElse(0),
c.method.fullName,
s"untrusted data reaches ${c.name} (${cwe}) without sanitizer"
)
}
}
}
}
// De-dupe and serialize to JSON for sast_runner merge.
val unique = findings.distinct
val json = unique.map { f =>
s""" {"tool":"joern","cwe":"${f.cwe}","rule":"${f.cwe}","severity":"error",""" +
s""""file":"${f.file.replace("\\","/")}","line":${f.line},""" +
s""""message":"${f.message}"}"""
}.mkString("[\n", ",\n", "\n]")
java.nio.file.Files.write(java.nio.file.Paths.get(outPath), json.getBytes)
println(s"[+] ${unique.size} taint flows -> ${outPath}")
}
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 |