- Category: Crypto
- Score: 321/500
- Solves: 12
I will use zero-knowledge proof to prove the knowledge for the factorization of n=p*q, so you wouldn’t be able to learn anything from it.
It implements a zero knowledge proof protocol from Short Proofs of Knowledge for Factoring. The server generates an
The intended vulnerability of this challenge is quite subtle:
def zkpof(z, n, phi):
# I act as the prover
r = getRandomRange(0, A)
x = pow(z, r, n)
e = int(input("e = "))
if e >= B:
raise ValueError("e too large")
y = r + (n - phi) * e
transcript = {"x": x, "e": e, "y": y}
return json.dumps(transcript)
It is apparently that the server is missing the check that zkpof_verify
checks that
Error: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit
This is because CPython fixed a possible DoS of int <-> str
conversion in CVE-2020-10735: Prevent DoS by large int<->str conversions, which restrict the default maximum decimal digits allowed for conversion is 4300 digits. So trying to convert a number n
that abs(n)>=10**4300
will result in an exception.
So we can binary search that and recover the top
This means we can apply coppersmith to factor zkpof_reverse
to get the flag.