Secure Bank

Writeup for Secure Bank (Rev) - 1337UP LIVE CTF (2024) πŸ’œ

Video walkthrough

VIDEO

Challenge Description

Can you crack the bank?

Solution

Players try to login to the secure bank but don't have the correct pin.

./secure_bank
****************************************
*         Welcome to SecureBank        *
*    Your trusted partner in security  *
****************************************

========================================
=   SecureBank Superadmin Login System =
========================================

Enter superadmin PIN: 1234
Access Denied! Incorrect PIN.

Checking the strings will uncover the plaintext flag (different for remote) but no pin.

We could try a tool like ltrace to see if the pin comparison is displayed.

Unfortunately, it is not. Let's check the decompiled code with ghidra.

Static Analysis

Classic 1337, so predictable is almost unpredictable πŸ€”πŸ§ 

Checking the generate_2fa_code function, it looks a little complicated.

Nothing that a little variable renaming can't fix!

Much better! The obscure_code function is quite simple.

There's a lot of different ways to solve the challenge from here. One easy way might be to run the binary in a debugger like gdb (I like pwndbg) and set a breakpoint around the generate_2f_code function (or validate_2fa_code).

Dynamic Analysis

Actually, we want to break right after the function (offset 0x1386).

See the value being moved from the EAX register onto the stack? 0x568720 in decimal is 5670688, let's try it!

Solve.py

Another option is to make a solve script according to the decompiled code. I like to copy/paste from ghidra to ChatGPT and get a python script to run.

Flag: INTIGRITI{pfff7_wh47_2f4?!}

Last updated