MISSION WRITEUP ID: cylab-shared-secretPublished: 2026-08-15 by AUKA
Shared Secrets: Diffie-Hellman Key Exchange Leak
Reconstructing a Diffie-Hellman shared key when one of the private exponents was leaked in the message exchange.
Target Mission Dossier
CryptoEasy
Target Host / IP
Offline Challenge Files
Operating System
N/A
Architecture
N/A
Primary Vulnerability
Diffie-Hellman Private Exponent Leak
Exposed Services:Python Script Analysis
Attack Kill Chain Progress1 / 3 Steps
01
Phase 1: Inspecting the Leaked Exchange
In the challenge files `encryption.py` and `message.txt`, we find the Diffie-Hellman parameters: - Generator `g = 2` - Large prime modulus `p` (1048-bit) - Alice's public value `A = pow(g, a, p)` - Bob's private secret exponent `b` (inadvertently leaked in `message.txt`!) - Ciphertext `enc`
studio@pwnbox:~/cylab-shared-secret$
02
Phase 2: Computing the Shared Key
Since we have Alice's public key `A`, Bob's private exponent `b`, and modulus `p`, the Diffie-Hellman shared secret is directly computable without breaking discrete logarithm: - `shared = pow(A, b, p)` - Key byte for XOR encryption is `shared % 256`
studio@pwnbox:~/cylab-shared-secret$
03
Phase 3: Flag Verification
Running the script reveals the recovered flag:
studio@pwnbox:~/cylab-shared-secret$
Final Target Proof of Compromise
Target Root Capture Flag
STUDIO{pwn3d_fl4g_h1dd3n_h3x_00000}