CVE-2022-2191
Jetty SslConnection does not release pooled ByteBuffers in case of errors
Description
Impact
SslConnection does not release ByteBuffers in case of error code paths.
For example, TLS handshakes that require client-auth with clients that send expired certificates will trigger a TLS handshake errors and the ByteBuffers used to process the TLS handshake will be leaked.
Workarounds
Configure explicitly a RetainableByteBufferPool with max[Heap|Direct]Memory to limit the amount of memory that is leaked.
Eventually the pool will be full of "active" entries (the leaked ones) and will provide ByteBuffers that will be GCed normally.
With embedded-jetty
int maxBucketSize = 1000;
long maxHeapMemory = 128 * 1024L * 1024L; // 128 MB
long maxDirectMemory = 128 * 1024L * 1024L; // 128 MB
RetainableByteBufferPool rbbp = new ArrayRetainableByteBufferPool(0, -1, -1, maxBucketSize, maxHeapMemory, maxDirectMemory);
server.addBean(rbbp); // make sure the ArrayRetainableByteBufferPool is added before the server is started
server.start();
With jetty-home/jetty-base
Create a ${jetty.base}/etc/retainable-byte-buffer-config.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.io.ArrayRetainableByteBufferPool">
<Arg type="int"><Property name="jetty.byteBufferPool.minCapacity" default="0"/></Arg>
<Arg type="int"><Property name="jetty.byteBufferPool.factor" default="-1"/></Arg>
<Arg type="int"><Property name="jetty.byteBufferPool.maxCapacity" default="-1"/></Arg>
<Arg type="int"><Property name="jetty.byteBufferPool.maxBucketSize" default="1000"/></Arg>
<Arg type="long"><Property name="jetty.byteBufferPool.maxHeapMemory" default="128000000"/></Arg>
<Arg type="long"><Property name="jetty.byteBufferPool.maxDirectMemory" default="128000000"/></Arg>
</New>
</Arg>
</Call>
</Configure>
And then reference it in ${jetty.base}/start.d/retainable-byte-buffer-config.ini
etc/retainable-byte-buffer-config.xml
References
https://github.com/eclipse/jetty.project/issues/8161
For more information
- Email us at security@webtide.com
Affected Maven artifacts (1)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.eclipse.jetty » jetty-server | >= 10.0.0, < 10.0.10>= 11.0.0, < 11.0.10 | 10.0.10, 11.0.10 |
Blast radius
29% of the dependent artifacts (155) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 1,182 |
| 2 hops | 1,356 |
| 3 hops | 1,778 |
| 4 hops | 1,923 |
| 5 hops | 646 |
| 6 hops | 299 |
Most used dependents
- org.eclipse.jetty » jetty-servlet2,979 usages
- org.eclipse.jetty » jetty-webapp2,060 usages
- org.eclipse.jetty » jetty-maven-plugin1,337 usages
- io.dropwizard » dropwizard-core894 usages
- org.eclipse.jetty » jetty-security843 usages
- org.apache.cxf » cxf-rt-transports-http-jetty513 usages
- io.dropwizard » dropwizard-testing463 usages
- org.springframework.boot » spring-boot-starter-jetty458 usages
- org.eclipse.jetty » jetty-annotations392 usages
- org.eclipse.jetty » jetty-plus392 usages
- org.eclipse.jetty.http2 » http2-server285 usages
- org.eclipse.jetty » jetty-deploy267 usages
- org.eclipse.jetty » jetty-alpn-server231 usages
- org.eclipse.jetty » apache-jsp214 usages
- org.eclipse.jetty » jetty-alpn-java-server196 usages
Computed from the dependency graph of build 20261128.0605 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
References
| Advisory | NVD CVE-2022-2191 | nvd.nist.gov |
| Web | eclipse/jetty.project advisory GHSA-8mpp-f3f7-xc28 | github.com |
| Web | eclipse/jetty.project issue #8161 | github.com |
| Web | eclipse/jetty.project | github.com |
| Web | advisory/ntap-20220909-0003 | security.netapp.com |
