L3mOn Corp caught an intrusion and dumped the traffic. Somewhere in it is a four-part clearance flag, but the operators scattered decoys everywhere, and the last fragment was never written to disk at all.
The rules are spelled out: only FRAG#=... values are real, every complete L3m0n{...} lying
around is a decoy (there are five), and the live instance is a checkpoint that hands over
the flag once you show it the three fragments from the capture. The flag is the four 8-hex
fragments glued together.
Hint 1
The pcap has two channels: a DNS burst and one HTTP download. Each stage gives you one fragment and the key to the next stage.
Hint 2
Base32, steghide, an appended ZIP, then a tiny ELF. Four stages, four different tools.
Recon
25 packets, about 7.6 ms of traffic:
$tshark -r capture.pcap -T fields -e frame.number -e ip.dst -e tcp.dstport -e _ws.col.Info
Five A queries to *.l3m0n-corp.net with Base32-looking labels, and one
GET /assets/badge.jpg. strings | grep L3m0n finds plenty of flags, and every one of them is
a decoy. The challenge is built to punish that shortcut.
1/4DNS exfil: FRAG1 and the stego key
The four *.x.l3m0n-corp.net labels are Base32. Pad and decode them in order:
1import base64
2for lbl in ["IZJECRZRHUZTENZZ", "GA2TGZB3KNKEKR2L", "IVMT23BTNUYG4X3Q", "GBWGYMLOGR2DA4Q"]:
3 print(base64.b32decode(lbl + "=" * (-len(lbl) % 8)).decode(), end="")
4# FRAG1=3279053d;STEGKEY=l3m0n_p0ll1n4t0r
FRAG1 = 3279053d, plus the passphrase for the next stage. The fifth query
(...telemetry.l3m0n-corp.net) decodes to decoy #1.
2/4JPEG stego: FRAG2
Export the HTTP object. The EXIF UserComment and an X-Debug-Flag response header each carry a
flag (decoys #2 and #3). The real payload is steghide'd with the key from stage 1:
$tshark -r capture.pcap --export-objects http,objs $steghide extract -sf objs/badge.jpg -p l3m0n_p0ll1n4t0r -xf note.txt $cat note.txt FRAG2=355c17fc NEXT: carve the file (it's an appended archive) to pull the "agent" binary out of it. Feed FRAG2 to the agent as its unlock token to get FRAG3.
FRAG2 = 355c17fc
3/4Carve and reverse the agent: FRAG3
binwalk shows a ZIP after the JPEG's FFD9 end-of-image marker. Carve it and unzip:
1data = open("objs/badge.jpg", "rb").read()
2open("trailer.zip", "wb").write(data[data.rfind(b"\xff\xd9") + 2:])
Out comes agent (ELF x86-64). It wants ./agent <token>, but there's no need to run an
untrusted binary from an intrusion capture. objdump shows the output is decrypted
independently of the token, so FRAG3 can be read straight out of .rodata.
4/4The live checkpoint: FRAG4
The instance documents POST /assemble with part1..part3. Its HTML comment carries decoy #5.
$curl -s https://<instance>.l3m0nctf.xyz/assemble \ -d part1=3279053d -d part2=355c17fc -d part3=a70d53d0 {"flag":"L3m0n{3279053d355c17fca70d53d0126cbaa2}","frag4":"126cbaa2", "message":"clearance granted - all four fragments assembled","ok":true}
1enc = bytes([0x3d,0x6b,0x6c,0x38,0x69,0x6f,0x38,0x6c])
2print(bytes(b ^ 0x5c for b in enc).decode())
3exp = bytes([0x19,0x1e,0x19,0x4e,0x1f,0x18,0x56,0x52])
4assert all(ord("355c17fc"[i]) ^ (i + 0x2a) == exp[i] for i in range(8))
- 1
frag3_encat0x402010in.rodata. - 2
mainXORs every byte with0x5c, so this printsa70d53d0, the real FRAG3. - 3
expectedat0x402008, whatcheck_tokencompares against. - 4
token[i] ^ (i + 0x2a) == expected[i]holds for FRAG2, so the chain is consistent.
Insight
The binary also contains L3m0n{str1ngs_gr3p_w0nt_s4v3_y0u}, decoy #4, and the name says it
all. Every stage had a themed decoy waiting for whoever took the lazy path.
Pitfall
The checkpoint has a strict per-IP rate limit (503 Service Busy). Send one request at a time
or you'll spend more time waiting than solving.
The five decoys
| # | Where | Value |
|---|---|---|
| 1 | DNS telemetry query |
L3m0n{dns_b34c0n_d3c0y} |
| 2 | badge.jpg EXIF UserComment | L3m0n{3x1f_1s_th3_f1rst_pl4c3_th3y_l00k} |
| 3 | HTTP X-Debug-Flag header |
L3m0n{h34d3r_h0n3yp0t_ch4ff} |
| 4 | agent .rodata string |
L3m0n{str1ngs_gr3p_w0nt_s4v3_y0u} |
| 5 | checkpoint HTML comment | L3m0n{cl13nt_s1d3_c0mm3nt_d3c0y} |
| Fragment | Source | Value |
|---|---|---|
| FRAG1 | DNS labels, Base32 | 3279053d |
| FRAG2 | steghide note in badge.jpg | 355c17fc |
| FRAG3 | carved agent, XOR 0x5c |
a70d53d0 |
| FRAG4 | live /assemble |
126cbaa2 |
Flag
L3m0n{3279053d355c17fca70d53d0126cbaa2}