CVE-2021-28165

CVE-2021-28165 is a high-severity uncontrolled resource consumption vulnerability in org.eclipse.jetty:jetty-server (maven), affecting versions >= 7.2.2, < 9.4.39. It is fixed in 9.4.39, 10.0.2, 11.0.2.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Jetty vulnerable to incorrect handling of invalid large TLS frame, exhausting CPU resources

Workarounds

The problem can be worked around by compiling the following class:

package org.eclipse.jetty.server.ssl.fix6072;

import java.nio.ByteBuffer;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;

import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.ssl.SslConnection;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.ssl.SslContextFactory;

public class SpaceCheckingSslConnectionFactory extends SslConnectionFactory
{
    public SpaceCheckingSslConnectionFactory(@Name("sslContextFactory") SslContextFactory factory, @Name("next") String nextProtocol)
    {
        super(factory, nextProtocol);
    }

    @Override
    protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine)
    {
        return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption())
        {
            @Override
            protected SSLEngineResult unwrap(SSLEngine sslEngine, ByteBuffer input, ByteBuffer output) throws SSLException
            {
                SSLEngineResult results = super.unwrap(sslEngine, input, output);

                if ((results.getStatus() == SSLEngineResult.Status.BUFFER_UNDERFLOW ||
                    results.getStatus() == SSLEngineResult.Status.OK && results.bytesConsumed() == 0 && results.bytesProduced() == 0) &&
                    BufferUtil.space(input) == 0)
                {
                    BufferUtil.clear(input);
                    throw new SSLHandshakeException("Encrypted buffer max length exceeded");
                }
                return results;
            }
        };
    }
}

This class can be deployed by:

  • The resulting class file should be put into a jar file (eg sslfix6072.jar)
  • The jar file should be made available to the server. For a normal distribution this can be done by putting the file into ${jetty.base}/lib
  • Copy the file ${jetty.home}/modules/ssl.mod to ${jetty.base}/modules
  • Edit the ${jetty.base}/modules/ssl.mod file to have the following section:
[lib]
lib/sslfix6072.jar
  • Copy the file ${jetty.home}/etc/jetty-https.xml and${jetty.home}/etc/jetty-http2.xml to ${jetty.base}/etc
  • Edit files ${jetty.base}/etc/jetty-https.xml and ${jetty.base}/etc/jetty-http2.xml, changing any reference of org.eclipse.jetty.server.SslConnectionFactory to org.eclipse.jetty.server.ssl.fix6072.SpaceCheckingSslConnectionFactory. For example:
  <Call name="addIfAbsentConnectionFactory">
    <Arg>
      <New class="org.eclipse.jetty.server.ssl.fix6072.SpaceCheckingSslConnectionFactory">
        <Arg name="next">http/1.1</Arg>
        <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
      </New>
    </Arg>
  </Call>
  • Restart Jetty

Impact

When using SSL/TLS with Jetty, either with HTTP/1.1, HTTP/2, or WebSocket, the server may receive an invalid large (greater than 17408) TLS frame that is incorrectly handled, causing CPU resources to eventually reach 100% usage.

Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service. Typical impact: denial of service.

CVE-2021-28165 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (9.4.39, 10.0.2, 11.0.2); upgrading removes the vulnerable code path.

Affected versions

org.eclipse.jetty:jetty-server (>= 7.2.2, < 9.4.39) org.eclipse.jetty:jetty-server (>= 10.0.0, < 10.0.2) org.eclipse.jetty:jetty-server (>= 11.0.0, < 11.0.2)

Security releases

org.eclipse.jetty:jetty-server → 9.4.39 (maven) org.eclipse.jetty:jetty-server → 10.0.2 (maven) org.eclipse.jetty:jetty-server → 11.0.2 (maven)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade the following packages to resolve this vulnerability:

org.eclipse.jetty:jetty-server to 9.4.39 or later; org.eclipse.jetty:jetty-server to 10.0.2 or later; org.eclipse.jetty:jetty-server to 11.0.2 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2021-28165? CVE-2021-28165 is a high-severity uncontrolled resource consumption vulnerability in org.eclipse.jetty:jetty-server (maven), affecting versions >= 7.2.2, < 9.4.39. It is fixed in 9.4.39, 10.0.2, 11.0.2. Crafted input forces the application to consume excessive CPU, memory, or other resources, degrading or denying service.
  2. How severe is CVE-2021-28165? CVE-2021-28165 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of org.eclipse.jetty:jetty-server are affected by CVE-2021-28165? org.eclipse.jetty:jetty-server (maven) versions >= 7.2.2, < 9.4.39 is affected.
  4. Is there a fix for CVE-2021-28165? Yes. CVE-2021-28165 is fixed in 9.4.39, 10.0.2, 11.0.2. Upgrade to this version or later.
  5. Is CVE-2021-28165 exploitable, and should I be worried? Whether CVE-2021-28165 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2021-28165 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2021-28165?
    • Upgrade org.eclipse.jetty:jetty-server to 9.4.39 or later
    • Upgrade org.eclipse.jetty:jetty-server to 10.0.2 or later
    • Upgrade org.eclipse.jetty:jetty-server to 11.0.2 or later

Other vulnerabilities in org.eclipse.jetty:jetty-server

Stop the waste.
Protect your environment with Kodem.