mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
67 lines (66 loc) • 1.87 kB
YAML
rules:
- id: detect-child-process
message: >-
Allowing spawning arbitrary programs or running shell processes with arbitrary arguments may end up
in a command injection vulnerability.
Try to avoid non-literal values for the command string.
If it is not possible, then do not let running arbitrary commands, use a white list for inputs.
metadata:
cwe:
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"
owasp:
- A01:2017 - Injection
- A03:2021 - Injection
category: security
technology:
- javascript
- aws-lambda
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- vuln
likelihood: MEDIUM
impact: HIGH
confidence: MEDIUM
references:
- https://owasp.org/Top10/A03_2021-Injection
languages:
- javascript
- typescript
severity: ERROR
mode: taint
pattern-sources:
- patterns:
- pattern: $EVENT
- pattern-either:
- pattern-inside: |
exports.handler = function ($EVENT, ...) {
...
}
- pattern-inside: |
function $FUNC ($EVENT, ...) {...}
...
exports.handler = $FUNC
- pattern-inside: |
$FUNC = function ($EVENT, ...) {...}
...
exports.handler = $FUNC
pattern-sinks:
- patterns:
- focus-metavariable: $CMD
- pattern-either:
- pattern: exec($CMD,...)
- pattern: execSync($CMD,...)
- pattern: spawn($CMD,...)
- pattern: spawnSync($CMD,...)
- pattern: $CP.exec($CMD,...)
- pattern: $CP.execSync($CMD,...)
- pattern: $CP.spawn($CMD,...)
- pattern: $CP.spawnSync($CMD,...)
- pattern-either:
- pattern-inside: |
require('child_process')
...
- pattern-inside: |
import 'child_process'
...