Skip to content

certs: warn when wolfSSL is older than 5.9.4 - #1399

Open
ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:certs-nc-warn
Open

ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:certs-nc-warn

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

wolfSSL before 5.9.4 does not apply the name constraints of CAs above a
cert's issuer (CVE-2026-89133), which leaves certificate authentication
open to an out-of-namespace leaf from a peer-supplied CA.

  • configure warns after the summary when certs are on with older wolfSSL
  • builds without configure get a #warning (#pragma message on MSVC) from
    certman.c, via a version check in internal.h

Issue: F-13950

wolfSSL before 5.9.4 applies only the issuing CA's name constraints to
a cert (CVE-2026-89133). Peer chains verify one cert at a time, so a
peer-supplied CA can then issue a leaf outside a trusted CA's namespace.

- configure warns after the summary when certs are on
- internal.h defines WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS for that case
- certman.c raises a #warning from it, or #pragma message under MSVC,
  in builds without config.h

Issue: F-13950
@ejohnstown

Copy link
Copy Markdown
Contributor Author

@claude review

@claude claude 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.

Besides the inline finding, I checked the order of definitions and includes, and it holds up. WOLFSSL_V5_9_4 is already defined at wolfssh/internal.h:129 and <wolfssl/version.h> is included at line 34, so both exist before the new check at line 146. In src/certman.c, wolfssh/internal.h is included above the new #warning block, so WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS is already defined (or not) when that block is reached.

Extended reasoning...

I checked whether the new version check in wolfssh/internal.h and the warning in src/certman.c could see WOLFSSL_V5_9_4 and LIBWOLFSSL_VERSION_HEX at the point they're used. Both macros are defined earlier in internal.h, which certman.c includes above the new block, so the check works as intended.

Comment thread src/certman.c
Comment on lines +88 to +95
#if defined(WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS) && !defined(HAVE_CONFIG_H)
#ifdef _MSC_VER
#pragma message("warning: wolfSSL older than 5.9.4 does not apply " \
"ancestor CA name constraints (CVE-2026-89133); upgrade wolfSSL")
#else
#warning "wolfSSL older than 5.9.4 does not apply ancestor CA name constraints (CVE-2026-89133); upgrade wolfSSL"
#endif
#endif

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Non-autoconf builds that compile with -Werror and an older wolfSSL will fail at src/certman.c:93, and no macro lets them suppress it. The #warning runs whenever WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS is set and HAVE_CONFIG_H is not. Nothing else turns it off, unlike the existing misc.c warning, which honours WOLFSSH_IGNORE_FILE_WARN. Fix: gate the warning on an opt-out macro (reuse WOLFSSH_IGNORE_FILE_WARN or add a dedicated one) so -Werror builds can acknowledge it. Keep it on by default for builds that do not use configure.

Why this was flagged

Trigger: a build that does not use configure (custom Makefile, CMake, or an IDE project without HAVE_CONFIG_H) defines WOLFSSH_CERTS, links a wolfSSL older than 5.9.4, and compiles with -Werror. These are the integrators the comment at src/certman.c:87 says it is skipping for autoconf only. wolfssh/internal.h:146 defines WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS for them. Under GCC or Clang, the #warning at src/certman.c:93 becomes a hard error, so certman.c no longer compiles. On the base branch the same source and flags build cleanly. The only way out is to upgrade wolfSSL or edit the source. The existing file warning at src/misc.c:55-60 is skipped when WOLFSSH_IGNORE_FILE_WARN is defined, but the new block does not check that macro or any other opt-out. The MSVC #pragma message branch is not affected.

Verification: In src/certman.c the only gate is line 88, #if defined(WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS) && !defined(HAVE_CONFIG_H). After that, line 93 emits #warning "wolfSSL older than 5.9.4 ..." unconditionally, and -Werror turns that into an error, so certman.c stops compiling. No macro turns it off. On the base commit the same non-autoconf -Werror build compiles.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional. The warning is there to stop a build linking a wolfSSL that is exposed to CVE-2026-89133. Upgrading wolfSSL clears it. A builder who needs to build against an older wolfSSL under -Werror can use -Wno-error=cpp (GCC) or -Wno-error=#warnings (clang), or drop -Werror. That's the same position as the other unconditional #warnings in the tree (wolfsshd.c, echoserver.c). Reusing WOLFSSH_IGNORE_FILE_WARN would be wrong: it means something unrelated, and the Zephyr, STM32Cube and MPLAB X builds define it by default, so it would hide the warning from the non-configure builds it's meant for.

@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 #1399

Scan targets checked: wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): configure.ac
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

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: Max

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.

3 participants