Writeup: Redpwn 2019 - Generic pyjail
Information
- category: misc
- points: 50
Description
When has a blacklist of insecure keywords EVER failed?
nc chall2.2019.redpwn.net 6006
Writeup
Connecting with netcat
to the server just output a typical python command line interface.
We can not input any of the blacklist.txt
words, doing this will end the connection to the server:
1 | import |
Working around I found that concatenating one or more string will work perfectly, the function that searches for blacklisted words won’t trigger any error; then our input is probably passed to the exec
function. Trying to execute flag.txt
with execfile
function will output the line of the file where python couldn’t comprehend the syntax, and here is the flag.
1 | 'exe'+'cfil'+'e("flag.txt")' |
Flag
flag{bl4ckl1sts_w0rk_gre3344T!}