picoCTF - Reverse Engineering - Safe Opener
Contents
Reverse Engineering - Safe Opener - writeup
description
Can you open this safe?
I forgot the key to my safe but this program is supposed to help me with retrieving the lost key.
Can you help me unlock my safe?
Put the password you recover into the picoCTF flag format like: picoCTF{password}
writeup
The “safe” is a .java file.
Since .java is used for java source code this should be fairly easy to reverse engineer.
In the main method of the class ‘SafeOpener’, directly at the top I see this:
|
|
So the key is simply encoded in base64.
Inside the method ‘boolean openSafe(String password)’ I found this:
|
|
So that is the encoded key.
All I have to do here is to decode the aforementioned key using base64 decoding.
|
|
That should be the correct password.
Let’s compile and run that java code…
|
|
|
|
|
|
And here we have our flag.
|
|