Angstrom Rev Writeups

Written in

by

I’ve decided to fully focus on Rev and Web for CTFs now, as I find Pwning too magical, and not really “useful” to me. Anyhoo, here are some reversing writeups from Angstrom CTF!

Dyn

Running the code, we see that it gets the flag as an input

image

Stepping through the code, it tries to unwrap 32 characters, which tells us that there are 32 characters between actf{ and }

image

We put in some jumbled input to see where the program takes us

image

The code reaches a part where it does a comparison with our jumbled input with a certain strings

image
image
image

We simply map back the jumbled index with our input, and reorder the string it’s checking against to get the correct flag

input_str = list("qwertyuiopasdfghjkl;zxcvbnm,./!@")

jumbled_str = list("ytiuwqrefdhgposaxzvckj;l/.@!nb,m")

jumbled_flag = list("_ynourtsd_tet_eh2_bfiasl7cedbda7")

flag = ""

for c in input_str:
    index = jumbled_str.index(c)
    flag += jumbled_flag[index]

print(flag)

image

Imposter

This program tries to allocate way too much memory. We just need to keep that in check and it will print the flag

The two offending instructions are:

image
image

We reduce the malloc to a smaller size, and remove the shl [rbp+size], 1] to shl rax, 0, which essentially does nothing

image
image

However, by doing that, we get a new error realloc(): invalid next size, which means that the amount of memory rellocated is too small for the new length of the string

image

So we push the numbers slightly higher to 100h and we see that some strings are being printed out which roughly resembles the flag

image
image
image

Through trial and error, setting it above 200h prints out the entire flag

image

Flatlands

The main parts of the code are

Looping through your input and comparing each character with the string NfTRcD1ontrw}4{mFl_Ad0ua

image

If the input character does not match the character in the string, this counter is incremented

image

If the input character matches a character in the string, the counter is compared this value

image

If the counter is equal, great. If the counter is not equal however, it does a second check with another value further down

image

In summary, you have to reorder NfTRcD1ontrw}4{mFl_Ad0ua so that characters are at the right index, and the counter matches the values

Tags

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: