← Back to Writeups
CUSTOMEasyReversing

Strangeness (Странность)

XESXOR9/10/20261 min read
#reversing#custom#easy#static_analysis#xor_decryption

Strangeness (Странность)

Platform: duckerz | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-01-09 | Status: Solved Techniques: static_analysis, xor_decryption

Summary

Task: Binary checks input for palindrome and outputs encrypted flag. Solution: Enter any palindrome to pass check, then XOR encrypted bytes with 0x41 to decrypt flag.

Strangeness (Странность) — duckerz

Description

The program asks for a string input and checks it for "strangeness". If the condition is met, it outputs the flag.

Analysis

When analyzing the strangeness binary (ELF 64-bit, not stripped), the following interesting points were discovered:

  1. main function:

    • Takes user input.
    • Calls a check function (likely a palindrome check).
    • If the check passes, the decrypt function is called.
  2. Check logic:

    • The program compares the string with its reversed copy. Thus, to get the flag, you need to enter any palindrome (e.g., aba or racecar). ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍
  3. decrypt function:

    • The .rodata section contains a byte array encrypted_flag.
    • The function iterates through this array and performs an XOR operation on each byte with the constant 0x41.

Solution

Extract the encrypted bytes from the binary and write a simple decryption script.

python
#!/usr/bin/env python3

encrypted_flag = [
    0x05, 0x14, 0x02, 0x0a, 0x04, 0x13, 0x1b, 0x3a, 
    0x12, 0x71, 0x0c, 0x72, 0x1e, 0x12, 0x70, 0x33, 
    0x20, 0x2f, 0x26, 0x72, 0x1e, 0x07, 0x34, 0x2f, 
    0x22, 0x70, 0x28, 0x71, 0x2f, 0x3c
]
‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

key = 0x41
flag = "".join(chr(b ^ key) for b in encrypted_flag)

print(f"Flag: {flag}")

Running the script outputs the flag. ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