Skip to content

Replace SSL assertion with explicit record length check (#14810)#14822

Merged
chrisvest merged 1 commit intonetty:mainfrom
chrisvest:5x-ssl-assert
Feb 14, 2025
Merged

Replace SSL assertion with explicit record length check (#14810)#14822
chrisvest merged 1 commit intonetty:mainfrom
chrisvest:5x-ssl-assert

Conversation

@chrisvest
Copy link
Copy Markdown
Member

Motivation:

This assertion sometimes fails in fuzzing when using the JDK SSL implementation. The reason is that the JDK equivalent of getEncryptedPacketLength (SSLEngineInputRecord#bytesInCompletePacket) remembers when a previous packet was not SSLv2 and will not check for SSLv2 again in that case. getEncryptedPacketLength cannot replicate this behavior and checks for SSLv2 every time. This can lead to a mismatch in the netty and JDK length result, which triggers the assert replaced in this PR.

Modification:

Replace the assert with a normal check and exception. This sort of input should always be a sign of bad data.

Result:

Normal decode failure instead of assertion failure.

From my testing, this only affects the JDK implementation so there's no potential for a crash like CVE-2025-24970. It looks like when assertions are off, the data is just dropped atm.

Motivation:

This assertion sometimes fails in fuzzing when using the JDK SSL
implementation. The reason is that the JDK equivalent of
getEncryptedPacketLength (SSLEngineInputRecord#bytesInCompletePacket)
remembers when a previous packet was not SSLv2 and will not check for
SSLv2 again in that case. getEncryptedPacketLength cannot replicate this
behavior and checks for SSLv2 every time. This can lead to a mismatch in
the netty and JDK length result, which triggers the assert replaced in
this PR.

Modification:

Replace the assert with a normal check and exception. This sort of input
should always be a sign of bad data.

Result:

Normal decode failure instead of assertion failure.

From my testing, this only affects the JDK implementation so there's no
potential for a crash like CVE-2025-24970. It looks like when assertions
are off, the data is just dropped atm.

---------

Co-authored-by: Norman Maurer <norman_maurer@apple.com>
@chrisvest chrisvest merged commit a235f71 into netty:main Feb 14, 2025
14 checks passed
@chrisvest chrisvest deleted the 5x-ssl-assert branch February 14, 2025 18:30
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.

2 participants