Repository navigation
Fix out-of-bounds read in slh_dsa verify on short signature - #2587
Ramya-9353 wants to merge 2 commits into
Conversation
Signed-off-by: Ramya Eliger <ramya@digiscrypt.com>
|
any update here? |
Could you please link to the corresponding issue/pull request? |
|
It turned out to be fixed upstream already, so there was nothing new for me to file: pq-code-package/slhdsa-c#48, merged 11 June 2026 as liboqs still has the out-of-bounds read because |
Please bump the pin. Thank you. |
Per review, take the upstream fix for the out-of-bounds read (pq-code-package/slhdsa-c#48, merged as d25ccc6) by bumping the pinned commit in copy_from_slh_dsa_c.py and dropping verify_bounds.patch. The regenerated slh_dsa_c tree also picks up upstream CBMC contract annotations and a sha3_init cleanup; no algorithm behaviour changes. The short-signature regression test in tests/test_sig.c is kept and passes under ASan. Signed-off-by: Ramya Eliger <ramya@digiscrypt.com>
|
Done — bumped the pin to |
slh_verify and slh_verify_internal call Hmsg before validating the signature length:
sig, but the only length check (sig_sz != slh_sig_sz) lives inslh_verify_digestand runs afterwardssha2_256_h_msgviaslh_verify(slh_dsa.c:715), reachable fromOQS_SIG_verifywith an 8-byte signature buffer for SLH-DSA-SHA2-128fcopy_from_slh_dsa_c.pyis bumped tod25ccc6(Validate signature length to prevent OOB read pq-code-package/slhdsa-c#48), which hoists thesig_sz != slh_sig_sz(prm)check ahead of Hmsg in both entry points;verify_bounds.patchis dropped since the check now arrives with the copied sourcetests/test_sig.crejects a 1-byte signature and aborts under ASan without the fixValid sign/verify and the existing EUF-CMA test are unchanged. The bump also picks up upstream CBMC contract annotations and a
sha3_initcleanup; no algorithm behaviour changes. The root cause was in the vendored slhdsa-c and was fixed upstream in pq-code-package/slhdsa-c#48.Generative AI (Claude, via an automated assistant) was used to help locate the issue, write the patch and the regression test, and draft this description. I reviewed and verified the change, the ASan reproducer, and the before/after test behaviour locally.