-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdangerous-spawn-shell.yaml
More file actions
53 lines (53 loc) · 1.64 KB
/
Copy pathdangerous-spawn-shell.yaml
File metadata and controls
53 lines (53 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
rules:
- id: dangerous-spawn-shell
metadata:
cwe: "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"
owasp: 'A1: Injection'
source-rule-url: https://github.com/nodesecurity/eslint-plugin-security/blob/master/rules/detect-child-process.js
category: security
message: |
Detected non-literal calls to $EXEC(). This could lead to a command
injection vulnerability.
patterns:
- pattern-either:
- pattern: spawn(...)
- pattern: spawnSync(...)
- pattern: $CP.spawn(...)
- pattern: $CP.spawnSync(...)
- pattern-either:
- patterns:
- pattern-either:
- pattern: |
$EXEC("=~/(sh|bash|ksh|csh|tcsh|zsh)/",["-c", $ARG, ...],...)
- patterns:
- pattern: $EXEC($CMD,["-c", $ARG, ...],...)
- pattern-inside: |
$CMD = "=~/(sh|bash|ksh|csh|tcsh|zsh)/"
...
- pattern-not: |
$EXEC("=~/(sh|bash|ksh|csh|tcsh|zsh)/",["-c", "...", ...],...)
- patterns:
- pattern-either:
- pattern: |
$EXEC("=~/(sh|bash|ksh|csh|tcsh|zsh)/",[$ARG, ...],...)
- patterns:
- pattern: $EXEC($CMD,[$ARG, ...],...)
- pattern-inside: |
$CMD = "=~/(sh|bash|ksh|csh|tcsh|zsh)/"
...
- pattern-not: |
$EXEC("=~/(sh|bash|ksh|csh|tcsh|zsh)/",["...", ...],...)
- pattern-not-inside: |
$ARG = "..."
...
- pattern-either:
- pattern-inside: |
require('child_process')
...
- pattern-inside: |
import 'child_process'
...
severity: WARNING
languages:
- javascript
- typescript