Skip to content

crypto: free disabled OpenSSL compression methods#64683

Open
BridgeAR wants to merge 1 commit into
nodejs:mainfrom
BridgeAR:BridgeAR/2026-07-22-fix-openssl-compression-leak
Open

crypto: free disabled OpenSSL compression methods#64683
BridgeAR wants to merge 1 commit into
nodejs:mainfrom
BridgeAR:BridgeAR/2026-07-22-fix-openssl-compression-leak

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Node's compression-enabled OpenSSL build initializes the legacy TLS record-compression methods during startup. sk_SSL_COMP_zero() removed those methods from the stack without freeing them, so LeakSanitizer reported a 24-byte leak after otherwise successful test runs.

Free each method before removing it while keeping OpenSSL's stack container valid. This preserves Node's process-wide CRIME protection, including when SSL_CONF enables record compression at security level 1, while certificate compression remains available.

The regression test starts Node with that unsafe OpenSSL configuration and verifies that its TLS 1.2 ClientHello still advertises only null compression. Without the fix it also advertises zlib.

Refs: #62217

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Jul 22, 2026
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-22-fix-openssl-compression-leak branch from 8ef0f45 to 4ad0562 Compare July 22, 2026 20:58
Node's compression-enabled OpenSSL build allocates TLS
record-compression methods during startup. Clearing the stack loses
the only pointers without freeing entries, so LeakSanitizer reports
a 24-byte leak.

Pop and free every method while preserving the OpenSSL-owned stack.
Record compression remains unavailable process-wide, including when
SSL_CONF attempts to enable it at a lower security level.

Refs: nodejs#62217
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-22-fix-openssl-compression-leak branch from 4ad0562 to 0469d65 Compare July 23, 2026 12:21
@BridgeAR BridgeAR changed the title crypto: stop clearing OpenSSL compression methods crypto: free disabled OpenSSL compression methods Jul 23, 2026
@BridgeAR
BridgeAR marked this pull request as ready for review July 23, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants