signer.log
sealed.hex
pubkeys.json
device.cfg

Linked Nonces Crypto • 500 points (Static) • Medium

A signing appliance in the water department was configured by someone who liked schedules a little too much. Its log, its keys and part of its config were exported before it was wiped. Challenge Artifacts: device.cfg pubkeys.json sealed.hex signer.log Submit Flag*

Dr.Binary
read_file
read_file
read_file

Let me look at the challenge files. I have the log (with two signatures sharing the same r — a classic repeated-nonce leak), the config (secp256k1, schedule-v2 nonce mode, and a seal KDF), and the pubkeys. Now let me check the sealed blob.

read_file

The seal is a single 32-byte block XORed with sha256(kdf || ctr=0) where kdf = sha256(priv_be32). So I need a private key. The log has two signatures from ACG-SIGNER-02 sharing the same r (seq 4105 and 4099) — a repeated nonce. Classic attack, but I need to figure out what's hashed.

todo_write
write_file
run_sandbox

No match — the hash preimage must differ from the msg field. Notably line 4 has seq: 4099 but msg: "pump 3 recalibrate #4105" — a mismatch, which hints the signed message is built from seq (e.g. "pump 3 recalibrate #4099"). Let me brute-force more templates, including seq-substituted messages and structured line formats.

write_file
run_sandbox

Still no match. Two things to check: (1) is pubkeys.json even on the curve (sanity), (2) maybe the hash interpretation differs (little-endian int), or the template space is bigger. Also, the mult constant may have a small multiplicative order mod n — that would explain "linked nonces" as a cycling schedule. Let me check all of this at once.

write_file
run_sandbox

Bug in my infinity check (I used the y-coordinate instead of Z). Fixing:

edit_file
edit_file
run_sandbox

Pubkeys are on-curve, EC code works, and ord(mult) is not small — so the nonce reuse isn't a cycling LCG; it's likely a per-job-type RNG state reuse (both events are "pump 3 recalibrate"). The signed message must differ between the two events, so it must incorporate seq/ts. Let me run a much broader template sweep (structured fields, separators, both hash endiannesses, both ±k nonce relations), checking recovered keys against both pubkeys.

write_file
run_sandbox

No match across ~6.5k templates. Time to look at the raw file bytes — there may be invisible characters, mixed line endings, or formatting quirks that the parsed JSON hides.

run_sandbox

No hidden bytes — the two msg fields are byte-identical, and lines end with plain \n. So the repeated-nonce pair can't be attacked directly without knowing the hashed preimage...

New plan: use the schedule itself. If nonces follow an LCG k_{i+1} = mult*k_i + step (mod n), then for a whole unit k_i = mult^i·seed + c_i·step (with c_i = (mult^i−1)/(mult−1)) — making each signature equation s_i·k_i − d·r_i = h_i linear in (seed, step, d). With all of a unit's signatures I can solve that system and verify d·G == pub — no nonce-reuse needed. Let me try several orderings (by ts, seq, log position), LCG forms, and hash templates.

write_file
run_sandbox

The bytes reveal something interesting: s1 and s2 are identical except the last byte (eb vs 14, difference exactly 0xd7=215 — and 0xeb ^ 0xff = 0x14, i.e. the low byte is complemented). That smells engineered: the author may have chosen k = (h1−h2)·inv(215). Also, the timestamps are formulaic (minutes advance by 7 per log line) — the log order is the appliance's schedule order, so position/counter fields may be part of the hashed preimage. Let me run a much wider pair attack (including integer-hash hypotheses, log-position fields, swapped messages) plus direct seal-decryption probes for candidate keys.

write_file
run_sandbox
edit_file
run_sandbox

Still nothing. Let me reconsider the model: the timestamps are formulaic per log position (minute = 7·k mod 60, hour = k mod 10, day = 11 + k mod 9) — so the log order is the appliance's emission/schedule order. A single appliance likely runs one global nonce LCG across both units, advancing per emitted line, with each unit having its own private key. That gives a linear system in (seed, step, d02, d07) over all 13 signatures — with h = sha256(msg) (the natural preimage, consistent even for the identical-msg pair). Let me solve that, trying several index mappings and row subsets.

write_file
run_sandbox
edit_file
run_sandbox

Let me stop guessing and run the fundamental diagnostic I should have started with: do the signatures verify against the pubkeys at all, for various preimage templates? A wrong preimage fails verification; the right one validates all 13 signatures.

write_file
run_sandbox
edit_file
run_sandbox

Verification fails for all templates — but first I must make sure my verifier itself is correct. Self-test:

run_sandbox

Found it — jac_add returns Jacobian coordinates but I compare the raw X. Normalizing:

edit_file
run_sandbox

