@@ -10,6 +10,8 @@ import python
10
10
import semmle.python.security.TaintTracking
11
11
import semmle.python.security.strings.Untrusted
12
12
13
+ /** Abstract taint sink that is potentially vulnerable to malicious shell commands. */
14
+ abstract class CommandSink extends TaintSink { }
13
15
14
16
private ModuleObject osOrPopenModule ( ) {
15
17
result .getName ( ) = "os" or
@@ -20,7 +22,7 @@ private Object makeOsCall() {
20
22
exists ( string name |
21
23
result = ModuleObject:: named ( "subprocess" ) .attr ( name ) |
22
24
name = "Popen" or
23
- name = "call" or
25
+ name = "call" or
24
26
name = "check_call" or
25
27
name = "check_output" or
26
28
name = "run"
@@ -61,7 +63,7 @@ class FirstElementFlow extends DataFlowExtension::DataFlowNode {
61
63
/** A taint sink that is potentially vulnerable to malicious shell commands.
62
64
* The `vuln` in `subprocess.call(shell=vuln)` and similar calls.
63
65
*/
64
- class ShellCommand extends TaintSink {
66
+ class ShellCommand extends CommandSink {
65
67
66
68
override string toString ( ) { result = "shell command" }
67
69
@@ -100,7 +102,7 @@ class ShellCommand extends TaintSink {
100
102
/** A taint sink that is potentially vulnerable to malicious shell commands.
101
103
* The `vuln` in `subprocess.call(vuln, ...)` and similar calls.
102
104
*/
103
- class OsCommandFirstArgument extends TaintSink {
105
+ class OsCommandFirstArgument extends CommandSink {
104
106
105
107
override string toString ( ) { result = "OS command first argument" }
106
108
0 commit comments