CVE-2024-25638
DNSJava DNSSEC Bypass
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
8.9
DNSJava DNSSEC Bypass
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
CVE-2024-25638- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Weakness
- CWE-345, CWE-349
- Updated
- 2026-11-02
EUVDEUVD-2024-2321
8.9
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
EUVD-2024-2321- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-cfxw-4h78-h7fw
7.0
DNSJava DNSSEC Bypass
Summary
Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones.
Details
DNS Messages are not authenticated. They do not guarantee that
- received RRs are authentic
- not received RRs do not exist
- all or any received records in a response relate to the request
Applications utilizing DNSSEC generally expect these guarantees to be met, however DNSSEC by itself only guarantees the first two. To meet the third guarantee, resolvers generally follow an (undocumented, as far as RFCs go) algorithm such as: (simplified, e.g. lacks DNSSEC validation!)
- denote by
QNAMEthe name you are querying (e.g. fraunhofer.de.), and initialize a list of aliases - if the ANSWER section contains a valid PTR RRSet for
QNAME, return it (and optionally return the list of aliases as well) - if the ANSWER section contains a valid CNAME RRSet for
QNAME, add it to the list of aliases. SetQNAMEto the CNAME's target and go to 2. - Verify that
QNAMEdoes not have any PTR, CNAME and DNAME records using valid NSEC or NSEC3 records. Returnnull.
Note that this algorithm relies on NSEC records and thus requires a considerable portion of the DNSSEC specifications to be implemented. For this reason, it cannot be performed by a DNS client (aka application) and is typically performed as part of the resolver logic.
dnsjava does not implement a comparable algorithm, and the provided APIs instead return either
- the received DNS message itself (e.g. when using a ValidatingResolver such as in this example), or
- essentially just the contents of its ANSWER section (e.g. when using a LookupSession such as in this example)
If applications blindly filter the received results for RRs of the desired record type (as seems to be typical usage for dnsjava), a rogue recursive resolver or (on UDP/TCP connections) a network attacker can
- In addition to the actual DNS response, add RRs irrelevant to the query but of the right datatype, e.g. from another zone, as long as that zone is correctly using DNSSEC, or
- completely exchange the relevant response records
Impact
DNS(SEC) libraries are usually used as part of a larger security framework. Therefore, the main misuses of this vulnerability concern application code, which might take the returned records as authentic answers to the request. Here are three concrete examples of where this might be detrimental:
- RFC 6186 specifies that to connect to an IMAP server for a user, a mail user agent should retrieve certain SRV records and send the user's credentials to the specified servers. Exchanging the SRV records can be a tool to redirect the credentials.
- When delivering mail via SMTP, MX records determine where to deliver the mails to. Exchanging the MX records might lead to information disclosure. Additionally, an exchange of TLSA records might allow attackers to intercept TLS traffic.
- Some research projects like LIGHTest are trying to manage CA trust stores via URI and SMIMEA records in the DNS. Exchanging these allows manipulating the root of trust for dependent applications.
Mitigations
At this point, the following mitigations are recommended:
- When using a ValidatingResolver, ignore any Server indications of whether or not data was available (e.g. NXDOMAIN, NODATA, ...).
- For APIs returning RRs from DNS responses, filter the RRs using an algorithm such as the one above. This includes e.g.
LookupSession.lookupAsync. - Remove APIs dealing with raw DNS messages from the examples section or place a noticable warning above.
- Record
GHSA-cfxw-4h78-h7fw- CVSS 4.0
- 7.0 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L - CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Weakness
- CWE-345, CWE-349
- Updated
- 2026-11-02
NVD
8.9
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
CVE-2024-25638- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Weakness
- CWE-345, CWE-349
- Updated
- 2026-11-02
OSV
8.9
DNSJava DNSSEC Bypass
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
CVE-2024-25638- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Weakness
- CWE-345, CWE-349
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2024-25638
8.9
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
DEBIAN-CVE-2024-25638- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
Show 5 moreShow less
OSVGHSA-cfxw-4h78-h7fw
7.0
DNSJava DNSSEC Bypass
Summary
Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones.
Details
DNS Messages are not authenticated. They do not guarantee that
- received RRs are authentic
- not received RRs do not exist
- all or any received records in a response relate to the request
Applications utilizing DNSSEC generally expect these guarantees to be met, however DNSSEC by itself only guarantees the first two. To meet the third guarantee, resolvers generally follow an (undocumented, as far as RFCs go) algorithm such as: (simplified, e.g. lacks DNSSEC validation!)
- denote by
QNAMEthe name you are querying (e.g. fraunhofer.de.), and initialize a list of aliases - if the ANSWER section contains a valid PTR RRSet for
QNAME, return it (and optionally return the list of aliases as well) - if the ANSWER section contains a valid CNAME RRSet for
QNAME, add it to the list of aliases. SetQNAMEto the CNAME's target and go to 2. - Verify that
QNAMEdoes not have any PTR, CNAME and DNAME records using valid NSEC or NSEC3 records. Returnnull.
Note that this algorithm relies on NSEC records and thus requires a considerable portion of the DNSSEC specifications to be implemented. For this reason, it cannot be performed by a DNS client (aka application) and is typically performed as part of the resolver logic.
dnsjava does not implement a comparable algorithm, and the provided APIs instead return either
- the received DNS message itself (e.g. when using a ValidatingResolver such as in this example), or
- essentially just the contents of its ANSWER section (e.g. when using a LookupSession such as in this example)
If applications blindly filter the received results for RRs of the desired record type (as seems to be typical usage for dnsjava), a rogue recursive resolver or (on UDP/TCP connections) a network attacker can
- In addition to the actual DNS response, add RRs irrelevant to the query but of the right datatype, e.g. from another zone, as long as that zone is correctly using DNSSEC, or
- completely exchange the relevant response records
Impact
DNS(SEC) libraries are usually used as part of a larger security framework. Therefore, the main misuses of this vulnerability concern application code, which might take the returned records as authentic answers to the request. Here are three concrete examples of where this might be detrimental:
- RFC 6186 specifies that to connect to an IMAP server for a user, a mail user agent should retrieve certain SRV records and send the user's credentials to the specified servers. Exchanging the SRV records can be a tool to redirect the credentials.
- When delivering mail via SMTP, MX records determine where to deliver the mails to. Exchanging the MX records might lead to information disclosure. Additionally, an exchange of TLSA records might allow attackers to intercept TLS traffic.
- Some research projects like LIGHTest are trying to manage CA trust stores via URI and SMIMEA records in the DNS. Exchanging these allows manipulating the root of trust for dependent applications.
Mitigations
At this point, the following mitigations are recommended:
- When using a ValidatingResolver, ignore any Server indications of whether or not data was available (e.g. NXDOMAIN, NODATA, ...).
- For APIs returning RRs from DNS responses, filter the RRs using an algorithm such as the one above. This includes e.g.
LookupSession.lookupAsync. - Remove APIs dealing with raw DNS messages from the examples section or place a noticable warning above.
- Record
GHSA-cfxw-4h78-h7fw- CVSS 4.0
- 7.0 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L - CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Weakness
- CWE-345, CWE-349
- Updated
- 2026-11-02
OSVOESA-2024-1899
8.9
dnsjava security update
dnsjava is an implementation of DNS in Java. It supports all of the common record types and the DNSSEC types. It can be used for queries, zone transfers, and dynamic updates. It includes a cache which can be used by clients, and a minimal implementation of a server. It supports TSIG authenticated messages, partial DNSSEC verification, and EDNS0. dnsjava provides functionality above and beyond that of the InetAddress class. Since it is written in pure Java, dnsjava is fully threadable, and in many cases is faster than using InetAddress. dnsjava provides both high and low level access to DNS. The high level functions perform queries for records of a given name, type, and class, and return an array of records. There is also a clone of InetAddress, which is even simpler. A cache is used to reduce the number of DNS queries sent. The low level functions allow direct manipulation of dns messages and records, as well as allowing additional resolver properties to be set. A 'dig' clone and a dynamic update program are included, as well as a primary-only server.
Security Fix(es):
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.(CVE-2024-25638)
- Record
OESA-2024-1899- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
OSVUBUNTU-CVE-2024-25638
8.9
dnsjava is an implementation of DNS in Java. Records in DNS replies are not checked for their relevance to the query, allowing an attacker to respond with RRs from different zones. This vulnerability is fixed in 3.6.0.
- Record
UBUNTU-CVE-2024-25638- CVSS 3.1
- 8.9 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:L - Updated
- 2026-11-02
OSVCLSA-2026-1767917313 No score
TuxCare security update for dnsjava:dnsjava (1 CVE)
TuxCare rebuilt dnsjava:dnsjava to address 1 CVE. Fixed in 2.1.7-tuxcare.1.
- Record
CLSA-2026-1767917313- Updated
- 2026-11-02
OSVCLSA-2026-1788349374 No score
TuxCare security update for dnsjava:dnsjava (1 CVE)
TuxCare rebuilt dnsjava:dnsjava to address 1 CVE. Fixed in 3.5.2-tuxcare.1.
- Record
CLSA-2026-1788349374- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
dnsjava:dnsjavaMaven |
before 3.6.0 | 3.6.0 |
dnsjava:dnsjavaTuxCare:Maven |
2.1.7 up to 2.1.7-tuxcare.1 | 2.1.7-tuxcare.1 |
dnsjava:dnsjavaTuxCare:Maven |
3.5.2 up to 3.5.2-tuxcare.1 | 3.5.2-tuxcare.1 |
dnsjavaDebian:12 |
All versions, plus listed versions 2.1.8-23.6.2-13.6.2-23.6.3-1 |
None known |
dnsjavaDebian:13 |
before 3.6.2-1 | 3.6.2-1 |
dnsjavaDebian:14 |
before 3.6.2-1 | 3.6.2-1 |
dnsjava:dnsjavaMaven |
before 3.6.0, plus listed versions 1.2.31.3.22.0.12.0.62.0.7 Show 25 moreShow less2.0.82.1.02.1.12.1.62.1.72.1.82.1.93.0.03.0.0-next.13.0.13.0.23.1.03.2.03.2.13.2.23.3.03.3.13.4.03.4.13.4.23.4.33.5.03.5.13.5.23.5.3 |
3.6.0 |
dnsjavaopenEuler:24.03-LTS |
before 3.5.3-2.oe2403 | 3.5.3-2.oe2403 |
dnsjavaUbuntu:16.04:LTS |
All versions, plus listed versions 2.1.7-0.12.1.7+dfsg-1 |
None known |
dnsjavaUbuntu:18.04:LTS |
All versions, plus listed versions 2.1.8-12.1.8-2 |
None known |
Show 6 moreShow less
| Package | Affected | Fixed |
|---|---|---|
dnsjavaUbuntu:20.04:LTS |
All versions, plus listed versions 2.1.8-2 |
None known |
dnsjavaUbuntu:22.04:LTS |
All versions, plus listed versions 2.1.8-2 |
None known |
dnsjavaUbuntu:24.04:LTS |
All versions, plus listed versions 2.1.8-2 |
None known |
dnsjavaUbuntu:25.10 |
All versions, plus listed versions 3.6.2-2 |
None known |
dnsjavaUbuntu:26.10 |
All versions, plus listed versions 3.6.3-1 |
None known |
dnsjavaUbuntu:26.04:LTS |
All versions, plus listed versions 3.6.2-23.6.3-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-25638 is a high vulnerability (CVSS 8.9) in Dnsjava, published July 22, 2024. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.39%, the 33rd percentile. Fixed in dnsjava:dnsjava 3.6.0.
References
github.com/dnsjava/dnsjava/security/advisories/GHSA-cfxw-4h78-h7fw
github.com/dnsjava/dnsjava/commit/2073a0cdea2c560465f7ac0cc56f202e6fc39705
github.com/dnsjava/dnsjava/commit/bc51df1c455e6c9fb7cbd42fcb6d62d16047818d
nvd.nist.gov/vuln/detail/CVE-2024-25638
github.com/advisories/GHSA-cfxw-4h78-h7fw
github.com/CVEProject/cvelistV5/tree/main/cves/2024/25xxx/CVE-2024-25638.json