Logo: Sast Danger Mapper

Sast Danger Mapper

Communautéit
H-mmer
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.

Iwwersiicht

EditeurH-mmer
Repositorypentest-agents
Skill-Nummsast-danger-mapper
Stären
999
Forks
188
Matgeliwwert Dateien
Nëmmen Instruktiounen
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    H-mmer huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Sast Danger Mapper an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/H-mmer/pentest-agents/tree/main/providers/openclaw/.agents/skills/agent-sast-danger-mapper
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/H-mmer/pentest-agents.git /tmp/pentest-agents
mkdir -p .claude/skills
cp -r /tmp/pentest-agents/providers/openclaw/.agents/skills/agent-sast-danger-mapper .claude/skills/sast-danger-mapper
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Sast Danger Mapper an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Sast Danger Mapper automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Sast Danger Mapper net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

PatternWhat to record
memcpy(dst, src, len)dst size, src origin, how len is determined
memmove, bcopysame as memcpy
strcpy, strcat, sprintfdst 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 + offsethow is offset bounded?

Integer operations

PatternWhat to record
Multiplication for size: n * sizeof(T)can n * sizeof(T) overflow?
Addition for size: hdr_len + body_lencan sum overflow?
Cast: (int)unsigned_val or (uint16_t)int32_valtruncation or sign change?
Comparison: (int)(a - b) < 0signed subtraction overflow possible?
Shift: 1 << n where n is variablecan n exceed type width?

Control flow

PatternWhat to record
Function pointer call (*fptr)(args)where is fptr loaded from?
Indirect call via vtable/dispatch tableis table writable?
setjmp/longjmpbuffer on stack?
Signal handlerwhat global state does it touch?

Concurrency

PatternWhat to record
Shared variable without lockwhat other threads access it?
TOCTOU: check then use with gapwhat can change between check and use?
Lock ordering: multiple locks acquiredpotential 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):

CategoryPatternWhat to record
Code execeval($x)source of $x, any prior filtering
Code execassert($x) (PHP < 8)assert can execute strings until PHP 8.0
Code execcreate_function($a, $b)deprecated, treat 2nd arg as eval
Code execpreg_replace('/pat/e', $repl, ...)/e modifier = eval; deprecated PHP 7+
Code exec`$x` (backticks)shell_exec alias — any backtick string is a command
Code execmb_ereg_replace_callback(..., $fn) with dynamic fncallable injection
Deserialunserialize($x)dst is PHP object — record known gadget classes imported/autoloaded
Deserialphar://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 inclinclude($x), include_once($x)LFI → RCE if attacker controls content (log poisoning, /proc/self/environ, phar://)
File inclrequire($x), require_once($x)same as include
Commandsystem($x), exec($x), passthru($x)record if escapeshellarg/escapeshellcmd used on $x
Commandshell_exec($x), popen($x, ...), proc_open($x, ...)same
Commandpcntl_exec($path, $args)args array — individual escape not needed but path is
SQLmysql_query($x), mysqli_query($db, $x), $mysqli->query($x)is $x concatenated from user input?
SQLpg_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 namesprepared statements DON'T protect identifiers — concat of table/column = still SQLi
ORM rawDB::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)
XSSecho $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?)
XSSecho "<img src=$x>" inside onclick= etc.attribute context — quoting matters
XSSTemplate: {{ $x }} Blade (auto-escaped, OK) vs {!! $x !!} Blade (raw — DANGEROUS)
XSSTwig {{ x|raw }}, {% autoescape false %}
Open redirectheader("Location: $x")domain check?
Header injheader($x) or header("X-Custom: $x") where $x contains \r\nCRLF → response splitting
File readfile_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 writefile_put_contents($path, $content), fwrite($fp, ...), copy($src, $dst), move_uploaded_file($tmp, $dst)where is $dst chosen? extension check? MIME on server?
File deleteunlink($path), rmdir($path)path traversal = arbitrary delete
Dirscandir($path), glob($path), opendir($path)info disclosure
SSRFcurl_exec($ch) with user URL, file_get_contents("http..."), fsockopen($host, $port), stream_socket_client, get_headers($url)URL allowlist? followed redirects? gopher/file scheme blocked?
XXEsimplexml_load_string($xml), simplexml_load_file($xml), DOMDocument::loadXML, SoapClient::__doRequestlibxml_disable_entity_loader(true) called? LIBXML_NOENT flag? PHP 8.0+ default is safer
Dynamic callcall_user_func($fn, ...), call_user_func_array($fn, ...), $obj->$method(), $fn(...) where $fn is variableattacker picks function/method → RCE
Dynamic classnew $cls($args), $cls::method()attacker-picked class instantiation — constructor RCE via phpggc-like chain
Type juggle== (loose compare) on auth token / hash / secret"0e1234..." == "0e5678..." both truthy (both parse to 0e scientific notation → 0)
Type jugglein_array($x, $arr) without 3rd arg trueloose compare, same bypass
Type jugglestrcmp($a, $b) with array arg (PHP < 8)returns NULL, loosely-equal to 0 → "match"
Auth bypassmd5($pass) == $stored, sha1(...)weak + type juggling
Auth bypasshash_equals missing → timing side-channel
LDAPldap_search($ds, $base, $filter)filter concat = LDAP injection
XPath$xml->xpath($x), DOMXPath::query($x)concat = XPath injection
Mailmail($to, $subj, $body, $headers)header injection via \r\n in $to/$subj/$headers
Session fixationsession_id($x) where $x from userattacker sets victim session id
Regex DoSpreg_match($pattern, $subject) where $pattern is userReDoS + /e (if PHP < 7)
Template injTwig\Environment::createTemplate($user), Smarty display("string:$user"), Blade compile($user)SSTI
Mass assignment$user->fill($_POST), $user->forceFill(...), (new User)->guard([])->fill(...)$fillable vs $guarded mis-config → privilege escalation
Path concat in stream wrappers"php://filter/resource=$file", "zip://$x", "data://text/plain,$x"filter chain for arbitrary read/write / code injection via convert.base64-decode
Insecure randrand(), mt_rand() for tokens/CSRF/resetuse random_bytes / random_int
Debugvar_dump, print_r, phpinfo(), debug_print_backtrace, xdebug_* in productioninfo disclosure if reachable

