Summary
Netty: Memory Leak in DNS Record Decoder via Malformed Domain Names
A memory leak can be caused in Netty's DNS codec by sending malicious DNS packets containing invalid domain names. Because the leak occurs incrementally per packet, sustained malicious requests will cause a gradual Denial of Service.
Details
Inside io.netty.handler.codec.dns.AbstractDnsRecord, the parsed domain name string is passed to IDN.toASCII(name). If the domain name contains characters that violate IDNA rules, IDN.toASCII throws an IllegalArgumentException.
Because this exception occurs inside the constructor before the DnsRecord instance can assign the buffer to its content field for later release, the ByteBuf whose reference count was incremented (or newly allocated) is never released, resulting in a direct memory leak.
There are several places where variants of this leak happen:
io.netty.handler.codec.dns.DefaultDnsRecordDecoder#decodeRecord(java.lang.String, io.netty.handler.codec.dns.DnsRecordType, int, long, io.netty.buffer.ByteBuf, int, int)invokesin.retainedDuplicate()or creates a new bufferoutwhen constructingDefaultDnsRawRecordio.netty.handler.codec.dns.DnsCodecUtil#decompressDomainNameallocates a newByteBufand passes it toencodeDomainName(). If the decompressed domain name contains a null byte (\0),encodeDomainName()throws anIllegalArgumentException, leaking the newly allocated buffer.
Impact
Resource Exhaustion. Any application utilizing Netty's DnsRecordDecoder (such as DnsNameResolver or custom DNS servers) is vulnerable.
GHSA-MFG7-5GFP-C4W3 has a CVSS score of 5.3 (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.2.16.Final, 4.1.136.Final); upgrading removes the vulnerable code path.
Affected versions
Security releases
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
io.netty:netty-codec-dns to 4.2.16.Final or later; io.netty:netty-codec-dns to 4.1.136.Final or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-MFG7-5GFP-C4W3? GHSA-MFG7-5GFP-C4W3 is a medium-severity security vulnerability in io.netty:netty-codec-dns (maven), affecting versions >= 4.2.0.Final, <= 4.2.15.Final. It is fixed in 4.2.16.Final, 4.1.136.Final.
- How severe is GHSA-MFG7-5GFP-C4W3? GHSA-MFG7-5GFP-C4W3 has a CVSS score of 5.3 (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.
- Which versions of io.netty:netty-codec-dns are affected by GHSA-MFG7-5GFP-C4W3? io.netty:netty-codec-dns (maven) versions >= 4.2.0.Final, <= 4.2.15.Final is affected.
- Is there a fix for GHSA-MFG7-5GFP-C4W3? Yes. GHSA-MFG7-5GFP-C4W3 is fixed in 4.2.16.Final, 4.1.136.Final. Upgrade to this version or later.
- Is GHSA-MFG7-5GFP-C4W3 exploitable, and should I be worried? Whether GHSA-MFG7-5GFP-C4W3 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
- What actually determines whether GHSA-MFG7-5GFP-C4W3 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.
- How do I fix GHSA-MFG7-5GFP-C4W3?
- Upgrade
io.netty:netty-codec-dnsto 4.2.16.Final or later - Upgrade
io.netty:netty-codec-dnsto 4.1.136.Final or later
- Upgrade