Writeup · Cyberweek Prequalifiers 2026

The Chimera Engine

reversingeasy-mediumsolvedFlag: CTF{REDACTED}

1. Challenge Overview

The challenge provides a Linux ELF binary named:

chimera_engine

Running the binary without arguments displays a usage message:

=========================================
   CHIMERA SECURITY ARCHITECTURE v4.2
=========================================
Usage: ./chimera_engine <license_key>

The goal is to determine the correct license key.

The binary indicates that a successful validation produces:

[+] SUCCESS: License validated! Access Granted.
[+] Flag: %s

Therefore, the primary objective is to reverse the license validation routine.


2. Initial Reconnaissance

First, inspect the file type:

file chimera_engine

Output:

chimera_engine: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=2ef2b8cce1680430b0498dafb82974360e9b4230,
for GNU/Linux 3.2.0, stripped

Important observations:

  • 64-bit ELF

  • x86-64 architecture

  • Position-independent executable (PIE)

  • Dynamically linked

  • Stripped

  • No debugging symbols

The binary therefore requires static analysis rather than simply reading function names.


3. Security Properties

Run checksec:

checksec --file=./chimera_engine

Result:

RELRO           STACK CANARY      NX            PIE             RPATH      RUNPATH
Full RELRO      No canary found   NX enabled    PIE enabled     No RPATH   No RUNPATH

Symbols         FORTIFY           Fortified      Fortifiable
No Symbols      Yes               1              1

The important properties are:

Property Result
Architecture x86-64
PIE Enabled
NX Enabled
Stack Canary Disabled
RELRO Full
Symbols Stripped
FORTIFY Enabled

For this challenge, exploitation is unnecessary. The objective is to reverse the license algorithm.


4. String Analysis

A quick strings scan is useful:

strings chimera_engine

Interesting strings include:

=========================================
   CHIMERA SECURITY ARCHITECTURE v4.2
[+] SUCCESS: License validated! Access Granted.
[-] ACCESS DENIED: Invalid license key.
Usage: %s <license_key>
[+] Flag: %s

There are no obvious plaintext license keys.

However, the presence of:

[+] Flag: %s

suggests that once validation succeeds, some string is supplied directly to printf.

There are also suspicious non-printable/encoded-looking bytes later in .rodata.


5. ELF Section Analysis

Inspect the sections:

readelf -SW chimera_engine

Relevant sections:

.text       00000000000010a0 0010a0 0001e7
.rodata     0000000000002000 002000 000127
.data       0000000000004000 003000 000010
.bss        0000000000004010 003010 000008

The .text section is very small:

0x1e7 = 487 bytes

This is a strong indication that the binary is intentionally simple.


6. Dynamic Imports

Inspect the dynamic symbols:

readelf -Ws chimera_engine | grep -E 'FUNC|OBJECT|__libc_start_main|strlen|puts|printf'

Interesting imported functions:

__libc_start_main
puts
strlen
__printf_chk
__cxa_finalize

Notably absent are:

strcmp
strncmp
memcmp

This is significant.

Instead of using a standard string comparison, the binary likely performs a custom byte-by-byte comparison.

The presence of:

strlen

also suggests that the input length may be explicitly checked.


7. Disassembling .text

Disassemble the executable code:

objdump -d -M intel --section=.text chimera_engine

The beginning of the executable is:

00000000000010a0 <.text>:
    10a0: f3 0f 1e fa           endbr64
    10a4: 41 54                 push   r12
    10a6: 4c 8d 25 5b 0f 00 00  lea    r12,[rip+0xf5b]
    10ad: 55                    push   rbp
    10ae: 89 fd                 mov    ebp,edi
    10b0: 4c 89 e7              mov    rdi,r12
    10b3: e8 b4 ff ff ff        call   1070 <puts@plt>

The first major function is effectively main.

At:

10d0: 83 fd 01
10d3: 7e 4a

the program checks the argument count.

If no license key is supplied, execution reaches the usage message.

If an argument exists:

10d5: 48 8b 7b 08
10d9: e8 52 01 00 00

argv[1] is passed to the function at:

0x1230

This is the license validation routine.


8. Identifying the Validation Function

The important function begins at:

0000000000001230

Its first instructions are:

1230: f3 0f 1e fa           endbr64
1234: 53                    push   rbx
1235: 48 89 fb              mov    rbx,rdi
1238: e8 43 fe ff ff        call   1080 <strlen@plt>

The input pointer is stored in:

RBX

Then strlen() is called.

The resulting length is stored in:

RAX

and copied into:

123d: 48 89 c2              mov    rdx,rax

9. Required License Length

The next instructions are:

1240: 31 c0                 xor    eax,eax
1242: 48 83 fa 27           cmp    rdx,0x27
1246: 75 2e                 jne    1276

The binary compares the input length against:

