Two Souls, One Nonce a DSA nonce derived from the message, not random

crypto
flag RxR{bd13d6ce-5f88-405b-9dd7-902bb11d70d9}

A DSA signing : it prints p, q, g, y, then offers sign <hex> (sign arbitrary bytes), flag (get a random challenge token), and submit <r> <s> (forge a valid signature on that token). Up to 16 signatures in a 60-second window. The pitch is that this signer never reuses a nonce - instead it derives one per message, "the message hash plus my own secret salt."

Signing the same message twice comes back with identical r and s. So k is deterministic in the message - that's the crack in the whole premise.

Pinning down the nonce

For a message with hash H, secret key x, nonce k: r = (g^k mod p) mod q, s = k^-1 (H + x*r) mod q. Suppose k = H + d for a fixed secret d - two signatures give two linear equations in x and d. The shape of k is the only real guess ("message hash plus salt" reads additively or multiplicatively), and the hash function itself is a second guess (SHA-1 or SHA-256, both plausible for DSA).

Insight

The guess is self-checking: for any candidate formula/hash/d, the public relation r == (g^k mod p) mod q must hold for every sample collected. A wrong d gives nonsense r values, so there's no room for a false positive. Seven signatures on distinct one-byte messages plus the token, swept offline against the hypothesis space - exactly one combination survives: k = SHA-256(m) + d mod q, with d = 7621133853754416584282840212448746470870399093392190825780066878225459737727.

Pitfall

I tried the multiplicative form (k = H*d) first and briefly thought I had it - both shapes are algebraically solvable on paper. Only the r-check against real samples showed the server was using the additive one. On any "nonce derived from the message" challenge, test both shapes.

Recovering x and forging

Eliminate x between two signatures from s_i (H_i + d) = H_i + x*r_i (mod q):

output
x = (s_i*H_i - H_i + s_i*d) * r_i^-1  (mod q)

Set that equal across i=1,2, solve for d:

output
d = [ r_1*(s_2*H_2 - H_2) - r_2*(s_1*H_1 - H_1) ] / (r_2*s_1 - r_1*s_2)  (mod q)

then x falls out of any single sample: x = 23202044707944000219407236591962568055466450934483414476299563909832235210647.

The oracle doesn't need to sign the token anymore - pick any k (I used 2), compute r = (g^k mod p) mod q and s = k^-1 (H(token) + x*r) mod q, and submit.

What actually broke it

A deterministic nonce isn't automatically fatal on its own, but a deterministic nonce that's a known function of public data plus a constant is - here that constant is the only secret in k, and two signatures are enough to solve for it, after which x follows directly. Classic nonce reuse leaks x in one step; deriving it from the message leaks x in two. Same ending.

Note

The challenge page carries the event's usual planted decoy, RxR{R4lly_i_g0t_<id>_kdn4h}, dressed as a "verified flag." Not the flag - the real one only ever came back from the live submit.

Flag

output
RxR{bd13d6ce-5f88-405b-9dd7-902bb11d70d9}