Base information
CTF name: Nixu Challenge
Challenge name: vault
Challenge description: Can you guessss the passssword? (Nah, I lied, no guessing is needed.)
Target: vault (python 2.7 byte-compiled)
Challenge category: Scripting
Challenge points: 100
Year: 2018
Solution
First I run strings command against vault. I found interesting string, but I was not able to get anything from that.
7d650dee190a3e1770c211fad8356996f873367e76008f30bdb932f2820b809e
Then I put the file in reversing software Cutter. I decided to start writing the
software back to its original form and check if code I had written
looks similar when converted to python byte-code using
dis
library.
Then I realized I need to use Python version 2.7 for better
results. At the end of reversing check()
funktion, I
realized the correct password. I still wanted to fully reverse the
vault program.

- Screenshot of Cutter, showing the byte-code of vault.

- Screenshot of code editor printing my code in byte-code.
Reverse Engineered vault.py
import time
import binascii
from Crypto.Cipher import AES
= "s4Pd"
y
def get_passwd():
return raw_input('Password: ')
def check(_s):
global y
= '0w5' + y + 'r'
z = (_s[6:8] + _s[0:3] + _s[3:6])[::-1]
x return x == z
def get_secret(k):
= binascii.unhexlify('7d650dee190a3e1770c211fad8356996f873367e76008f30bdb932f2820b809e')
secret = AES.new(k * 2, AES.MODE_CBC, b'thisIsNotTheFlag')
aes return aes.decrypt(secret)
= get_passwd()
s if check(s):
print(get_secret(s))
else:
5)
time.sleep(print('Invalid password!')
I leave the correct password for you to find out :)
Conclusion
This Challenge was fairly similar to one of GenZ 2022 challenges,
but still very good training for revere engineering. There is
probably some software to automate Python byte-code reversing.
Probably the hardest part was reversing get_secret()
function, it took me a while to realize witch variables belong to
where. Overall nice challenge.