CVE-2021-21295

CVE-2021-21295 is a medium-severity security vulnerability in io.netty:netty-codec-http2 (maven), affecting versions >= 4.0.0, < 4.1.60.Final. It is fixed in 4.1.60.Final.

Summary

Workarounds

The user can do the validation by themselves by implementing a custom ChannelInboundHandler that is put in the ChannelPipeline behind Http2StreamFrameToHttpObjectCodec.

References

Related change to workaround the problem: https://github.com/Netflix/zuul/pull/980

Impact

If a Content-Length header is present in the original HTTP/2 request, the field is not validated by Http2MultiplexHandler as it is propagated up. This is fine as long as the request is not proxied through as HTTP/1.1.
If the request comes in as an HTTP/2 stream, gets converted into the HTTP/1.1 domain objects (HttpRequest, HttpContent, etc.) via Http2StreamFrameToHttpObjectCodec and then sent up to the child channel's pipeline and proxied through a remote peer as HTTP/1.1 this may result in request smuggling.

In a proxy case, users may assume the content-length is validated somehow, which is not the case. If the request is forwarded to a backend channel that is a HTTP/1.1 connection, the Content-Length now has meaning and needs to be checked.

An attacker can smuggle requests inside the body as it gets downgraded from HTTP/2 to HTTP/1.1. A sample attack request looks like:

POST / HTTP/2
:authority:: externaldomain.com
Content-Length: 4

asdfGET /evilRedirect HTTP/1.1
Host: internaldomain.com

Users are only affected if all of this is true:

  • HTTP2MultiplexCodec or Http2FrameCodec is used
  • Http2StreamFrameToHttpObjectCodec is used to convert to HTTP/1.1 objects
  • These HTTP/1.1 objects are forwarded to another remote peer.

CVE-2021-21295 has a CVSS score of 5.9 (Medium). 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 (4.1.60.Final); upgrading removes the vulnerable code path.

Affected versions

io.netty:netty-codec-http2 (>= 4.0.0, < 4.1.60.Final) org.jboss.netty:netty (< 4.0.0) io.netty:netty (< 4.0.0)

Security releases

io.netty:netty-codec-http2 → 4.1.60.Final (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.

See it in your environment

Remediation advice

This has been patched in 4.1.60.Final

Frequently Asked Questions

  1. What is CVE-2021-21295? CVE-2021-21295 is a medium-severity security vulnerability in io.netty:netty-codec-http2 (maven), affecting versions >= 4.0.0, < 4.1.60.Final. It is fixed in 4.1.60.Final.
  2. How severe is CVE-2021-21295? CVE-2021-21295 has a CVSS score of 5.9 (Medium). 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 packages are affected by CVE-2021-21295?
    • io.netty:netty-codec-http2 (maven) (versions >= 4.0.0, < 4.1.60.Final)
    • org.jboss.netty:netty (maven) (versions < 4.0.0)
    • io.netty:netty (maven) (versions < 4.0.0)
  4. Is there a fix for CVE-2021-21295? Yes. CVE-2021-21295 is fixed in 4.1.60.Final. Upgrade to this version or later.
  5. Is CVE-2021-21295 exploitable, and should I be worried? Whether CVE-2021-21295 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-21295 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-21295? Upgrade io.netty:netty-codec-http2 to 4.1.60.Final or later.

Other vulnerabilities in io.netty:netty-codec-http2

CVE-2026-50560CVE-2026-48043CVE-2026-47244CVE-2026-42587CVE-2026-33871

Stop the waste.
Protect your environment with Kodem.