← Back to Writeups
CUSTOMEasyReversing

crackme3

XESXOR9/2/20261 min read
#reversing#custom#easy#source_code_analysis#xor_decode_with_key

crackme3

Platform: CUSTOM | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: source_code_analysis, xor_decode_with_key

Summary

Walkthrough of the CUSTOM Reversing crackme3. Language: C. Source code of encoder provided + encoded flag file. Encoding uses XOR with random bytes.

Description

Language: C. Source code of encoder provided + encoded flag file. Encoding uses XOR with random bytes.

Analysis

Encoding algorithm:

c
srand(time(NULL));
for (i = 0; i < strlen(text); i++) {
    number = rand() & 0xff;
    fputc(text[i] ^ number, fd);  // encrypted byte
    fputc(number, fd);            // XOR key stored right next to it!
}

Key observation: each key byte (number) is written immediately after the encrypted byte. Knowledge of rand() is not needed. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Bytes come in pairs: (text[i] ^ key, key). Decoding is trivial:

python
with open('encoded_flag3', 'rb') as f:
    data = f.read()
result = ""
for i in range(0, len(data), 2):
    result += chr(data[i] ^ data[i+1])
# FLAG{REDACTED}

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

  • Mastering source_code_analysis, xor_decode_with_key was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-03-09 • CUSTOM • crackme3 • Difficulty: Easy