Skip to main content
Challenges Static key and forward secrecy
Cryptography Medium DH attacks Solves: 6

Static key and forward secrecy

Author: CyberSamSU
Points
55

Diffie-Hellman is used in two different modes. In ephemeral (DHE) mode, a new secret number is chosen for each session and it is deleted after the session ends. In static mode, the server keeps a single b for years.

What is the difference? In static mode, there is no forward secrecy (perfect forward secrecy). An attacker who compromises the server today and steals b can also decrypt and read all traffic recorded several years ago — because that same single secret number was used in all sessions.

This is exactly what happened: the server's static secret number was leaked, and four old sessions are lying in the archive (arxiv.txt). Each message contains a part of the flag.

Each session was encrypted like this:

import hashlib
def kdf(s: int) -> bytes:
    return hashlib.sha256(str(s).encode()).digest()   # 32 bayt

s = pow(A_i, b, p)     # server tomonda
kalit = kdf(s)
ochiq = bytes(c ^ kalit[i % 32] for i, c in enumerate(shifr))

Concatenate the four parts in order (from 1 to 4): BAYROQ{DH_statik_kalit_<b1><b2><b3><b4>}

Attached files
arxiv.txt Log in to download
SHA-256 checksums
arxiv.txt: df81433bfa0e3661feae9598d59ec82353be10d30723635759231a53ee25c963
Theory: learn the topic
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −5 pts Log in
Hint 2 −11 pts Log in
Hint 3 −16 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 17.09.2026
2. Лазиз 04.10.2026
3. testrejim 09.10.2026
4. Mirjaxon Qaxxarov 27.10.2026
5. Odam 05.11.2026
6. arcanum 11.11.2026