Skip to content

wolfHSM Hardening Fixes#425

Open
aidangarske wants to merge 13 commits into
wolfSSL:mainfrom
aidangarske:fenrir-high-zeroize-bounds
Open

wolfHSM Hardening Fixes#425
aidangarske wants to merge 13 commits into
wolfSSL:mainfrom
aidangarske:fenrir-high-zeroize-bounds

Conversation

@aidangarske

Copy link
Copy Markdown
Member
F-4235, F-4329, F-4978, F-5139, F-5141, F-5142, F-5473, F-5474, F-5475, F-6029,
F-6030, F-6031, F-6207

@aidangarske aidangarske self-assigned this Jun 25, 2026
@aidangarske
aidangarske marked this pull request as ready for review June 25, 2026 22:21
@aidangarske
aidangarske force-pushed the fenrir-high-zeroize-bounds branch from efe02ca to d35e929 Compare June 29, 2026 16:45
@aidangarske
aidangarske requested a review from bigbrett June 29, 2026 16:47

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

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

No new issues found in the changed files. ✅

@aidangarske
aidangarske requested review from wolfSSL-Bot and removed request for bigbrett July 15, 2026 21:10

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

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@aidangarske

Copy link
Copy Markdown
Member Author

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@bigbrett, I am fine with doing it however you want seems like there is a lot of tradeoffs for each. Currently wolfssl does it like this but if we want to make a better design for wolfHSM that sounds good! Ill leave it for now till we decide

@aidangarske
aidangarske requested review from billphipps and rizlik July 21, 2026 18:16

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

Besides the open discussion on the ForceZero policy for CommBuf data, the other changes LGTM.

(Only to give my two cents to the ForceZero discussion: I'm with @bigbrett on this. Have them in, but behind some kind of feature flag.)

@rizlik

rizlik commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

I'm medium on these force zero changes. In all of our currently supported transports, the transport buffer itself has to be trusted or the whole threat model falls apart, and the client's local comm buffers even more so. Zeroizing these here in light of these assumptions is overkill IMO and would be a bit of a performance hit. I think we need to have a uniform policy about when we require force zeroing of shared memory and apply it across the entire code base at once. Perhaps a build time configuration that would enable "strict" force zeroing where the server just clears the entirety of the comm buffers once received? But again, pretty sure this is overkill. @billphipps @rizlik thoughts?

@bigbrett I do think zeroing is worth even if the comm buffer is considered trusted, being zeroing more a defense in depth against possible client co-resident threats.

But yes having an performance opt-out guard is also a nice to have but more importantly I second the idea of doing that in a single place, probably when the client receives the response.
The problem I see here is that as this PR does the zeroing there is an implicit assumption that the transport cb send is done with the buffer the moment it returns.
If this is something we want to lock in the transport API, we should add it in the docs, otherwise, zeroing must happen at response time.

regarding zeroing at the server: this adds the requirement for a server to be able to write on the request buffer, while until now it can be mapped read-only.

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.

6 participants