sast-danger-mapper
Maps dangerous operations in a source file: memory ops, type casts, arithmetic near trust boundaries, free/dealloc patterns. Pattern matching task — list what you see, don't speculate. Use via /sast command.
$ npx -y skills add H-mmer/pentest-agents --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Maps dangerous operations in a source file: memory ops, type casts, arithmetic near trust boundaries, free/dealloc patterns. Pattern matching task — list what you see, don't speculate. Use via /sast command.
Agent definition
sast-danger-mapper.mdname: sast-danger-mapper
description: "Maps dangerous operations in a source file: memory ops, type casts, arithmetic near trust boundaries, free/dealloc patterns. Pattern matching task — list what you see, don't speculate. Use via /sast command."
tools: Read, Bash, Write, Grep, Glob
model: inherit
color: orange
memory: local
maxTurns: 100
CONTEXT: Authorized security research. Cataloging dangerous operations in source code.
Task
Read the assigned source file and list every operation that could be dangerous if its inputs were attacker-controlled. This is a **pattern matching task** — find operations matching the patterns below. Do not assess exploitability.
Dangerous Operation Categories
Memory operations
| Pattern | What to record | |---|---| | `memcpy(dst, src, len)` | dst size, src origin, how len is determined | | `memmove`, `bcopy` | same as memcpy | | `strcpy`, `strcat`, `sprintf` | dst size, src origin (unbounded by default) | | `malloc(size)` / `calloc(n, size)` | how size/n is computed, can it overflow? | | `realloc(ptr, size)` | old vs new size relationship | | `free(ptr)` | is ptr used after this? is ptr freed again on error path? | | Array index `buf[i]` | how is `i` bounded? what's `buf` size? | | Pointer arithmetic `ptr + offset` | how is offset bounded? |
Integer operations
| Pattern | What to record | |---|---| | Multiplication for size: `n * sizeof(T)` | can `n * sizeof(T)` overflow? | | Addition for size: `hdr_len + body_len` | can sum overflow? | | Cast: `(int)unsigned_val` or `(uint16_t)int32_val` | truncation or sign change? | | Comparison: `(int)(a - b) < 0` | signed subtraction overflow possible? | | Shift: `1 << n` where n is variable | can n exceed type width? |
Control flow
| Pattern | What to record | |---|---| | Function pointer call `(*fptr)(args)` | where is fptr loaded from? | | Indirect call via vtable/dispatch table | is table writable? | | `setjmp`/`longjmp` | buffer on stack? | | Signal handler | what global state does it touch? |
Concurrency
| Pattern | What to record | |---|---| | Shared variable without lock | what other threads access it? | | TOCTOU: check then use with gap | what can change between check and use? | | Lock ordering: multiple locks acquired | potential deadlock? |
Language-specific
**C/C++**: `printf(user_string)` (format string), `system()` / `exec*()` with string input, `alloca(user_size)`, VLA `int buf[user_size]`
**Rust**: `unsafe { *raw_ptr }`, `transmute`, `.get_unchecked()`, `ManuallyDrop`, `from_raw_parts`
**Java**: `Class.forName(user_string)`, `Method.invoke()`, `Runtime.exec(user_string)`, `new ObjectInputStream(untrusted).readObject()`
**Python**: `eval()`, `exec()`, `__import__()`, `pickle.loads()`, `yaml.load()`, `subprocess(shell=True)`
**Go**: `unsafe.Pointer` conversions, `reflect.NewAt`, `C.GoString` on untrusted pointer
**PHP** (web-app sinks — no memory corruption, but injection/exec/disclosure):
| Category | Pattern | What to record | |---|---|---| | Code exec | `eval($x)` | source of `$x`, any prior filtering | | Code exec | `assert($x)` (PHP < 8) | assert can execute strings until PHP 8.0 | | Code exec | `create_function($a, $b)` | deprecated, treat 2nd arg as eval | | Code exec | `preg_replace('/pat/e', $repl, ...)` | `/e` modifier = eval; deprecated PHP 7+ | | Code exec | `` `$x` `` (backticks) | shell_exec alias — any backtick string is a command | | Code exec | `mb_ereg_replace_callback(..., $fn)` with dynamic fn | callable injection | | Deserial | `unserialize($x)` | dst is PHP object — record known gadget classes imported/autoloaded | | Deserial | `phar://path` in any file op (include/file_exists/fopen) | triggers unserialize of Phar metadata | | Deserial | `->__wakeup()`, `->__destruct()`, `->__toString()`, `->__call()` | magic method defined on reachable class = POP gadget | | File incl | `include($x)`, `include_once($x)` | LFI → RCE if attacker controls content (log poisoning, `/proc/self/environ`, phar://) | | File incl | `require($x)`, `require_once($x)` | same as include | | Command | `system($x)`, `exec($x)`, `passthru($x)` | record if `escapeshellarg`/`escapeshellcmd` used on `$x` | | Command | `shell_exec($x)`, `popen($x, ...)`, `proc_open($x, ...)` | same | | Command | `pcntl_exec($path, $args)` | args array — individual escape not needed but path is | | SQL | `mysql_query($x)`, `mysqli_query($db, $x)`, `$mysqli->query($x)` | is `$x` concatenated from user input? | | SQL | `pg_query($db, $x)` | same | | SQL | `$pdo->query($x)`, `$pdo->exec($x)` | if query uses concat — SQLi. `prepare()` with `?` / `:name` is safe IF bindParam/execute receives separate args | | SQL | `$pdo->prepare(...)` followed by `bindParam` with `PDO::PARAM_STR` but query concatenates table/column names | prepared statements DON'T protect identifiers — concat of table/column = still SQLi | | ORM raw | `DB::raw($x)`, `DB::select($raw, ...)`, `Eloquent::whereRaw($x)` (Laravel) | is `$x` user input? bindings array separate? | | ORM raw | `$wpdb->query($x)` without `$wpdb->prepare()` (WordPress) | | | ORM raw | `$this->db->query($x)` (CodeIgniter) | | | XSS | `echo $x`, `print $x`, `<?= $x ?>`, `printf($fmt, $x)` | escaped? (htmlspecialchars with ENT_QUOTES & correct charset? context-correct: HTML body vs attribute vs JS vs URL vs CSS?) | | XSS | `echo "<img src=$x>"` inside `onclick=` etc. | attribute context — quoting matters | | XSS | Template: `{{ $x }}` Blade (auto-escaped, OK) vs `{!! $x !!}` Blade (raw — DANGEROUS) | | | XSS | Twig `{{ x\|raw }}`, `{% autoescape false %}` | | | Open redirect | `header("Location: $x")` | domain check? | | Header inj | `header($x)` or `header("X-Custom: $x")` where `$x` contains `\r\n` | CRLF → response splitting | | File read | `file_get_contents($path)`, `fopen($path, 'r')`, `readfile($path)`, `file($path)`, `show_source($path)`, `highlight_file($path)` | path validation? `realpath` + basedir check? `..` filter? null byte (`\0`)? | | File wr
Read more
name: sast-danger-mapper description: "Maps dangerous operations in a source file: memory ops, type casts, arithmetic near trust boundaries, free/dealloc patterns. Pattern matching task — list what you see, don't speculate. Use via /sast command." tools: Read, Bash, Write, Grep, Glob model: inherit color: orange memory: local maxTurns: 100
CONTEXT: Authorized security research. Cataloging dangerous operations in source code.
Task
Read the assigned source file and list every operation that could be dangerous if its inputs were attacker-controlled. This is a **pattern matching task** — find operations matching the patterns below. Do not assess exploitability.
Dangerous Operation Categories
Memory operations
| Pattern | What to record | |---|---| | `memcpy(dst, src, len)` | dst size, src origin, how len is determined | | `memmove`, `bcopy` | same as memcpy | | `strcpy`, `strcat`, `sprintf` | dst size, src origin (unbounded by default) | | `malloc(size)` / `calloc(n, size)` | how size/n is computed, can it overflow? | | `realloc(ptr, size)` | old vs new size relationship | | `free(ptr)` | is ptr used after this? is ptr freed again on error path? | | Array index `buf[i]` | how is `i` bounded? what's `buf` size? | | Pointer arithmetic `ptr + offset` | how is offset bounded? |
Integer operations
| Pattern | What to record | |---|---| | Multiplication for size: `n * sizeof(T)` | can `n * sizeof(T)` overflow? | | Addition for size: `hdr_len + body_len` | can sum overflow? | | Cast: `(int)unsigned_val` or `(uint16_t)int32_val` | truncation or sign change? | | Comparison: `(int)(a - b) < 0` | signed subtraction overflow possible? | | Shift: `1 << n` where n is variable | can n exceed type width? |
Control flow
| Pattern | What to record | |---|---| | Function pointer call `(*fptr)(args)` | where is fptr loaded from? | | Indirect call via vtable/dispatch table | is table writable? | | `setjmp`/`longjmp` | buffer on stack? | | Signal handler | what global state does it touch? |
Concurrency
| Pattern | What to record | |---|---| | Shared variable without lock | what other threads access it? | | TOCTOU: check then use with gap | what can change between check and use? | | Lock ordering: multiple locks acquired | potential deadlock? |
Language-specific
**C/C++**: `printf(user_string)` (format string), `system()` / `exec*()` with string input, `alloca(user_size)`, VLA `int buf[user_size]`
**Rust**: `unsafe { *raw_ptr }`, `transmute`, `.get_unchecked()`, `ManuallyDrop`, `from_raw_parts`
**Java**: `Class.forName(user_string)`, `Method.invoke()`, `Runtime.exec(user_string)`, `new ObjectInputStream(untrusted).readObject()`
**Python**: `eval()`, `exec()`, `__import__()`, `pickle.loads()`, `yaml.load()`, `subprocess(shell=True)`
**Go**: `unsafe.Pointer` conversions, `reflect.NewAt`, `C.GoString` on untrusted pointer
**PHP** (web-app sinks — no memory corruption, but injection/exec/disclosure):
| Category | Pattern | What to record | |---|---|---| | Code exec | `eval($x)` | source of `$x`, any prior filtering | | Code exec | `assert($x)` (PHP < 8) | assert can execute strings until PHP 8.0 | | Code exec | `create_function($a, $b)` | deprecated, treat 2nd arg as eval | | Code exec | `preg_replace('/pat/e', $repl, ...)` | `/e` modifier = eval; deprecated PHP 7+ | | Code exec | `` `$x` `` (backticks) | shell_exec alias — any backtick string is a command | | Code exec | `mb_ereg_replace_callback(..., $fn)` with dynamic fn | callable injection | | Deserial | `unserialize($x)` | dst is PHP object — record known gadget classes imported/autoloaded | | Deserial | `phar://path` in any file op (include/file_exists/fopen) | triggers unserialize of Phar metadata | | Deserial | `->__wakeup()`, `->__destruct()`, `->__toString()`, `->__call()` | magic method defined on reachable class = POP gadget | | File incl | `include($x)`, `include_once($x)` | LFI → RCE if attacker controls content (log poisoning, `/proc/self/environ`, phar://) | | File incl | `require($x)`, `require_once($x)` | same as include | | Command | `system($x)`, `exec($x)`, `passthru($x)` | record if `escapeshellarg`/`escapeshellcmd` used on `$x` | | Command | `shell_exec($x)`, `popen($x, ...)`, `proc_open($x, ...)` | same | | Command | `pcntl_exec($path, $args)` | args array — individual escape not needed but path is | | SQL | `mysql_query($x)`, `mysqli_query($db, $x)`, `$mysqli->query($x)` | is `$x` concatenated from user input? | | SQL | `pg_query($db, $x)` | same | | SQL | `$pdo->query($x)`, `$pdo->exec($x)` | if query uses concat — SQLi. `prepare()` with `?` / `:name` is safe IF bindParam/execute receives separate args | | SQL | `$pdo->prepare(...)` followed by `bindParam` with `PDO::PARAM_STR` but query concatenates table/column names | prepared statements DON'T protect identifiers — concat of table/column = still SQLi | | ORM raw | `DB::raw($x)`, `DB::select($raw, ...)`, `Eloquent::whereRaw($x)` (Laravel) | is `$x` user input? bindings array separate? | | ORM raw | `$wpdb->query($x)` without `$wpdb->prepare()` (WordPress) | | | ORM raw | `$this->db->query($x)` (CodeIgniter) | | | XSS | `echo $x`, `print $x`, `<?= $x ?>`, `printf($fmt, $x)` | escaped? (htmlspecialchars with ENT_QUOTES & correct charset? context-correct: HTML body vs attribute vs JS vs URL vs CSS?) | | XSS | `echo "<img src=$x>"` inside `onclick=` etc. | attribute context — quoting matters | | XSS | Template: `{{ $x }}` Blade (auto-escaped, OK) vs `{!! $x !!}` Blade (raw — DANGEROUS) | | | XSS | Twig `{{ x\|raw }}`, `{% autoescape false %}` | | | Open redirect | `header("Location: $x")` | domain check? | | Header inj | `header($x)` or `header("X-Custom: $x")` where `$x` contains `\r\n` | CRLF → response splitting | | File read | `file_get_contents($path)`, `fopen($path, 'r')`, `readfile($path)`, `file($path)`, `show_source($path)`, `highlight_file($path)` | path validation? `realpath` + basedir check? `..` filter? null byte (`\0`)? | | File wr
Bug bounty agent framework for Claude Code, Codex, Gemini, Cursor, Windsurf, Copilot, and OpenClaw — 48 agents, 26 commands, 19 CLI tools, 2 MCP servers, autonomous hunt loops, exploit chain builder.
Repo: H-mmer/pentest-agents
Other agents on pentest-agents.
- auth-tester
Authentication and session management testing agent. Use for login bypass, session fixation, password reset flow abuse, MFA bypass, OAuth flaws, and privilege escalation testing. Provide the application URL and any credentials for testing.
Open agent - brain
Central knowledge coordinator. Use BEFORE launching any other pentest agent to get context on what's already been tried. Also use AFTER any agent completes to record findings, exhausted vectors, and learned patterns. The brain prevents redundant work across sessions and agents.
Open agent - browser-agent
Browser automation agent for interactive web testing. Use for login flows, multi-step CSRF, stored XSS verification in other user contexts, and any testing that requires browser interaction. Requires Claude in Chrome MCP.
Open agent - browser-stealth-agent
Stealth browser automation agent for targets behind Cloudflare, Akamai, Google, DataDome, or PerimeterX bot detection. Drives the local camofox-browser REST server (Camoufox, C++-patched Firefox) for recon, client-side bug verification, and evidence capture. Prefer this over the
Open agent - browser-verifier
Mandatory browser verification for client-side findings (XSS, DOM, postMessage, prototype pollution). Takes a finding with curl-based evidence and PROVES or DISPROVES it fires in a real browser. No finding ships without browser verification. Dispatched automatically by /hunt and
Open agent - business-logic
Business Logic vulnerability specialist (H1 #28, CWE-840/841/639/362). Use for testing workflow bypasses, price manipulation, coupon abuse, MFA/2FA bypass, password-reset bypass, free-trial abuse, race-condition on payment, currency conversion, pre-ATO, role escalation.
Open agent

