Overview
This is a heap-based buffer overflow vulnerability in dnsmasq that can cause a denial of service or remote code execution by an attacker. Taking advantage of the lightweight software package, the attacker targets resource constrained routers, firewalls and IoT devices.
Details
A pool of memory that is used for dynamic allocations at runtime is referred to as a heap. The most common way of allocating the dynamic memory is via a routine such as malloc(). When the data stored in the heap is overwritten, it can lead to an overflow. At the very least, this can cause a crash or denial of service. A heap-based buffer overflow attack can also be used to overwrite a pointer. The pointer can be made to point at a malicious code injected by an attacker. In the case of dnsmasq versions prior to 2.78, an attacker sends crafted DNS packets to the device causing the buffer to overflow. This results in a denial of service. Once the buffer is crashed, the attacker intercepts existing connections and runs arbitrary code. Not only does the attack allows malicious code execution, but it also exposes privileged data stored on the device.
Affected Environments
Following devices that use dnsmasq as DHCP and DNS server: Embedded Systems Small servers
Remediation
Update device Firmware containing dnsmasq version 2.78 or later.
Prevention
Run only trusted software on the connected network Use the latest OS on all the connected devices Secure the vulnerable device with a strong password