Skip to main content
Challenges Onion network: 3-layer encryption
Xonalar Impossible Network forensics, memory analysis and multi-layer cryptanalysis Solves: 5

Onion network: 3-layer encryption

Author: CyberSamSU
Points
350

The cybercrime unit captured the traffic sent from a suspicious internal client to the v3vault77x.onion.invalid hidden service through a 3-stage (3-hop) onion routing chain, and a memory image of the first node (Guard) process: darknet_case.zip.

The archive contains README.txt, relay1.mem (a 128 KB memory image) and circuit.pcap (the ONC3 cell protocol on TCP/9001 and decoy traffic).

Protocol structure (Onion Cell Protocol v3)

  • Outer cell (ONC3): magic(4B)="ONC3" | circuit_id(4B u32 BE) | cmd(1B) | payload_len(2B u16 BE) | payload. cmd=0x01 (CREATE), 0x03 (RELAY_DATA), 0x04 (PADDING).
  • Layer 1 (Guard / Hop 1): the RELAY_DATA payload = nonce1(8B) || AES-128-CTR(K1, nonce1 || 0x00^8, L1_plain). The K1 key is stored in relay1.mem as a 176-byte expanded AES-128 key schedule.
  • Layer 2 (Middle / Hop 2): The decrypted L1_plain begins with "ON2\x01" + subcmd(1B): 0x10 (DH_INIT: len_p(2B BE)|p | len_g(2B BE)|g | len_A(2B BE)|A), 0x11 (DH_RESP: len_B(2B BE)|B), 0x20 (RELAY_L2: nonce2(8B) || AES-128-CTR(K2, nonce2 || 0x00^8, L2_plain)). Key: K2 = SHA256(S_16B_BE || "hop2-ctr")[:16], where S = B^a mod p.
  • Layer 3 (Hidden Service / Hop 3): The decrypted L2_plain begins with "ON3\x01" + subcmd(1B): 0x2F (route state), 0x30 (RELAY_L3: nonce3(8B) || AES-128-CTR(K3, nonce3 || 0x00^8, L3_plain)). The known plaintext of the handshake cell: ONION-HS/3.0 PROBE host=v3vault77x.onion.invalid proto=v3 ack=SYN-OK banner="SamSU Onion Rendezvous v3.0 - integrity check active before vault transfer.".

Chain of tasks

  1. Task 1 (Memory forensics): In relay1.mem, find the 176-byte key schedule that satisfies the AES-128 key expansion rule. Be careful: the 1-hop test-echo chain gives a fake flag; only the key that decrypts the ON2\x01 layer and its chain are genuine.
  2. Task 2 (Pohlig-Hellman DH): for the 128-bit p in DH_INIT and DH_RESP, p - 1 is a smooth number. Find the secret exponent with the Pohlig-Hellman + BSGS algorithm, compute K2 and decrypt layer 2.
  3. Task 3 (CTR nonce reuse): among the RELAY_L3 cells, find the repeated nonce3 pair, recover the keystream through the known PROBE text and decrypt the SECRET message.
  4. Task 4 (Flag): get the BAYROQ{PIYOZ_TARMOQ_<16hex>} flag sent by v3vault77x.onion.invalid (the last 16 characters are lowercase hex).
Attached files
darknet_case.zip Log in to download
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −35 pts Log in
Hint 2 −70 pts Log in
Hint 3 −105 pts Log in
To submit a flag, log in.

First solvers

1. Mirjaxon Qaxxarov 24.11.2026
2. Odam 25.11.2026
3. Asmaa Mottery 25.11.2026
4. AGENT X 25.11.2026
5. 𝖛𝖊𝖑𝖐𝖆𝖓 28.11.2026