Skip to content

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

Merged
chrisvest merged 1 commit intonetty:4.2from
chrisvest:4.2-ssl-assert
Feb 17, 2025
Merged

Replace SSL assertion with explicit record length check (#14810)#14821
chrisvest merged 1 commit intonetty:4.2from
chrisvest:4.2-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
Copy link
Copy Markdown
Member Author

I've no idea why SingleThreadIoEventLoopTest.testSuspendingWhileRegistrationActive is so flaky all of the sudden.

@normanmaurer
Copy link
Copy Markdown
Member

I've no idea why SingleThreadIoEventLoopTest.testSuspendingWhileRegistrationActive is so flaky all of the sudden.

Maybe time to disable it and open an issue to investigate ?

@chrisvest chrisvest merged commit 783179b into netty:4.2 Feb 17, 2025
11 of 15 checks passed
@chrisvest chrisvest deleted the 4.2-ssl-assert branch February 17, 2025 17:36
@chrisvest
Copy link
Copy Markdown
Member Author

I made PR #14828 to disable it.

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.

3 participants