Skip to content

Certificate Processing Bug: Verifification Issue - #12024

Open
aidankeefe2022 wants to merge 2 commits into
wolfSSL:masterfrom
aidankeefe2022:verify_error
Open

aidankeefe2022 wants to merge 2 commits into
wolfSSL:masterfrom
aidankeefe2022:verify_error

Conversation

@aidankeefe2022

Copy link
Copy Markdown
Member

Description

Write-up of the issue is here: https://wolfsslinc.slack.com/files/U0B68E1LLHG/F0CFA3L0KTQ/vulnerabilitywriteup.md

Testing

Reproduced the issue and confirmed it. Added a regression test and confirmed that the nginx build is affected

Checklist

  • added tests

with
```c
./configure --enable-opensslextra --enable-altcertchains
```

If the user loads a verifiy callback that delays peer auth and the
server sends a chain that looks like this:

- Attacker-ca -> has all data for us to find a signer in our trust store
  but is sign by attacker controlled key.
- Intermediate_ca -> selfsigned
- leaf -> produced by attacker ca

We accept the connection and trust the identity of the leaf cert.

This is becuase we incorrectly wipe the error produced by the bad root CA when
we come across the intermediate with the error we rightfuly don't care
about. this mean we get to the point where we have forgotten out root is
bad and check the leaf against it which returns OK due to the leaf being
produced from the attacker root.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 22:30
@aidankeefe2022 aidankeefe2022 changed the title Verify error Certificate Processing Bug: Verifification Issue Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

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.

🟡 Changes recommended

The PEM-dependent test and callback helper lack WOLFSSL_PEM_TO_DER guards, causing fixture loading to fail in DER-only builds before certificate verification is exercised.

1 open issue
What changed in this PR

This PR fixes certificate-chain processing so bypassing one certificate’s CA error does not erase verification errors from earlier certificates.

Changes:

  • Preserve prior verification errors in alternate-chain and Apple native-validation paths.
  • Add a forged-CA regression test covering three verification-callback scenarios.
  • Include certificate fixtures, a regeneration script, and distribution entries.
File Description
tests/​api/​test_ssl_cert.h Declares and registers the regression test.
tests/​api/​test_ssl_cert.c Tests forged-chain handling and preservation of verification errors.
src/​internal.c Preserves earlier errors when bypassing a CA error.
certs/​test/​include.am Includes the new fixtures and script in distributions.
certs/​test/​alt-chain-forged-ca/​server-chain.pem Provides the forged certificate chain.
certs/​test/​alt-chain-forged-ca/​realRoot-cert.pem Provides the trusted root fixture.
certs/​test/​alt-chain-forged-ca/​leaf-key.pem Provides the test server’s private key.
certs/​test/​alt-chain-forged-ca/​gen-alt-chain-forged-ca.sh Generates the regression fixtures.

Review effort: Balanced

Comment thread tests/api/test_ssl_cert.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 #12024

Scan targets checked: wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): certs/test/alt-chain-forged-ca/gen-alt-chain-forged-ca.sh, certs/test/alt-chain-forged-ca/leaf-key.pem, certs/test/alt-chain-forged-ca/realRoot-cert.pem, certs/test/alt-chain-forged-ca/server-chain.pem, certs/test/include.am, tests/api/test_ssl_cert.h
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

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.

🔵 Needs a closer look

The regression covers only alternate chains, leaving security-sensitive Apple native trust fallback and callback interactions in need of maintainer validation on macOS.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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

Scan targets checked: wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): certs/test/alt-chain-forged-ca/gen-alt-chain-forged-ca.sh, certs/test/alt-chain-forged-ca/leaf-key.pem, certs/test/alt-chain-forged-ca/realRoot-cert.pem, certs/test/alt-chain-forged-ca/server-chain.pem, certs/test/include.am, tests/api/test_ssl_cert.h
Coverage: 1 of 1 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: Lite

@aidankeefe2022

Copy link
Copy Markdown
Member Author

retest this please

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.

4 participants