SPB Git

Repository Public

QYV-FUZ-001.json 5.1 KB 24 lines json

1{2  "id": "QYV-FUZ-001",3  "title": "Identity(privateEncoding:) accepts an ML-DSA-87 private key whose t0 component is corrupted",4  "severity": "low",5  "cvss_vector": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:L/A:L",6  "cvss_score": 2.5,7  "cwe": "CWE-354",8  "masvs": "MASVS-CRYPTO-2",9  "area": "crypto",10  "location": "Sources/QyvoraIdentity/Identity.swift:369",11  "tool": "qyfuzz",12  "rule": "identity-private:accepted private identity signs invalidly",13  "status": "fixed",14  "fix_commit": "64500cd",15  "regression_test": "QyvoraMLDSATests.MLDSAPrivateKeyValidationTests (thePublicKeyIsRecomputedFromThePrivateKey, everySingleBitErrorInT0IsDetected, damageInTheOtherComponentsIsDetectedExceptInK); QyvoraIdentityTests.IdentityPrivateKeyConsistencyTests (aDamagedT0IsRefusedWhereverTheDamageIs, theRecordedFuzzerInputIsRefused); fuzz target identity-private with the invariant always enforced (security/tests/Sources/FuzzTargets/Targets+Storage.swift)",16  "description": "The strict parser of the private identity encoding checks the ML-DSA-87 private key against the public identity by signing one fixed probe message deterministically and verifying that signature. This check is probabilistic for the t0 component of the private key (FIPS 204: the low bits of t, 3 328 bytes of the 4 896-byte key): t0 is only used to compute the hint, so a private key with a few corrupted t0 coefficients still produces a valid signature for many messages, including — with a sizeable probability — the probe. The fuzzer (target identity-private, run with QY_FUZZ_STRICT_IDENTITY=1) found 12 such encodings in 40 seconds on M2U64: each is accepted by Identity(privateEncoding:), yet the signature the accepted identity makes over another message does not verify under its own public key. Root cause: the acceptance test exercises one signature instead of establishing that the private key matches the public key. Impact: no forgery and no key disclosure; an identity record that is damaged in t0 (the record lives inside the AEAD-authenticated vault, so this needs a writer of vault plaintext or a storage/logic error before sealing) is loaded as valid and then produces signatures that verify only some of the time (backup signatures, rotation certificates, transfer envelopes). The ML-KEM, SLH-DSA and X25519 halves are checked deterministically and are not affected.",17  "recommendation": "Make the check complete: in QyvoraMLDSA, add a private-key validation that recomputes t = A·s1 + s2 from rho, s1 and s2, checks that Power2Round(t) equals (t1 of the public key, t0 of the private key), that tr = H(public key) and that rho matches; call it from Identity(privateEncoding:) instead of (or before) the probe signature. Regression test: replay security/fuzzing/crashes/identity-private/0078fcc1….bin (a throw-away identity generated by the fuzzer, t0 corrupted at offset 6816) and expect IdentityError.invalidKey; then remove the QY_FUZZ_STRICT_IDENTITY switch in security/tests/Sources/FuzzTargets/Targets+Storage.swift so the invariant is always enforced.",18  "evidence": "security/fuzzing/crashes/identity-private/0078fcc14a60fae97f42b858598d932604e3a8924da8aad4eb5edcffb19ea38c.bin (12 519 bytes) — message: FUZZ-INVARIANT: accepted private identity signs invalidly; first difference at offset 6816 (ML-DSA private key, component t0). Reproduce: QY_FUZZ_STRICT_IDENTITY=1 qyfuzz repro identity-private <file>.",19  "fingerprint": "fuz001t0probe",20  "fixed": "2026-12-04",21  "resolution_note": "Fixed: Decision per FIPS 204: the standard defines no private-key validation, but the encoding (rho, K, tr, s1, s2, t0) is redundant: t = A(rho)*s1 + s2, (t1, t0) = Power2Round(t), the public key is (rho, t1) and tr = H(public key). `MLDSA.publicKey(_:fromPrivateKey:)` recomputes them and throws when s1 or s2 is out of range, when the stored t0 differs or when tr is not the hash of the recomputed public key; `MLDSA.isKeyPair` compares the result with a public key. `Identity(privateEncoding:)` requires it (and keeps the test signature). So t0 CAN be validated, completely; only K (the seed of the signer's randomness) has no public counterpart: a damaged K changes which valid signature is produced, never whether it verifies. The fuzz target no longer has the QY_FUZZ_STRICT_IDENTITY switch: an accepted identity that signs invalidly is a crash on every run. (The function lives in commit b806c00; 64500cd builds only together with it.) Verification: Package tests on M4M64c and on the laptop. `qyfuzz repro identity-private <recorded input>`: accepted=false. `qyfuzz run --target identity-private --seconds 90` on M4M64c with the invariant enforced: 25 174 064 executions, 0 crash (the same target found 12 accepted inconsistent keys in 40 s before the fix). `qyfuzz run --seconds 60` over the 50 targets: 165 768 322 executions, 0 crash.",22  "verification": "Package tests on M4M64c and on the laptop. `qyfuzz repro identity-private <recorded input>`: accepted=false. `qyfuzz run --target identity-private --seconds 90` on M4M64c with the invariant enforced: 25 174 064 executions, 0 crash (the same target found 12 accepted inconsistent keys in 40 s before the fix). `qyfuzz run --seconds 60` over the 50 targets: 165 768 322 executions, 0 crash."23}24
Files main
Menu

Theme