sast-rce
Detect Remote Code Execution (RCE) vulnerabilities in Node.js/Python backend code. Use when reviewing API routes that handle file paths, shell commands, code evaluation, or deserialization. Critical severity — always prioritize.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-05
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- sast-rce
- description
- Detect Remote Code Execution (RCE) vulnerabilities in Node.js/Python backend code. Use when reviewing API routes that handle file paths, shell commands, code evaluation, or deserialization. Critical severity — always prioritize.
03 SKILL.md 正文
SAST: Remote Code Execution (RCE) Detection
Scan for RCE vulnerabilities — OWASP A03:2021. Highest priority — always fix.
What to Look For
Critical Patterns (Node.js)
// ❌ CRITICAL: shell command with user input
import { exec, execSync } from 'child_process';
exec(`convert ${userFilename} output.pdf`); // command injection
execSync(`ffmpeg -i ${req.body.input} ...`);
// ❌ CRITICAL: eval with user input
eval(req.body.code);
vm.runInNewContext(userCode);
// ❌ CRITICAL: require() with user-controlled path
require(req.query.module);
import(userPath);
// ❌ CRITICAL: deserialize untrusted data
JSON.parse(userInput); // safe, but:
serialize.unserialize(cookie); // node-serialize — CVE-2017-5941
yaml.load(userYaml); // js-yaml safeLoad vs load
Safe Patterns
// ✅ SAFE: execFile with argument array (no shell)
import { execFile } from 'child_process';
execFile('convert', [sanitizedFilename, 'output.pdf']);
// ✅ SAFE: allowlist validation
const ALLOWED_MODULES = ['analytics', 'reports'] as const;
if (!ALLOWED_MODULES.includes(req.query.module)) throw new Error('Invalid');
Scan Checklist
- [ ] No
exec()/execSync()/spawn()with user-controlled input - [ ] No
eval()/new Function()/vm.runInNewContext()with user data - [ ] No dynamic
require()/import()with user-controlled paths - [ ] Deserialization libraries verified (js-yaml uses
safeLoad, notload) - [ ] File path operations use
path.resolve()+startsWith(allowedDir)check - [ ] No server-side template engines with user-controlled templates
Next.js / API Route Specific
- Check
app/api/routes that accept file paths in body/query - Verify
PDF Worker(port 8000) andEmbeddings Worker(port 8099) FastAPI routes - Check
src/ai/agents/for any dynamic code execution
Severity Matrix
| Pattern | Severity |
|---|---|
exec() with user input |
Critical |
eval() with user data |
Critical |
Dynamic require() |
Critical |
| Unsafe YAML deserialization | High |
| Path traversal leading to RCE | Critical |
Remediation
- Use
execFile()with argument arrays instead ofexec()with shell strings - Never evaluate user-provided code
- Use allowlists for any dynamic module loading
- Use
yaml.safeLoad()notyaml.load() - Apply principle of least privilege to process permissions
04 同仓库更多 Skills
add-new-agent
خطوات تفصيليّة لإضافة وكيل ذكاء اصطناعي جديد إلى منصّة Kalmeron من الفكرة إلى الإنتاج
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
vitest
Set up Vitest testing in any project — detects project type (Cloudflare Workers, React, Node), generates vitest.config.ts, test setup, utilities, and sample tests. Also covers mocking patterns, coverage config, workspace setup, and Jest migration. Trigger with 'set up vitest', 'add tests', 'configure vitest', 'migrate from jest', 'vitest config', 'add unit tests', or 'testing setup'.
verification-loops
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs. Requires running verification commands and confirming output before making any success claims. Evidence before assertions always.