Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

injection-flaws

БесплатноБез исполняемых скриптовНе проверен

Detects injection vulnerabilities in code — SQL/NoSQL injection (including NoSQL operator injection), OS command injection, cross-site scripting (XSS), path…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

Injection Flaws

Method

For each category: (1) grep for sink patterns — the table below and references/patterns.md have ready-to-run commands per language, and references/frameworks.md has framework-specific dangerous/safe construct tables (Express, Django, Spring, Rails, Laravel, Go); (2) for each hit, trace backwards to the input source; (3) report only if untrusted input reaches the sink without a real sanitizer.

Source → sink tracing. Untrusted sources: HTTP params/body/headers/cookies, file uploads, DB rows fed to templates, webhook payloads, environment-adjacent user data, message queues. Sanitizers that count: parameterized queries, allowlist validation, DOMPurify for HTML, framework auto-escaping (verify it's actually on), shlex.quote/argument-array subprocess calls, canonicalized + allowlisted paths. "Escaping" done by string formatting does NOT count.

Second-order (stored) flows. The input isn't always the request in front of you. Treat these as untrusted sources and re-check sink greps against their outputs:

  • DB/model rows at render time — the classic stored XSS: sanitized on write, rendered raw on read (<%- user.bio %>, \|safe, {!! !!}, v-html, dangerouslySetInnerHTML on model fields). Write-path validation ≠ read-path safety; check the READ path even when the write path looks clean.
  • Webhook/queue/cron payloads — worker consuming messages that hit command/SQL/URL sinks (exec(job.cmd), query(task.sql)). Producers are not trust boundaries.
  • Exports — data written to CSV/HTML opened in Excel/Sheets: formula injection (=cmd|..., @SUM() unless -/=/+/@ prefixes are stripped.
  • Upstream service headers/bodies on internal calls — see trusted-header rules in ../auth-review/SKILL.md.

Query-builder raw APIs are SQL sinks too — the ORM does not save you at the raw boundary:

rg -n "\.raw\(|\.literal\(|knex\.raw|sequelize\.literal|typeOrm.*\.query\(|createNativeQuery|cursor\.execute\(\s*f?[\"'].*\{|MyBatis.*\$\{" 

knex.raw('... ' + req.query.sort), sequelize.literal(...) with interpolation, createNativeQuery concat, MyBatis ${} (vs safe #{}) — all equal to string-built SQL.

Multi-line construction: single-line greps miss queries built across lines (triple-quoted f-strings, chained concatenation). Run bounded multiline scans on the DB layer only — they're slow on whole repos:

rg -nU "execute\(\s*[frb]?['\"]{3}[\s\S]{0,300}(SELECT|INSERT|UPDATE|DELETE)[\s\S]{0,300}(\$\{|%s|\+|f['\"]|#\{)" app/ db/ models/ 2>/dev/null

Categories & quick greps

SQL / NoSQL injection

rg -n -i "(SELECT|INSERT|UPDATE|DELETE).*(\$\{|%s|%d|\+|f['\"]|\.\s*\$|#{|\"\s*\+)" -g '!*.min.js' -g '!test/**'
rg -n "\\\$where|\\\$expr|MongoClient.*eval|mapReduce"            # NoSQL: JS-in-query

Confirm the value is bound (?, $1, :param, .execute(sql, params)) vs concatenated/interpolated. String-built queries that only touch constants are noise.

Split construction defeats the single-line grep (drill finding, gaps4): the SELECT literal on one line, the taint on another (const base = 'SELECT ...'; pool.query(base + req.params.ref)). Run the CALL-SITE grep too:

rg -n "(query|execute)\(\s*\w+\s*\+" -g '*.js' -g '*.ts'

NoSQL operator injection: in document stores the query object IS the API — passing request data straight through lets attackers inject operators. User.find({ password: req.body.password }) accepts {"password": {"$ne": ""}} → auth bypass; $where/$function = JS execution in the DB.

rg -n "(find|findOne|findOneAndUpdate|updateOne|deleteOne|aggregate)\(\s*\{\s*\.\.\.(req|ctx|event)\.|\{\s*\.\.\.(body|query|params)|find(One)?\(\s*\{[^}]*req\.(body|query)"

Report when a request object/field reaches a Mongo-style query without operator stripping (mongo-sanitize, allowlisted keys, $eq-coerced values, or an ODM schema that rejects operators). Safe-looking code that builds { [field]: value } with user-controlled field is the same bug.

OS command injection

rg -n "os\.system|subprocess\.(call|run|Popen)\(.*shell\s*=\s*True|child_process\.(exec|execSync)|spawn\([^)]*shell:\s*true|Runtime\.getRuntime\(\)\.exec|system\(|popen\(|exec\.Command\(.*\+"

PHP sinks are case-INSENSITIVE: SyStem(, EXEC(, PoPen( are the same calls — run the PHP sink census case-insensitively or the mixed-case spelling evades it (community-rule confirmation: semgrep's php exec-use went case-insensitive 2026-10 for exactly this):

rg -n -i "\b(system|exec|passthru|shell_exec|proc_open|popen)\s*\(" -g '*.php'
rg -n -i "(system|passthru|shell_exec|proc_open|popen)\s*\(\s*['\"][^'\"]*['\"]\s*\.\s*\$_(GET|POST|REQUEST)" -g '*.php'

exec("ls " + filename) = classic. Safe: execFile(cmd, [args]), subprocess.run([cmd, arg]) without shell=True. spawn(cmd, [args], { shell: true }) is NOT the safe shape — the shell re-parses the array (drill fin

Полный SKILL.md на GitHub

Установить injection-flaws в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSESOURCE.mdTRUST.auto.yamlreferences/frameworks.mdreferences/patterns.md

FAQ

Что делает скилл injection-flaws?

Detects injection vulnerabilities in code — SQL/NoSQL injection (including NoSQL operator injection), OS command injection, cross-site scripting (XSS), path traversal, SSRF, insecure deserialization, template injection (SSTI), XXE, prototype pollution, ReDoS, open redirect, and unsafe file upload handling. Covers Node/JS, Python, Java, Go, PHP, Ruby, C# with per-language grep patterns and context-review rules. Use when auditing input handling, query construction, file operations, subprocess calls, XML parsing, file uploads, or template rendering.

Как установить скилл injection-flaws?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл injection-flaws запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить injection-flaws с