PHP "guard" to record (ALWAYS note if present/absent and the exact line):

  • escapeshellarg, escapeshellcmd (cmd injection — note that escapeshellcmd is NOT sufficient for args; escapeshellarg wraps each arg)
  • htmlspecialchars($x, ENT_QUOTES, 'UTF-8') (note flags and charset — missing flags = attribute context bypass)
  • htmlentities (similar)
  • strip_tags (weak — context-dependent)
  • addslashes (NOT sufficient for SQL — use prepared statements)
  • mysqli_real_escape_string (only valid with correct connection charset; GBK encoding attacks)
  • PDO::prepare + bindParam/bindValue/execute([...]) (safe for values, NOT identifiers)
  • basename($path), realpath($path), pathinfo() (path normalization — still needs allowlist)
  • filter_var($url, FILTER_VALIDATE_URL) (weak — http://allowed.com@evil.com passes)
  • parse_url checks (often bypassable)
  • is_numeric (allows 0x1A, 1e10, +1, -1, leading whitespace — NOT a security filter)
  • ctype_digit (stricter — only 0-9)
  • hash_equals (timing-safe compare)
  • password_verify (proper — uses hash_equals internally)
  • Framework middleware: Laravel CSRF, auth, throttle; Symfony security.yaml firewall; CodeIgniter CSRF token — note if present on the route but don't assume it works

For Each Dangerous Operation, Record

  1. Operation: exact function/pattern and line number
  2. Category: memory / integer / control-flow / concurrency / language-specific
  3. Operands: what variables feed into it
  4. Guard: what check (if any) protects this operation? Line number of the check.
  5. Neighbors: what operations happen immediately before/after (±5 lines)?

Output

Write to sast-work/<file_hash>-dangers.json:

json
{
  "file": "src/codec/h264_slice.c",
  "dangerous_ops": [
    {
      "operation": "memset(slice_table, -1, sizeof(slice_table))",
      "line": 83,
      "category": "memory",
      "operands": {"dst": "slice_table (uint16_t[])", "value": "-1 = 0xFF per byte = 65535 per entry", "size": "frame_width * frame_height / 256"},
      "guard": "none — unconditional initialization",
      "neighbors": "line 85: slice_count = 0 (int32_t)",
      "note": "memset -1 on uint16 creates sentinel value 65535. If slice_count (int32) reaches 65535, it collides with sentinel."
    },
    {
      "operation": "slice_table[mb_pos] = slice_count",
      "line": 147,
      "category": "integer",
      "operands": {"dst": "uint16_t", "src": "int32_t (truncation)"},
      "guard": "none — slice_count not bounded",
      "neighbors": "line 149: comparison uses slice_table[neighbor] == slice_table[mb_pos]"
    }
  ]
}

Rules

  • Be exhaustive. List every matching pattern. A missed dangerous op = a missed vulnerability later.
  • Record the guard even if it looks correct. The gap-analyzer will decide if it's sufficient.
  • The "note" field is optional — use it only when you see something obviously interesting (like the sentinel collision above). But keep it brief and factual.
  • Do NOT conclude anything is vulnerable. You are a cataloger, not an analyst.

Brain Integration

Check brain for prior analysis. Skip if already mapped and file unchanged.

Top-Tier Operator Standard

Danger mapping is a catalog of risky operations plus their guards.

  • Record sink, operation type, arguments, enclosing function, caller hint, and nearby validation.
  • Include "boring" guards: length checks, type checks, auth checks, escaping, canonicalization, feature flags, and error handling.
  • Do not infer vulnerability. Mark uncertainty and let flow/gap agents reason over it.
  • Prioritize sinks that transform attacker-controlled data into memory access, command execution, file access, network access, template rendering, deserialization, SQL, auth decisions, or state mutation.
  • Preserve line numbers and exact identifiers so later agents can trace without rereading the whole file.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Sast Danger Mapper op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Sast Danger Mapper besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Sast Danger Mapper an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/H-mmer/pentest-agents/tree/main/providers/openclaw/.agents/skills/agent-sast-danger-mapper an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Sast Danger Mapper benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Sast Danger Mapper benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Sast Danger Mapper domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Sast Danger Mapper gratis?

H-mmer huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