Siretta QUARTZ-GOLD m2m DELETE_FILE cmd heap-based buffer overflow vulnerability
The m2m service on the Siretta QUARTZ-GOLD router allocates a heap buffer based on a length field supplied in a UDP packet, then builds a shell command string from the entry data using sprintf, which copies until a null byte. An attacker can send a crafted UDP packet whose declared entry length is smaller than the actual data, overflowing the heap and potentially achieving code execution.
Originally disclosed on Cisco Talos
A heap-based buffer overflow vulnerability exists in the m2m DELETEFILE cmd functionality of Siretta QUARTZ-GOLD G5.0.1.5-210720-141020. A specially-crafted network request can lead to a heap buffer overflow.
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 code allocates the command buffer using the attacker-supplied data_len field but then uses sprintf to copy the entry data as a null-terminated string, so a data_len smaller than the actual string length causes a heap overflow.
Impact
A remote unauthenticated attacker could trigger a heap buffer overflow, leading to memory corruption and potentially arbitrary code execution on the device.
What the attacker needed
M2M feature enabled on the device; Network access to the m2m UDP service; No authentication required
The fix
The buffer should be sized from the actual null-terminated string length (or the copy bounded to the allocated size) rather than the attacker-supplied length field; the vendor released a patch.
How it was found
- Enable the M2M feature so the m2m binary starts and exposes its UDP command service.
- Send a UDP packet in the M2M format with command id 0x15 (DELETE_FILE) containing a data entry.
- Set the entry's data_len field smaller than the actual data string so the allocation is undersized.
- The service allocates the command string, then sprintf copies the longer data past the buffer, causing a heap overflow.
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.
The router runs a small program that listens for special network messages and uses them to delete files. The program reserves a block of memory sized from a number the sender chooses, but then copies in a longer piece of text, so the extra text spills past the block and corrupts nearby memory. Because the copied text also ends up in a shell command, an attacker who controls the message can potentially run their own commands on the device.
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.