Skip to content

Commit 557a5b4

Browse files
authored
Merge pull request github#11555 from pwntester/new_python_cmdi_sinks
Added two new CMDi sinks for python's stdlib
2 parents 636d5e3 + 7fe4108 commit 557a5b4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
- Added `subprocess.getoutput` and `subprocess.getoutputstatus` as new command injection sinks for the StdLib.
5+

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,13 +1163,16 @@ private module StdlibPrivate {
11631163
API::Node subprocess() { result = API::moduleImport("subprocess") }
11641164

11651165
/**
1166-
* A call to `subprocess.Popen` or helper functions (call, check_call, check_output, run)
1166+
* A call to `subprocess.Popen` or helper functions (call, check_call, check_output, run, getoutput, getstatusoutput)
11671167
* See https://docs.python.org/3.8/library/subprocess.html#subprocess.Popen
1168+
* ref: https://docs.python.org/3/library/subprocess.html#legacy-shell-invocation-functions
11681169
*/
11691170
private class SubprocessPopenCall extends SystemCommandExecution::Range, DataFlow::CallCfgNode {
11701171
SubprocessPopenCall() {
11711172
exists(string name |
1172-
name in ["Popen", "call", "check_call", "check_output", "run"] and
1173+
name in [
1174+
"Popen", "call", "check_call", "check_output", "run", "getoutput", "getstatusoutput"
1175+
] and
11731176
this = subprocess().getMember(name).getACall()
11741177
)
11751178
}

0 commit comments

Comments
 (0)