Self-test still fails — deeper bug in my point arithmetic. Diagnosing:

run_sandbox

mul(2) gives the wrong point (first bytes matched, which fooled my earlier 18-char check). Let me pinpoint the bug by comparing against straightforward affine doubling:

run_sandbox

Found it — my Jacobian addition had two wrong terms (I = H² instead of (2H)², V = U1·J instead of U1·I). Doubling was fine, so mul(2) looked right, but every scalar with ≥2 add-steps produced garbage — meaning all my pubkey-match checks so far were unreliable. Fixing and self-testing properly:

write_file
run_sandbox

Breakthrough! With correct EC math: h = sha256(msg_field) verifies for 12 of 13 signatures (all 5 of SIGNER-07 + 7 of 8 of SIGNER-02). The single invalid one is the seq-4099 line — the doctored/tampered entry (its s was copied from the valid one with a flipped byte). Now I know the hash preimage for sure, so I can redo the schedule-based key recovery with a working pubkey oracle.

todo_write
write_file
run_sandbox
edit_file
run_sandbox

Entry 3 is confirmed as the tampered line. The LCG models still fail though — but my solver code itself needs validation before I trust it (I've been burned once). Let me self-test the linear solver on synthetic data with a known key, then sweep more model/form/ordering combinations.

write_file
run_sandbox
edit_file
run_sandbox

The solver is verified correct, so the LCG-chain model itself must be wrong. Rethinking "schedule-v2": the story says the entropy is the schedule — maybe the nonce is a simple function of each event's schedule time/slot: k = α·X + β (α = mult or 1, X = timestamp/seq/slot), or exponential mult^X + β. All of those are linear in (β, d) — cheap to test per unit:

write_file
run_sandbox
edit_file
run_sandbox

Nope. Let me flip the perspective: "schedule-v2" might derive the nonce from the private key itself — a deterministic backdoor like k = mult·d + step·c_i + c₂ (nonce tied to key and a counter). That's still linear in (d, c, c₂). Sweeping that whole family:

write_file
run_sandbox

Wait — a key realization: entry 0 verifies, so h1 = sha256(msg0) is certain. And the s-difference is exactly 215. If entry 3 is a valid signature (same nonce k, engineered so s1−s2 = 215), then for any candidate true-message X: k = (h1 − sha256(X))·inv(215), and I can check it against the logged r directly — x(k·G) mod n == r0 — no private key needed. The r value is an oracle for finding X!

write_file
run_sandbox

No hit. Let me test the "linked" idea more literally: the nonce of each signature derived from the previous signature's public values (k_i = mult·r_prev + β, or from s_prev/h_prev) — per-unit or global chains, all linear 2×2/3×3 solves. Plus multiplicative schedules k_i = mult^i·seed I haven't tried:

write_file
run_sandbox

Variable shadowing bug: at module level I assigned p = oes[i-1] (an entry dict), clobbering the curve prime p used by the exec'd EC code. Renaming:

edit_file
run_sandbox

Still nothing — but I've been assuming the nonce chain starts at the first log line. The log is an export "before it was wiped" — the appliance almost certainly signed events before this window (unit 02's seq starts at 4099!). An LCG with history means k_g = u^g·seed + c^g·step with an unknown offset, which reparametrizes to k_g = u^g·X + c^g·Y + Z — one extra unknown Z, still perfectly linear. That would break all my earlier 3-unknown solves. Testing this now:

write_file
run_sandbox
edit_file
run_sandbox

Let me run a broad battery: (1) zero-unknown nonce candidates checked directly against each r via the EC oracle (k = mult^slot, mult·slot, hash-based sha256(mult‖…), Fibonacci-style), and (2) time-tick LCGs where the RNG advances on a schedule timer (exponents from timestamps), plus a Fibonacci recurrence (k_g = F_g·k_1 + F_{g-1}·k_0 — linear!).

write_file
run_sandbox

Fibonacci by iteration over unix timestamps (~180M iterations) blew the timeout. Switching to fast-doubling Fibonacci:

edit_file
run_sandbox

All linear models exhausted. Time to reconsider mult: its low 64 bits are 0x9e3779b97f4a7c15 — Knuth's golden-ratio constant used in 64-bit LCGs (splitmix64). The upper words look like random padding. If "schedule-v2" keeps a 64-bit state and uses it directly as the nonce, the nonces are tiny (< 2^64) — a textbook Hidden Number Problem, solvable by LLL lattice reduction from 5–7 signatures. Let me check for lattice libraries, else implement LLL:

run_sandbox

No lattice library — I'll implement LLL in pure Python (dimension ≤ 9, fast) and run the Hidden Number Problem attack: with k_i ≡ t_i·d + u_i (mod n) where `

You stopped this response.