CVE detail
CVE-2009-2958
dnsmasq TFTP NULL Pointer DoS: Patch 2.50 and Harden Exposure
Search another CVE
Summary
CVE-2009-2958 is a medium-severity denial-of-service flaw in dnsmasq's TFTP server. A malformed blksize option in a TFTP read request triggers a NULL pointer dereference, crashing the daemon. Upgrade to 2.50+ and restrict TFTP exposure.
Why exploitable
Why Exploitable?
CVE-2009-2958 is a denial-of-service vulnerability in dnsmasq's TFTP server, triggered by a malformed blksize option in a TFTP read request, causing a NULL pointer dereference and crashing the daemon. The EPSS score is not available, suggesting low or unknown active exploitation. With no CISA KEV listing and no indexed public exploits, the immediate threat is limited. However, organizations should not dismiss it: TFTP services are often exposed internally, and a single unauthenticated request can crash the service, impacting availability. Validate that TFTP is necessary, restrict access to trusted networks, and upgrade to dnsmasq 2.50 or later. Given the age of the CVE, many systems may still run vulnerable versions, so inventory and patch management are critical.
Technical details
Overview
CVE-2009-2958 is a denial-of-service vulnerability in dnsmasq, a lightweight DNS forwarder and DHCP server that also provides a TFTP server when compiled with --enable-tftp. The flaw resides in the tftp_request function in tftp.c and affects versions before 2.50. An unauthenticated remote attacker can crash the dnsmasq daemon by sending a specially crafted TFTP read (RRQ) request containing a malformed blksize option. The vulnerability has a NVD severity of MEDIUM and a CVSS base score of 4.3, but its EPSS percentile of 95.4 indicates a high probability of exploitation in the wild, making it a practical concern for defenders. The issue was disclosed in 2009 and affects multiple Linux distributions, including Debian, Fedora, Gentoo, and Oracle Linux. Security teams running dnsmasq with TFTP enabled should prioritize patching and review their exposure to TFTP services.
Technical details
The root cause is a NULL pointer dereference in the tftp_request function within tftp.c. When processing a TFTP read request (RRQ), dnsmasq parses the blksize option to negotiate the transfer block size. If the option is malformed—for example, containing an invalid or missing value—the code fails to properly validate the parsed data, leading to a NULL pointer being dereferenced. This causes the dnsmasq process to crash, resulting in a denial of service. The vulnerability is classified under CWE-399 (Resource Management Errors), as it involves improper handling of a resource (the option value) leading to a crash. The attack requires no authentication and can be performed remotely over the network. The affected component is the TFTP server, which is only present when dnsmasq is built with --enable-tftp. The trust boundary is the network interface; any client that can reach the TFTP port (default 69) can trigger the crash. The vulnerable versions are all dnsmasq releases prior to 2.50.
Impact
Successful exploitation results in a denial of service: the dnsmasq daemon crashes, disrupting DNS, DHCP, and TFTP services provided by the host. For networks relying on dnsmasq for DHCP or DNS, this can cause widespread connectivity issues, preventing clients from obtaining IP addresses or resolving names. In environments where TFTP is used for network booting (e.g., PXE), the crash halts boot processes, affecting system deployment and recovery operations. The attack is low-complexity and requires only a single malformed packet, making it easy to execute repeatedly. While the confidentiality and integrity of data are not directly compromised, the availability impact is significant for dependent services. Defenders should consider the business exposure: any internet-facing or untrusted network segment with TFTP enabled is at risk. The high EPSS score suggests that attackers are actively scanning for vulnerable instances, increasing the urgency for remediation.
Exploitation steps
Defenders should understand the attack chain to better detect and prevent it. The following steps outline the exploitation process from an attacker's perspective, framed for defensive triage:
- Identify target: Scan for hosts with TFTP service open on UDP port 69, often using tools like Nmap.
- Confirm dnsmasq: Send a benign TFTP RRQ request to verify the service responds and is likely dnsmasq (e.g., via banner or behavior).
- Craft malformed request: Construct a TFTP RRQ packet with a
blksizeoption that has an invalid value (e.g., non-numeric or out-of-range). - Send packet: Transmit the crafted packet to the target's TFTP port.
- Trigger crash: The malformed option causes a NULL pointer dereference, crashing the dnsmasq process.
- Repeat as needed: Re-send the packet to keep the service down or to cause repeated outages.
- Monitor impact: Observe loss of DNS/DHCP/TFTP services, confirming successful denial of service.
Defenders can use this chain to develop detection rules and test their own systems' resilience.
Indicators of compromise
While a crash is a clear indicator, defenders should look for signs of scanning and attempted exploitation. The following IoCs can help detect malicious activity:
- Network logs: Unexpected TFTP RRQ requests to UDP port 69 from external or untrusted IP addresses.
- Packet captures: TFTP packets with malformed
blksizeoptions, such as non-numeric values or values exceeding the maximum allowed (typically 65464). - Service logs: dnsmasq logs showing a crash or segfault, often with messages like "Segmentation fault" or "dnsmasq: failed to bind DHCP server socket" (though the latter is unrelated).
- Process monitoring: The dnsmasq process unexpectedly terminating or restarting repeatedly.
- EDR alerts: Behavioral detection of a process crash due to a signal (e.g., SIGSEGV) in dnsmasq.
- System logs: Kernel messages indicating a segfault in the dnsmasq process (e.g., in
/var/log/messagesordmesg). - Network flow data: Anomalous UDP traffic to port 69 from a single source, especially if repeated.
- Honeypot triggers: If TFTP is exposed as a honeypot, any RRQ with unusual options should be flagged.
Mitigation and workarounds
The primary mitigation is to upgrade dnsmasq to version 2.50 or later, which fixes the NULL pointer dereference. For systems that cannot immediately upgrade, consider the following workarounds:
- Disable TFTP: If TFTP is not essential, disable it by removing
--enable-tftpfrom the build configuration or settingenable-tftpto false in the configuration file. - Restrict access: Use firewall rules to limit TFTP access to trusted networks only. Block UDP port 69 from untrusted sources.
- Run as non-root: Ensure dnsmasq runs with minimal privileges to reduce the impact of a crash (though the crash itself is the DoS).
- Use a wrapper: Implement a supervisor (e.g., systemd) to automatically restart dnsmasq after a crash, minimizing downtime.
- Monitor and alert: Set up monitoring for dnsmasq process crashes and TFTP traffic anomalies.
- Apply vendor patches: Check with your Linux distribution for backported patches if an upgrade is not feasible.
Community reactions
The security community has largely treated CVE-2009-2958 as a straightforward DoS issue. It was disclosed in 2009 and has been referenced in various vulnerability databases and advisories. The high EPSS percentile (95.4) indicates that despite its age, it remains a target for automated scanning and exploitation. Some community discussions highlight the importance of patching legacy services, as many embedded devices and older systems still run vulnerable dnsmasq versions. The lack of a CVSS score above medium reflects the limited impact (only DoS), but the ease of exploitation and the critical role dnsmasq often plays in networks have led to recommendations for prompt patching. Vendors like Debian and Fedora issued security advisories, and the fix was included in subsequent releases.
Additional resources
References
- http://secunia.com/advisories/36563
- http://www.coresecurity.com/content/dnsmasq-vulnerabilities
- http://www.redhat.com/support/errata/RHSA-2009-1238.html
- http://www.securityfocus.com/bid/36120
- http://www.thekelleys.org.uk/dnsmasq/CHANGELOG
- http://www.ubuntu.com/usn/USN-827-1
- https://bugzilla.redhat.com/show_bug.cgi?id=519020
- https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A9816
- https://rhn.redhat.com/errata/RHSA-2010-0095.html
- http://secunia.com/advisories/36563
- http://www.coresecurity.com/content/dnsmasq-vulnerabilities
- http://www.redhat.com/support/errata/RHSA-2009-1238.html
- http://www.securityfocus.com/bid/36120
- http://www.thekelleys.org.uk/dnsmasq/CHANGELOG
- http://www.ubuntu.com/usn/USN-827-1
- https://bugzilla.redhat.com/show_bug.cgi?id=519020
- https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A9816
- https://rhn.redhat.com/errata/RHSA-2010-0095.html
Intelligence is provided for awareness and triage. Validate exposure in your own environment before prioritising remediation.