Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3af5c72

Browse files
committed
Python: Add test of more indirect command injection sinks
1 parent f7f6564 commit 3af5c72

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

python/ql/test/experimental/library-tests/frameworks/stdlib/SystemCommandExecution.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ def os_members():
104104
subprocess.Popen(["cmd", "/c", "vuln"]) # $SystemCommandExecution_getCommand="cmd" $f-:SystemCommandExecution_getCommand="vuln"
105105
subprocess.Popen(["cmd", "/C", "vuln"]) # $SystemCommandExecution_getCommand="cmd" $f-:SystemCommandExecution_getCommand="vuln"
106106

107+
subprocess.Popen(["<progname>", "-c", "vuln"], executable="/bin/bash") # $SystemCommandExecution_getCommand="/bin/bash" $f-:SystemCommandExecution_getCommand="vuln"
108+
109+
if UNKNOWN:
110+
os.execl("/bin/sh", "<progname>", "-c", "vuln") # $SystemCommandExecution_getCommand="/bin/sh" $f-:SystemCommandExecution_getCommand="vuln"
111+
112+
os.spawnl(os.P_WAIT, "/bin/sh", "<progname>", "-c", "vuln") # $SystemCommandExecution_getCommand="/bin/sh" $f-:SystemCommandExecution_getCommand="vuln"
113+
107114
################################################################################
108115
# Taint related
109116

0 commit comments

Comments
 (0)