Losant Arduino MQTT Client Stack-based Buffer Overflow Remote Code Execution Vulnerability
The Losant Arduino MQTT client copies the length field of an incoming MQTT PUBLISH packet into a fixed-size stack buffer without checking that it fits. A remote attacker can send a crafted packet to overflow the buffer and run arbitrary code in the context of the process.
Federico "phretor" Maggi Follow
Originally disclosed on Zero Day Initiative
This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of Losant Arduino MQTT Client. User interaction is not required to exploit this vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The client trusts the length field of an incoming MQTT PUBLISH packet and copies that many bytes into a fixed-length stack buffer without bounds checking.
Impact
A remote attacker could execute arbitrary code in the context of the current process, and no user interaction is needed.
What the attacker needed
Network reachability to the MQTT client; no user interaction
The fix
The vendor issued an update that corrects the vulnerability.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a memory bug in a small library that lets an Arduino device talk to an MQTT message broker. When a message arrives, the library reads a length value from the network and copies that much data into a fixed-size space on the stack, a small scratch area for local variables. Because the length is not checked, a sender can write past the end of that space and overwrite nearby memory, which can redirect the program to attacker-chosen code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.