These signatures are a bore!
ncat --ssl snore-signatures.chal.uiuc.tf 1337
Here’s the Python source:
1 | #!/usr/bin/env python3 |
We’re provided a very simple signature forgery problem for what seems like a Schnorr signature scheme. First, we are provided p
, q
, and g
, which will remain constant for each query-verification process. At the start of each iteration of the for loop, we are provided y
. Then, we are allowed one query of any message m
that we have not used before, and are given the result s
and e
from the signature. We are then supposed to submit a message, signature pair of m
and s
, such that m
has not previously been seen by the oracle, such that the pair will produce the same e
.
Now, I actually saw people in the discord server mentioning that you can just add multiples of p
to m
, which does actually work, since the server considers it different. However, I think my solution was actually the intended.
Essentially, it all lies in how the signature is verified.
1 | def snore_verify(p, q, g, y, m, s, e): |
Remember, we know p
, q
, g
, and y
, and we control m
and s
. Well, what if just increment s
by 1. Then rv
will change, but, importantly, since we know all the variables of the expression, we can pretty simply calculate the new value of rv
. Then, we can subtract the difference between the new and old value of rv
from m
(under modulo p
), since only rv + m
actually matters in the calculation of ev
. Thus, our final ev
will still equal e
!
Here’s my implementation:
1 | from pwn import * |
uiuctf{add1ti0n_i5_n0t_c0nc4t3n4ti0n}