LIT CTF 2023 - obfuscation
Description
Category: Rev
just an obfuscation challenge using base64
Resolution
Open the script obf.py
and there are a lot of obfusctaion.
We could try to deobfuscate all the code to try to understand it but we don’t need to.
Indeed the last eval of the script:
1
eval(compile(AES_DECRYPT(eval('\x74\x72\x75\x73\x74')),'<string>','exec'))
seems to excecute all the encoded code above.
So we just need to print it instead of evaluate it (and also get rid of conpile
because it will just print the object):
1
print(AES_DECRYPT(eval('\x74\x72\x75\x73\x74')))
Then we run all the script again to print the decoded code:
1
b'from time import sleep\n\nflag = "LITCTF{g00d_j0b_ur_d1d_1t}"\npasswd = "this is not it, but please try again!"\n\nprint("Welcome to the flag access point.")\nprint("Press Ctrl+C to quit.")\n\ntry:\n while True:\n user_input = input("Please enter your password: ")\n print("Loading...")\n sleep(0.5)\n print("Busy bamboozling some spam...")\n sleep(2)\n if user_input == passwd:\n print("Nice one!")\n print(flag)\n else:\n print("Oops.")\n print("Try again.")\nexcept KeyboardInterrupt:\n print("Bye! :-)")'
And we get the flag: LITCTF{g00d_j0b_ur_d1d_1t}
.
This post is licensed under
CC BY 4.0
by the author.