Step 1: Click on the green button to Start the Lab
Step 2: Hack the URL or IP of the lab
Step 3: Use your skills and logic to find the flags!
The challenge presents a binary file with a hidden flag embedded within random data. The flag is stored as a string with a length indicator and marker.
Start by examining the file with basic tools:
strings
commandstrings secret_binary.bin
This will show you the printable strings in the file, including the flag and the "END_FLAG" marker.
xxd
for hex dumpxxd secret_binary.bin
This will show you the raw hexadecimal representation of the file.
The binary file has the following structure:
import struct
with open('secret_binary.bin', 'rb') as f:
# Skip 100 bytes of random data
f.seek(100)
# Read the flag length (4-byte integer)
flag_length = struct.unpack('I', f.read(4))[0]
# Read the flag
flag = f.read(flag_length).decode('utf-8')
print(f"Flag: {flag}")
# Extract the flag length
hex_length=$(xxd -p -s 100 -l 4 secret_binary.bin | tr -d '\n')
# Convert from little-endian hex to decimal
length=$((16#$(echo $hex_length | rev | sed 's/\([0-9a-f]\)\([0-9a-f]\)\([0-9a-f]\)\([0-9a-f]\)/\4\3\2\1/' | rev)))
# Extract the flag
flag=$(dd if=secret_binary.bin bs=1 skip=104 count=$length 2>/dev/null)
echo "Flag: $flag"
The flag is: 85fab29d-d6c6-4373-8a87-db3b83711b3a
To verify the solution:
strings
can quickly reveal hidden text dataIf the above methods don't work, you can also:
binwalk
to analyze the file structureobjdump
if the file is an executableThis challenge demonstrates several important concepts:
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.