1337 Local CTF: intro to zk — Broken Fiat-Shamir Binding
175 words
1 minute
1337 Local CTF: intro to zk — Broken Fiat-Shamir Binding
intro to zk
Challenge Context
The service implements a Sigma-style proof of knowledge on secp256k1. The prover is supposed to prove knowledge of witness w where P = wG.
Reconnaissance
The fatal function was the challenge generator:
def generate_challenge(self, R): response = requests.get("https://example.com/" + os.urandom(35).hex()) data = response.text.encode() return bytes_to_long(hashlib.sha256(data).digest())Vulnerability / Core Idea
There are two bugs:
- The challenge
cdoes not depend on the commitmentR. example.comreturns stable HTML for arbitrary paths, socis predictable before committing.
That breaks soundness. We can choose a commitment that cancels the public key term.
Exploitation
The verifier checks:
zG == R + cPBecause c is known ahead of time, choose:
R = -cPz = 0Then:
zG = 0G = OR + cP = -cP + cP = OThe proof verifies without knowing w.
# After receiving public key P from the server:c = sha256(example_com_html).digest_as_int()R = negate(point_mul(c, P))z = 0# send R, then zFlag
leet{v3rY_9o0d_Bu7_juSt_so_u_kN0w_mod3rn_ZK_is_s0ME7hin9_3l53}Lesson Learned
Fiat-Shamir style challenges must be bound to the commitment and transcript. If the prover can know c before choosing R, they can program the equation instead of proving knowledge.
Cover: Wallhaven gwp2w3.
Share Article
If this article helped you, please share it with others!
1337 Local CTF: intro to zk — Broken Fiat-Shamir Binding
https://achux21.github.io/posts/1337-local-ctf-intro-to-zk/ 1337 Local CTF: holy bytes hh — Timing Side Channel
1337 Local CTF: July pool 2024 — Dangling Git Commits
Related Posts Smart
1
1337 Local CTF: numbA thiri — CRT Reconstruction
CTF Recovering the flag integer from residues modulo small primes and a quotient.
2
1337 Local CTF: Baby-AES — Known Plaintext → Tiny Keyspace
CTF Recovering a 9-byte AES key by using the known flag format and a known plaintext/ciphertext pair.
3
1337 Local CTF: holy bytes hh — Timing Side Channel
CTF Extracting a flag bit-by-bit from a deliberate timing leak in a Python loop.
4
1337 Local CTF: baby overflow — Integer Overflow
CTF Using an 8-bit integer wraparound to satisfy a numeric check.
5
1337 Local CTF: July pool 2024 — Dangling Git Commits
CTF Recovering a split flag from unreachable Git objects inside a piscine project archive.
Random Posts Random