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:

  1. The challenge c does not depend on the commitment R.
  2. example.com returns stable HTML for arbitrary paths, so c is predictable before committing.

That breaks soundness. We can choose a commitment that cancels the public key term.

Exploitation#

The verifier checks:

zG == R + cP

Because c is known ahead of time, choose:

R = -cP
z = 0

Then:

zG = 0G = O
R + cP = -cP + cP = O

The 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 z

Flag#

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/
Author
ACHUX21
Published at
2026-06-27
License
CC BY-NC-SA 4.0
Profile Image of the Author
ACHUX21
CTF player & security researcher
Notice
CTF writeups and security research. New posts coming soon.
Music
Cover

Music

No playing

0:00 0:00
No lyrics available
Categories
Tags
Site Statistics
Posts
28
Categories
3
Tags
81
Total Words
26,137
Running Days
0 days
Last Activity
0 days ago

Table of Contents