The final-chunk counter lives in message bits: length extension and a differentiator
Minor break · Demonstrated · Cause: construction
Property: length-extension resistance and indifferentiability (claimed); collision and preimage resistance unaffected
Cost against claim: 2 to 4 chosen queries, probability 1, against claimed length-extension resistance
The final compression call XORs a per-branch counter into the last key bits, which are message bits. A digest of the same message with those bits flipped therefore reveals one branch of the final chaining value. From a few chosen digests of S‖M, an attacker recovers the full chaining value after a secret prefix S and computes H(S‖M‖Y) for any Y without knowing S.
| Parameter set | Claim | Attack cost | Verdict |
|---|---|---|---|
| uHash-512, -768, -1024 | length-extension resistance; indistinguishability 2256 / 2384 / 2512 | 2 / 3 / 4 chosen queries, probability 1 | Minor break |
What causes it
- The key of the compression function ends with the message chunk.
- The final call XORs the counter into that key.
- The padding is 10* with no length field.
The specification claims resistance to length extension, but its argument covers extension from a single digest only; it also claims indistinguishability from a random function at 256/384/512 bits, proved as indifferentiability, which a (2b+1)-query differentiator contradicts.
Evidence
- 200/200 forgeries per size on a model rebuilt from the specification, with the specification's counter offset and with the one the code uses; 100/100 per size with the reference code as the oracle.
- 200/200 forgeries on the unmodified reference code (uHash-512).
Cause in the specification: the attack also works on a model built from the specification alone.
Limits
A chosen-message attack against the secret-prefix construction, which the call names among the uses to evaluate. It needs a bit-granular interface, since at most one of the queries can be byte-aligned; the NGCC interface is bit-granular. Collision, preimage and second-preimage resistance are not affected.
Credit
Found by PQC-X.