Skip to content

Instantly share code, notes, and snippets.

@saru2017
Created June 16, 2019 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saru2017/b5daf3c18de9dda195f1979ce9cdac8e to your computer and use it in GitHub Desktop.
Save saru2017/b5daf3c18de9dda195f1979ce9cdac8e to your computer and use it in GitHub Desktop.
CTF: pwn05
#!/usr/bin/python3
import sys, os, tempfile, subprocess
data = input(">").strip()
if len(data) > 12:
print("too large file")
exit(-1)
with tempfile.TemporaryDirectory() as dirname:
name = os.path.join(dirname, "user")
f = open(name, "w")
f.write(data)
f.close()
os.chmod(name, 0o500)
print(subprocess.check_output(name).decode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment