AGENT SKILL

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, not load)
  • [ ] 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) and Embeddings 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

  1. Use execFile() with argument arrays instead of exec() with shell strings
  2. Never evaluate user-provided code
  3. Use allowlists for any dynamic module loading
  4. Use yaml.safeLoad() not yaml.load()
  5. Apply principle of least privilege to process permissions

04 同仓库更多 Skills

dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

add-new-agent

خطوات تفصيليّة لإضافة وكيل ذكاء اصطناعي جديد إلى منصّة Kalmeron من الفكرة إلى الإنتاج

Skill与智能体开发
★ 1
dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

writing-skills

Use when creating new skills, editing existing skills, or verifying skills work before deployment

内容创作者测试与质量写作与文案
★ 1
dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

writing-plans

Use when you have a spec or requirements for a multi-step task, before touching code

内容创作者写作与文案
★ 1
dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

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".

设计师视觉设计
★ 1
dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

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'.

测试与质量前端开发
★ 1
dahaliztupe-sketch
dahaliztupe-sketch/Kalmeron-Two

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.

★ 1