CrossCTF_2018: Perfect

Category: Reversing Points: 476 Description:

'Cause we lost it all Nothin' lasts forever Creator - amon (@nn_amon) Update: this definitely works with python 2.7.15

Write-up

A simple challenge, running the binary through strings give us a slight clue to the innards,

$ strings perfect
[...]
k = "".join([chr(random.randint(0, 255)) for i in range(35)])
xor(k, 754e26ccd4b1bfafb3ffbdaa748780b7f0e0c3ae9acc3c008670f0fafd34f8ffa596db)
[...]

So we have a random generator as well as a XOR key. Clearly the random generator cannot be truly random else it wouldn't make sense... would it?

Looking deeper into the mysteries of the binary, we find this chunk of code that seems to be key to solving the challenge,

Screen-Shot-2018-06-19-at-10.53.37-PM

We can create a script for this,

#! /usr/bin/env python3
##
import random
import binascii

def xor(a, b):
    b = binascii.unhexlify(b)
    x = ""
    for c, d in zip(a, b):
        x += chr(ord(c) ^ ord(d))
    return x

# Get perfect number
 random.seed(14474011154664524427946373126085988481573677491474835889066354349131199152128)
# Get key
k = "".join([chr(random.randint(0, 255)) for i in range(35)])
# Get flag
flag = xor(k, "754e26ccd4b1bfafb3ffbdaa748780b7f0e0c3ae9acc3c008670f0fafd34f8ffa596db")
print(f"Flag: {flag}")

Running the script gives us the flag,

# python solve.py 
CrossCTF{why_am_1_aw4ke_r1ght_n0ww}

Therefore, the flag is CrossCTF{why_am_1_aw4ke_r1ght_n0ww}.

results matching ""

    No results matching ""