Skip to content

Replace SSL assertion with explicit record length check#14810

Merged
chrisvest merged 4 commits intonetty:4.1from
yawkat:ssl-assert
Feb 14, 2025
Merged

Replace SSL assertion with explicit record length check#14810
chrisvest merged 4 commits intonetty:4.1from
yawkat:ssl-assert

Conversation

@yawkat
Copy link
Copy Markdown
Contributor

@yawkat yawkat commented Feb 12, 2025

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 dc6b051 into netty:4.1 Feb 14, 2025
15 checks passed
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Feb 14, 2025
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 pushed a commit to chrisvest/netty that referenced this pull request Feb 14, 2025
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 added this to the 4.1.119.Final milestone Feb 14, 2025
chrisvest added a commit that referenced this pull request Feb 14, 2025
)

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: Jonas Konrad <jonas.konrad@oracle.com>
Co-authored-by: Norman Maurer <norman_maurer@apple.com>
chrisvest added a commit that referenced this pull request Feb 17, 2025
)

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: Jonas Konrad <jonas.konrad@oracle.com>
Co-authored-by: Norman Maurer <norman_maurer@apple.com>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit to dongjoon-hyun/spark that referenced this pull request Mar 5, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit e84c345)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants