/
formatted-string-bashoperator.yaml
58 lines (58 loc) · 1.79 KB
/
formatted-string-bashoperator.yaml
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
54
55
56
57
58
rules:
- id: formatted-string-bashoperator
message: >-
Found a formatted string in BashOperator: $CMD.
This could be vulnerable to injection.
Be extra sure your variables are not controllable by external sources.
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:
- airflow
references:
- https://owasp.org/Top10/A03_2021-Injection
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: HIGH
confidence: LOW
languages:
- python
severity: ERROR
pattern-either:
- pattern: |
airflow.operators.bash_operator.BashOperator(..., bash_command="..." + $CONCAT, ...)
- pattern: |
airflow.operators.bash_operator.BashOperator(..., bash_command="...".format(...), ...)
- pattern: |
airflow.operators.bash_operator.BashOperator(..., bash_command=f"...", ...)
- pattern: |
airflow.operators.bash_operator.BashOperator(..., bash_command="..." % $PARAMS, ...)
- pattern: |
$CMD = "..." % $PARAMS
...
airflow.operators.bash_operator.BashOperator(..., bash_command=$CMD, ...)
- pattern: |
$CMD = $STR.format(...)
...
airflow.operators.bash_operator.BashOperator(..., bash_command=$CMD, ...)
- pattern: |
$CMD = f"..."
...
airflow.operators.bash_operator.BashOperator(..., bash_command=$CMD, ...)
- pattern: |
$CMD = "..." + $CONCAT
...
airflow.operators.bash_operator.BashOperator(..., bash_command=$CMD, ...)
- pattern: |
$CMD = "..."
...
$CMD += $CONCAT
...
airflow.operators.bash_operator.BashOperator(..., bash_command=$CMD, ...)