0x27

Convert this to decimal:

0x27 = 39

Therefore:

The valid license key must contain exactly 39 characters.

Any input of a different length immediately fails.


10. Locating the Encoded Reference Data

After the length check:

1248: 31 d2                 xor    edx,edx
124a: 48 8d 0d af 0e 00 00  lea    rcx,[rip+0xeaf]

The lea instruction calculates the address:

0x2100

So:

RCX = 0x2100

This is the address of the expected encoded license bytes.

We can inspect .rodata:

objdump -s -j .rodata chimera_engine

The relevant portion is:

2100 df87f720 78d03f6a 68e06a08 623f60a8
2110 90f8f8c8 623f0862 f8628a88 603fc8c8
2120 d03f622a 325a50

Therefore the encoded byte sequence is:

df 87 f7 20 78 d0 3f 6a
68 e0 6a 08 62 3f 60 a8
90 f8 f8 c8 62 3f 08 62
f8 62 8a 88 60 3f c8 c8
d0 3f 62 2a 32 5a 50

There are exactly:

39 bytes

which matches the required input length.


11. Understanding the Byte Transformation

The main loop starts here:

1262: 0f b6 04 13           movzx  eax,BYTE PTR [rbx+rdx*1]
1266: 83 f0 5a              xor    eax,0x5a
1269: c0 c0 03              rol    al,0x3
126c: 83 c0 17              add    eax,0x17
126f: 38 04 11              cmp    BYTE PTR [rcx+rdx*1],al
1272: 74 e4                 je     1258
1274: 31 c0                 xor    eax,eax
1276: 5b                    pop    rbx
1277: c3                    ret

Let’s translate this into pseudocode.

For every byte of the input:

x = input[i];

x ^= 0x5A;

x = rol8(x, 3);

x += 0x17;

if (encoded[i] != x)
    return 0;

In mathematical notation:

encoded[i] = (ROL8(input[i] XOR 0x5A, 3) + 0x17) mod 256

The binary performs this operation independently on every byte.

There is no hashing, encryption, or state carried between bytes.

This makes the transformation completely reversible.


12. Reversing the Transformation

The forward transformation is:

encoded = ROL8(input XOR 0x5A, 3) + 0x17

We need to recover input.

The operations must be undone in reverse order.

Step 1 — Subtract 0x17

ROL8(input XOR 0x5A, 3)
    =
encoded - 0x17

Because we’re working with bytes:

(encoded - 0x17) & 0xff

Step 2 — Reverse the rotate

The original operation was:

ROL8(x, 3)

The inverse is:

ROR8(x, 3)

Therefore:

input XOR 0x5A
    =
ROR8(encoded - 0x17, 3)

Step 3 — Undo the XOR

The XOR operation is its own inverse:

x XOR 0x5A XOR 0x5A = x

Therefore:

input =
ROR8(encoded - 0x17, 3) XOR 0x5A

Final inverse:

input[i] = ROR8((encoded[i] - 0x17) & 0xff, 3) ^ 0x5A

13. Python Solver

The entire license can be recovered with a very small Python script:

#!/usr/bin/env python3

encoded = bytes.fromhex(
    """
    df 87 f7 20 78 d0 3f 6a
    68 e0 6a 08 62 3f 60 a8
    90 f8 f8 c8 62 3f 08 62
    f8 62 8a 88 60 3f c8 c8
    d0 3f 62 2a 32 5a 50
    """
)

def ror8(value, bits):
    return ((value >> bits) | (value << (8 - bits))) & 0xff

key = bytes(
    ror8((byte - 0x17) & 0xff, 3) ^ 0x5A
    for byte in encoded
)

print(key.decode())

Running it gives:

CTF{REDACTED}

14. Alternative Direct Solver

The same calculation can be performed directly from the .rodata bytes:

encoded = bytes.fromhex(
    "df87f72078d03f6a68e06a08623f60a8"
    "90f8f8c8623f0862f8628a88603fc8c8"
    "d03f622a325a50"
)

def ror8(x, n):
    return ((x >> n) | (x << (8 - n))) & 0xff

key = ''.join(
    chr(ror8((x - 0x17) & 0xff, 3) ^ 0x5a)
    for x in encoded
)

print(key)

Output:

CTF{REDACTED}

15. Understanding the Main Control Flow

