Skip to content

Fix out-of-bounds read printing CRL authority key id - #12175

Merged
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
embhorn:zd22862
Nov 18, 2026
Merged

JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
embhorn:zd22862

Conversation

@embhorn

@embhorn embhorn commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Description

X509CRLPrintExtensions() bounded the authority key identifier hex dump with XSTRLEN() on the binary extAuthKeyId array. When none of the KEYID_SIZE octets were zero, the loop read past the end of the array. A zero octet truncated the output, and a zero first octet dropped the extension from the output entirely.

extAuthKeyId is also a normalized CA lookup key. It is hashed, or zero padded in SM2/SM3 builds, when the encoded id is not KEYID_SIZE octets, so it does not match the identifier in the CRL either way.

Fixes zd22862

Credit

Thanks to @parthod0x for reporting this issue and confirming the fix.

Testing

  • test_wolfSSL_X509_CRL_print checks the exact printed key id for the new CRL and for caEccCrl.pem. The caEccCrl.pem check is guarded on HAVE_ECC and !NO_SHA256.
  • The new test fails under UBSan before the fix (index 20 out of bounds for byte[20]) and passes after it.
  • The full unit.test suite passes with ASan and UBSan.
  • The CRL tests also pass with -DWC_ASN_HASH_SHA256 (32 byte KEYID_SIZE) and with --disable-ecc.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@embhorn embhorn self-assigned this Nov 18, 2026
Copilot AI balanced review requested due to automatic review settings November 18, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +64 B (+0.0%, 806,468 B / 1,048,576 B, total: 77% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +64 B (+0.0%, 346,344 B / 1,048,576 B, total: 33% used)

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +104 B, text +13,192 B (+4.7%, 295,768 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12175

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): certs/crl/gencrls.sh, certs/crl/include.am
Coverage: 6 of 6 in-scope changed file(s) opened by the reviewer

Findings: 4
4 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Max

Comment thread wolfcrypt/src/asn.c Resolved
Comment thread wolfssl/wolfcrypt/asn.h Resolved
Comment thread tests/api.c Resolved

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12175

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): certs/crl/gencrls.sh, certs/crl/include.am
Coverage: 3 of 3 in-scope changed file(s) opened by the reviewer

No new issues found in the changed files.

💬 3 finding(s) from an earlier review are still open and were not re-posted:

  • New 4-argument ParseCRL_AuthKeyIdExt declaration conflicts with the 3-argument definition in asn_orig.c, breaking the WOLFSSL_ASN_ORIGINAL build — wolfcrypt/src/asn.c:4740
  • Raw AKID fields only populated by template parser; legacy ASN build no longer compiles — wolfssl/wolfcrypt/asn.h:3358
  • Test fixture akid_zero_octets.pem referenced but not present in the tree — tests/api.c:35103

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12175

Scan targets checked: none
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): certs/crl/extra-crls/akid_zero_octets.pem, certs/crl/gencrls.sh, certs/crl/include.am

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed stale reviews from themself November 18, 2026 17:07

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@embhorn embhorn assigned wolfSSL-Bot and unassigned embhorn Nov 18, 2026
@JacobBarthelmeh
JacobBarthelmeh merged commit de5cb96 into wolfSSL:master Nov 18, 2026
450 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants