The Magic of Bytes

Description

I heard my friend wants to prepare for the new AP Cybersecurity CollegeBoard is adding soon, so I prepared a challenge with two python reverse engineering techniques. He insisted on it having an ELF binary though, so I also included it. Can you solve the challenge?

Solution

chall.py:

ELF_bytes = #"REDACTED"
key = #REDACTED
def not_so_fast(ELF_bytes,key):
    message = ""
    for i in range(len(ELF_bytes)):
        message += chr(ord(ELF_bytes[i]) + key)
    return message

with open("bytes.txt","a") as file:
    file.write("You want your ELF challenge so bad? Well here it is!\n")
    file.write(not_so_fast(ELF_bytes,key))

bytes.txt is too long to paste, so here's the portion

The_Magic_of_Bytes.png

ELF_bytes must be the bytearray of ELF file itself, and the key might be fixed value so output is masked as something else.

After lots of trials and error, bruteforcing the index and reading the output I realized that key 9 gave output it hex, but not bytes... raw hex.

Get the ELF file:

Validate elf:

https://dogbolt.org/?id=41fbcb8d-1021-4bdf-be34-88419ad6b2e4#Ghidra=1136&Hex-Rays=152&BinaryNinja=89arrow-up-right

The_Magic_of_Bytes-1.png

Decode hex once more:

Check file:

Decompile with uncompyle6arrow-up-right

circle-check

Last updated