The overall program can be represented as:

                 ┌────────────────────┐
                 │       main()       │
                 └─────────┬──────────┘
                           │
                           ▼
                  argc > 1 ?
                    /           \
                  NO             YES
                  │               │
                  ▼               ▼
             Print usage    argv[1]
                                  │
                                  ▼
                         validate_license()
                                  │
                                  ▼
                             strlen()
                                  │
                                  ▼
                         length == 39 ?
                          /           \
                        NO             YES
                        │               │
                        ▼               ▼
                      FAIL         Process bytes
                                        │
                                        ▼
                         ┌────────────────────────┐
                         │ input[i] XOR 0x5A      │
                         │         ↓              │
                         │ ROL8(..., 3)           │
                         │         ↓              │
                         │ + 0x17                 │
                         └───────────┬────────────┘
                                     │
                                     ▼
                         Compare with byte[0x2100+i]
                              /              \
                            NO                YES
                            │                  │
                            ▼                  ▼
                           FAIL        Continue loop
                                               │
                                               ▼
                                      All 39 bytes match
                                               │
                                               ▼
                                            SUCCESS
                                               │
                                               ▼
                                      Print argv[1] as flag

16. Why strings Didn’t Reveal the Flag

Initially, the strings output did not contain the final flag:

[+] Flag: %s

but there was no obvious:

CTF{REDACTED}

This is because the flag/license is not stored as plaintext.

Instead, the binary stores the transformed bytes:

df 87 f7 20 ...

The program reconstructs the expected plaintext by requiring the attacker to provide an input that produces those bytes.

The flag therefore has to be recovered by reversing the transformation.


17. Verifying the Recovered Key

After recovering the key:

CTF{REDACTED}

execute:

./chimera_engine 'CTF{REDACTED}'

The program returns:

=========================================
   CHIMERA SECURITY ARCHITECTURE v4.2
=========================================
[+] SUCCESS: License validated! Access Granted.
[+] Flag: CTF{REDACTED}

This confirms that the reverse-engineered transformation is correct.


18. GDB Note

A breakpoint was initially placed on strlen:

break strlen
run TEST

The first hit was inside the dynamic loader:

_dl_sysdep_start
_dl_start_final
_dl_start
_start

with:

"haswell"

in RDI.

This is not the challenge’s call to strlen; it is an earlier strlen() performed by the dynamic loader during program startup.

This is an important reversing lesson:

When breaking on an imported libc function, the function may be called by the dynamic linker before the program reaches main().

A more targeted approach would be to break at the validation routine:

break *0x1230
run TEST

Because the executable is PIE, runtime addresses may be relocated. For debugging, GDB can resolve the symbol-relative address after loading the binary, or one can use the relevant runtime mapping/base address.

The static disassembly was sufficient here, so dynamic debugging was ultimately unnecessary.


19. Key Reversing Insights

Several clues made the challenge straightforward.

19.1 No strcmp() or memcmp()

The binary imports:

strlen
puts
__printf_chk

but no standard comparison function.

That strongly suggests custom validation logic.


19.2 Explicit Length Check

The instruction:

cmp rdx,0x27

immediately tells us:

Required length = 39

19.3 Static Reference Data

The instruction:

lea rcx,[rip+0xeaf]

resolves to:

0x2100

and .rodata contains exactly 39 suspicious bytes there.

This is almost certainly the expected transformed license.


19.4 Byte-Independent Transformation

Each iteration operates only on:

input[i]

and:

encoded[i]

There is no dependence on the previous byte.

Therefore every byte can be solved independently.


19.5 All Operations Are Reversible

The transformation consists only of:

XOR
ROL
ADD

All three have straightforward inverses:

XOR → XOR
ROL → ROR
ADD → SUB

Thus no brute force is necessary.


20. Final Recovered License / Flag

The recovered 39-byte value is:

CTF{REDACTED}

Verification:

./chimera_engine 'CTF{REDACTED}'

Result:

[+] SUCCESS: License validated! Access Granted.
[+] Flag: CTF{REDACTED}

21. Lessons Learned

Static analysis

Even when an ELF is stripped, the following can quickly reveal its structure:

file
checksec
strings
readelf
objdump

Imported functions are useful clues

The imported functions can reveal what kind of validation is likely being performed.

Here:

strlen

suggested explicit input-length validation, while the absence of:

strcmp
memcmp

suggested custom comparison logic.

Follow data references

The instruction:

lea rcx,[rip+0xeaf]

was more useful than the surrounding generic compiler-generated functions because it pointed directly at the encoded validation data.

Reverse transformations in reverse order

For:

y = ADD(ROL(XOR(x, K1), R), K2)

reverse it as:

x = XOR(ROR(y - K2, R), K1)

Don’t overcomplicate simple reversing challenges

Although the binary has:

PIE
Full RELRO
NX
FORTIFY

none of these protections matter for the intended solution.

The challenge is fundamentally a static reverse-engineering problem, not an exploitation problem.


22. One-Line Solution

The entire challenge boils down to:

encoded[i] = (ROL8(input[i] ^ 0x5A, 3) + 0x17) & 0xFF

with the encoded bytes stored at:

0x2100

and the inverse:

input[i] = ROR8((encoded[i] - 0x17) & 0xFF, 3) ^ 0x5A

producing:

CTF{REDACTED}

Techniques