Cold Storage

Writeup for Cold Storage (Mobile) - 1337UP LIVE CTF (2024) ๐Ÿ’œ

Challenge Description

People say you should store your keys offline in cold storage, so I built this offline app! I think that's what cold storage means ๐Ÿค”

Solution

Open the mobile app with android-studio or GenyMotion or w/e and you'll find a crypto cold storage wallet that requires a pin.

Now is the time to decompile the APK with a tool like jadx-gui (maybe you did this first).

You will find it is a cordova app and in the index.html is the pin, simplez!

It retrieves the encrypted key.

It looks something like this (the UI and encrypted format changed a bit but I cba booting android-studio in my VM lol).

But that's no use, we want the decrypted key! Lets check the keygen() function.

Ewww.. obfuscation ๐Ÿคฎ There's a lot of approaches here. You might try to manually reverse, or throw it into some de-obfuscation tool ๐Ÿค”

You could also paste it into the console, then just run keygen(). It will give us abf6c8abb5daabc8ab69d7846def17b19c6dae843a6dd7e1b1173ae16db184e0b86dd7c5843ae8dee15f again, but with some breakpoints you can trace through the logic.

Maybe you focus on values you can see in the original code, e.g. what is 9425749445e494332757363353f5d6f50353b79445d7336343270373270366f586365753f546c60336f5 when unhexed? Unfortunately, not plaintext!

Let's deobfuscate.

Much better! I'll also ask ChatGPT to further deobfuscate, including variable renaming, comments etc.

We can paste that into the devtools console and print out each step.

This time, we get some new values.

Hex decoding d733634327037353f546c60336f5332757363353f5270366f5863657d6f50353b794459425749445e494 produces garbage.

Alright, let's convert the other arrays to ASCII.

We get our flag!

Flag: INTIGRITI{50_much_f0r_53cur3_c0ld_570r463}

Last updated