CVE-2026-56821: Netty Remote Code Execution Vulnerability
HIGHCVE-2026-56821 is a HIGH (CVSS 7.4) remote code execution vulnerability (CWE-299: Improper Check for Certificate Revocation) affecting Netty libraries in the Maven ecosystem. The issue involves out-of-date ocsp responses accepted by ocspservercertificatevalidator. Remediation is available by upgrading affected packages to version 4.2.16.Final, 4.1.136.Final.
CVE-2026-56821 at a Glance
Security Impact
CVSS: 7.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2026-56821
To remediate this vulnerability, upgrade all affected Netty dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-ssl-ocsp</artifactId>
<version>4.2.16.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-ssl-ocsp</artifactId>
<version>4.1.136.Final</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=io.netty
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2026-56821, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=io.netty
Analyze the terminal output to locate any version of Netty in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.16.Final), your application is affected.
Note: The mvn dependency:tree -Dincludes=io.netty command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-299: Improper Check for Certificate Revocation, where the product does not check or incorrectly checks the revocation status of a certificate, which may cause it to use a certificate that has been compromised. In Netty, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-56821 Affected Netty Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
io.netty:netty-handler-ssl-ocsp
|
Maven |
≥ 4.2.0.Final
< 4.2.16.Final
|
4.2.16.Final
|
|
io.netty:netty-handler-ssl-ocsp
|
Maven |
< 4.1.136.Final
|
4.1.136.Final
|
References
Frequently Asked Questions
What is CVE-2026-56821?
Which Netty versions are affected?
What version fixes CVE-2026-56821?
Is netty-handler-ssl-ocsp affected?
What is the CVSS score of CVE-2026-56821?
What CWE is associated with CVE-2026-56821?
How can I check Maven dependencies for CVE-2026-56821?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g7hg-vrcf-mvmr",
"modified" : "2026-07-22T21:46:39Z",
"published" : "2026-07-22T21:46:39Z",
"aliases" : [ "CVE-2026-56821" ],
"summary" : "Netty: Out-of-date OCSP Responses Accepted by OcspServerCertificateValidator",
"details" : "### Summary\n`OcspServerCertificateValidator` flags an out-of-date OCSP response but does not stop processing it, so an expired GOOD response is still reported as `VALID`, letting an on-path attacker replay a stale GOOD response to bypass revocation of a since-revoked certificate.\n\n### Details\nIn `io.netty.handler.ssl.ocsp.OcspServerCertificateValidator#userEventTriggered` the freshness check has no `return`, so execution falls through and a `VALID` `OcspValidationEvent` is still fired:\n\n```java\n if (!(current.after(response.getThisUpdate()) &&\n current.before(response.getNextUpdate()))) {\n ctx.fireExceptionCaught(new IllegalStateException(\"OCSP Response is out-of-date\"));\n }\n```\n\nNonce validation is optional and off by default, so freshness is the only replay defense — and it is not enforced. Additionally `getNextUpdate()` may be `null`, making `current.before(null)` throw `NullPointerException`.\n\nhttps://datatracker.ietf.org/doc/html/rfc6960#section-3.2\n\n```\n 5. The time at which the status being indicated is known to be\n correct (thisUpdate) is sufficiently recent;\n\n 6. When available, the time at or before which newer information will\n be available about the status of the certificate (nextUpdate) is\n greater than the current time.\n```\n\n### PoC\n\nAdd the test below to `io.netty.handler.ssl.ocsp.OcspServerCertificateValidatorTest`\n\n```java\n @Test\n void staleOcspResponseIsRejected() throws Exception {\n X509Bundle caRoot = new CertificateBuilder()\n .algorithm(CertificateBuilder.Algorithm.rsa2048)\n .subject(\"CN=TrustedRootCA\")\n .setIsCertificateAuthority(true)\n .buildSelfSigned();\n\n GeneralName ocspName = new GeneralName(GeneralName.uniformResourceIdentifier, \"http://localhost/\");\n AuthorityInformationAccess aia = new AuthorityInformationAccess(\n new AccessDescription(AccessDescription.id_ad_ocsp, ocspName));\n X509Bundle targetCert = new CertificateBuilder()\n .algorithm(CertificateBuilder.Algorithm.rsa2048)\n .subject(\"CN=TargetServer\")\n .addExtensionOctetString(\"1.3.6.1.5.5.7.1.1\", false, aia.getEncoded())\n .buildIssuedBy(caRoot);\n\n Date past = new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7));\n CertificateID certId = new CertificateID(\n new JcaDigestCalculatorProviderBuilder().build().get(CertificateID.HASH_SHA1),\n new JcaX509CertificateHolder(caRoot.getCertificate()),\n targetCert.getCertificate().getSerialNumber());\n BasicOCSPRespBuilder respBuilder = new BasicOCSPRespBuilder(\n new RespID(new JcaX509CertificateHolder(caRoot.getCertificate()).getSubject()));\n respBuilder.addResponse(certId, CertificateStatus.GOOD, past, past);\n BasicOCSPResp expiredBasicResp = respBuilder.build(\n new JcaContentSignerBuilder(\"SHA256withRSA\").build(caRoot.getKeyPair().getPrivate()),\n new X509CertificateHolder[0],\n past);\n final byte[] responseEncoded = new OCSPRespBuilder()\n .build(OCSPRespBuilder.SUCCESSFUL, expiredBasicResp).getEncoded();\n\n IoTransport defaultTransport = createDefaultTransport();\n IoTransport mockTransport = IoTransport.create(defaultTransport.eventLoop(), () -> {\n NioSocketChannel channel = new NioSocketChannel();\n channel.pipeline().addFirst(new ChannelOutboundHandlerAdapter() {\n @Override\n public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress,\n SocketAddress localAddress, ChannelPromise promise) {\n promise.setSuccess();\n ctx.executor().execute(() -> {\n ctx.pipeline().fireChannelActive();\n DefaultFullHttpResponse httpResponse = new DefaultFullHttpResponse(\n HttpVersion.HTTP_1_1, HttpResponseStatus.OK,\n Unpooled.wrappedBuffer(responseEncoded));\n httpResponse.headers().set(HttpHeaderNames.CONTENT_TYPE, \"application/ocsp-response\");\n httpResponse.headers().set(HttpHeaderNames.CONTENT_LENGTH,\n httpResponse.content().readableBytes());\n ctx.pipeline().fireChannelRead(httpResponse);\n });\n }\n });\n return channel;\n }, defaultTransport.datagramChannel());\n\n SslContext serverSslCtx = SslContextBuilder\n .forServer(targetCert.getKeyPair().getPrivate(),\n targetCert.getCertificate(), caRoot.getCertificate())\n .build();\n Channel serverChannel = new ServerBootstrap()\n .group(defaultTransport.eventLoop())\n .channel(NioServerSocketChannel.class)\n .childHandler(new ChannelInitializer<SocketChannel>() {\n @Override\n protected void initChannel(SocketChannel ch) {\n ch.pipeline().addLast(serverSslCtx.newHandler(ch.alloc()));\n }\n })\n .bind(0).sync().channel();\n\n int serverPort = ((InetSocketAddress) serverChannel.localAddress()).getPort();\n\n AtomicBoolean validEventFired = new AtomicBoolean();\n AtomicReference<Throwable> caughtException = new AtomicReference<>();\n CountDownLatch latch = new CountDownLatch(1);\n\n DnsNameResolver resolver = OcspServerCertificateValidator.createDefaultResolver(mockTransport);\n SslContext clientSslCtx = SslContextBuilder.forClient()\n .trustManager(InsecureTrustManagerFactory.INSTANCE)\n .build();\n new Bootstrap()\n .group(defaultTransport.eventLoop())\n .channel(NioSocketChannel.class)\n .handler(new ChannelInitializer<SocketChannel>() {\n @Override\n protected void initChannel(SocketChannel ch) {\n ch.pipeline().addLast(clientSslCtx.newHandler(ch.alloc(), \"127.0.0.1\", serverPort));\n ch.pipeline().addLast(\n new OcspServerCertificateValidator(true, false, mockTransport, resolver));\n ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {\n @Override\n public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {\n if (evt instanceof OcspValidationEvent &&\n ((OcspValidationEvent) evt).response().status() ==\n OcspResponse.Status.VALID) {\n validEventFired.set(true);\n }\n ctx.fireUserEventTriggered(evt);\n }\n\n @Override\n public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {\n caughtException.compareAndSet(null, cause);\n ctx.channel().close();\n latch.countDown();\n }\n });\n }\n })\n .connect(\"127.0.0.1\", serverPort).sync();\n\n assertTrue(latch.await(5, TimeUnit.SECONDS));\n assertFalse(validEventFired.get(),\n \"OcspValidationEvent(VALID) must not be emitted for a stale OCSP response\");\n assertNotNull(caughtException.get());\n assertInstanceOf(IllegalStateException.class, caughtException.get());\n\n serverChannel.close().sync();\n resolver.close();\n }\n```\n### Impact\nCertificate revocation bypass via replay of an expired OCSP response. Any application using `OcspServerCertificateValidator` is affected; a revoked certificate can be accepted.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "io.netty:netty-handler-ssl-ocsp"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.2.0.Final"
}, {
"fixed" : "4.2.16.Final"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "io.netty:netty-handler-ssl-ocsp"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.136.Final"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/netty/netty/security/advisories/GHSA-g7hg-vrcf-mvmr"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/netty/netty"
}, {
"type" : "WEB",
"url" : "https://github.com/netty/netty/releases/tag/netty-4.1.136.Final"
}, {
"type" : "WEB",
"url" : "https://github.com/netty/netty/releases/tag/netty-4.2.16.Final"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-299" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-22T21:46:39Z",
"nvd_published_at" : null
}
}