-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6fe3c8
commit e611b65
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
set index=1 | ||
|
||
:loop | ||
if "%~1"=="" goto :end | ||
echo arg%index%: %1 | ||
set /a index+=1 | ||
shift | ||
goto :loop | ||
|
||
:end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import subprocess | ||
|
||
|
||
def teaser(): | ||
untrusted_input = "&calc.exe" | ||
subprocess.run(["echo_args.bat", untrusted_input]) | ||
|
||
|
||
def shell_ex(): | ||
subprocess.run( | ||
["python.exe", "-c", "import sys; print(sys.argv)", "&", "echo", "LOL"], | ||
shell=False, | ||
) | ||
subprocess.run( | ||
["python.exe", "-c", "import sys; print(sys.argv)", "&", "echo", "LOL"], | ||
shell=True, | ||
) | ||
subprocess.run( | ||
["cmd.exe", "/c", "python.exe", "-c", "import sys; print(sys.argv)", "&", "echo", "LOL"], | ||
shell=False, | ||
) | ||
|
||
|
||
def obviously_bad(): | ||
untrusted_input = "&calc.exe" | ||
subprocess.run(["python.exe", "-m", "timeit", untrusted_input], shell=True) | ||
|
||
|
||
def maybe_ok(): | ||
untrusted_input = "&calc.exe" | ||
subprocess.run(["python.exe", "-m", "timeit", untrusted_input], shell=False) | ||
|
||
|
||
def the_cve(): | ||
untrusted_input = "&calc.exe" | ||
subprocess.run(["echo_args.bat", untrusted_input], shell=False) | ||
|
||
|
||
def literally_noone(): | ||
untrusted_input = "calc.exe" | ||
subprocess.run(["cmd.exe", "/c", untrusted_input], shell=False) | ||
|
||
|
||
def main(): | ||
teaser() | ||
# shell_ex() | ||
# obviously_bad() | ||
# maybe_ok() | ||
# the_cve() | ||
# literally_noone() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |