L33tcoder
Description
Six rounds of interviews and you still have to do this?
Source: l33tcoder.zip
Author: @tsuto
Solution
Application is a sandbox for Python, we are given assignment but as always we need RCE to read the flag.txt

Application comes with custom module called uscg-leetcode-validator, which is the sandboxing software~ It always has code_path (argv[1]) and test_path (argv[2]).

leetcode_validator/main.py:
We are very limited in terms of code execution.
Code may only have
1 top level function
No imports
defined safe functions
By normal standards we cannot execute any python code via function itself.
After some research I found similar web challenge writeup: https://blog.arkark.dev/2022/11/18/seccon-en/#misc-latexipy and https://note.tonycrane.cc/writeups/seccon2022/
Turns out python has "Magic Comments" (How does the "magic lines(s)" in python work, when specifying encoding in python file?) which we can abuse.

Flag: SVUSCG{a400dcfadd525006cb3747846c3d60cc}
Last updated