Unbreakable [MISC]
Last updated
Last updated
Think you can escape my grasp? Challenge accepted! I dare you to try and break free, but beware, it won't be easy. I'm ready for whatever tricks you have up your sleeve!
We start by downloading the source files.
We are given a
main.py
file that probably runs on the server. We can connect to the server using nc 94.237.56.118 35970
.
Looking at the main.py
file, we see that we can provide input which will be executed via eval. Unfortuantely there is a blacklist that prevents us from using certain characters.
Additionally a ()
is appended to the input, so we probably have to end our input with something that is callable.
Looking at the blacklist we figure out that we can use print
to output things, open
to open a file and read
to read the contents of the file.
We can also use single quotes so this payload would be valid to read the flag:
open('flag.txt').read
.
This would open the flag file and read its contents. Unfortunately this doesn't print the contents of the file, so we have to use print.
print(open('flag.txt').read())
doesn't work, because the appendend ()
would make it print(open('flag.txt').read())()
which results in an error.
Fortunately eval
supports multiple statements separated by a comma, so we can use print(open('flag.txt').read()),print
to print the flag.
This is valid because the appended ()
would make it print(open('flag.txt').read()),print()
which is a valid statement.