L33tcoder

Description

Six rounds of interviews and you still have to do this?

Source: l33tcoder.ziparrow-up-right

Author: @tsutoarrow-up-right

Solution

Application is a sandbox for Python, we are given assignment but as always we need RCE to read the flag.txt

L33tcoder.png

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]).

L33tcoder-1.png

leetcode_validator/main.py:

We are very limited in terms of code execution.

Code may only have

  1. 1 top level function

  2. No imports

  3. 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-latexipyarrow-up-right and https://note.tonycrane.cc/writeups/seccon2022/arrow-up-right

Turns out python has "Magic Comments" (How does the "magic lines(s)" in python work, when specifying encoding in python file?arrow-up-right) which we can abuse.

L33tcoder-2.png
circle-check

Last updated