Skip to content

Fix security vulnerabilities identified by Fenrir scanner#461

Merged
dgarske merged 1 commit intowolfSSL:masterfrom
aidangarske:fix-fenrir-wolftpm
Feb 25, 2026
Merged

Fix security vulnerabilities identified by Fenrir scanner#461
dgarske merged 1 commit intowolfSSL:masterfrom
aidangarske:fix-fenrir-wolftpm

Conversation

@aidangarske
Copy link
Member

@aidangarske aidangarske commented Feb 23, 2026

No description provided.

@aidangarske aidangarske self-assigned this Feb 23, 2026
@aidangarske aidangarske marked this pull request as ready for review February 23, 2026 20:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses multiple security findings reported by the Fenrir scanner and a static analysis report across the TPM packet parsing, parameter encryption, Linux transport, ASN decoding, and wrapper memory-handling paths.

Changes:

  • Adds bounds checks / clamping in several TPM response parsing routines to prevent OOB reads/writes and infinite loops.
  • Hardens parameter encryption/decryption by validating key material sizes and force-zeroing sensitive stack buffers.
  • Improves safety in wrapper cleanup/free paths (force-zero before free) and adds unit tests for NULL-argument handling.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit_tests.c Adds unit tests for NULL argument handling in policy commands and NULL-safe wrapper free functions.
src/tpm2_wrap.c Force-zeros heap-allocated key/session/template structures before free; fixes inputs to TPM2_ZGen_2Phase in ECDHE path.
src/tpm2_param_enc.c Adds key-size validation to prevent buffer overflow; ensures sensitive buffers are force-zeroed on exit.
src/tpm2_packet.c Adds guards for negative copy sizes and clamps parsed field sizes to destination buffers.
src/tpm2_linux.c Fixes EOF detection logic in read() handling (ret == 0) and returns failure accordingly.
src/tpm2_cryptocb.c Ensures BAD_FUNC_ARG is returned for invalid HMAC context regardless of DEBUG flags.
src/tpm2_asn.c Adds an rc check before exponent parsing in RSA public key ASN decoder.
src/tpm2.c Adds bounds checks on parsed counts/sizes, fixes handle count in TPM2_GetSessionAuditDigest, fixes PCR_Event loop termination, and adds NULL checks for select policy commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dgarske
dgarske previously approved these changes Feb 24, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgarske dgarske merged commit 25466a9 into wolfSSL:master Feb 25, 2026
76 of 77 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.

4 participants