STMicroelectronics X-CUBE-AZRTOS-F7 FileX Internal RAM interface buffer overflow vulnerability
The RAM disk driver in STMicroelectronics X-CUBE-AZRTOS packages does not check that the configured total sectors times sector size fits within the allocated RAM disk buffer. An attacker sending crafted HTTP PUT requests to the NetXDuo web server sample could write past the buffer and potentially overwrite a function pointer, leading to code execution.
Originally disclosed on Cisco Talos
A buffer overflow vulnerability exists in the FileX Internal RAM interface functionality of STMicroelectronics X-CUBE-AZRTOS-WL 2.0.0. A specially crafted set of network packets can lead to code execution.
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
Likely the RAM disk driver performs no validation that the configured total sectors multiplied by sector size stays within the size of the buffer supplied at initialisation, so the computed write pointer can fall outside the buffer.
Impact
The overflow could overwrite a function pointer in another object, potentially leading to code execution; the crash trace shows control flow reaching an address built from attacker data.
What the attacker needed
Network access to the HTTP server; application uses RAM disk driver with oversized config
The fix
Developers should ensure that total sectors multiplied by sector size is less than the size of the buffer provided for the RAM disk memory when initialising it; the vendor released a patch.
How it was found
- Initialise the RAM disk with a total sector count and sector size whose product exceeds the allocated buffer size.
- Send an HTTP PUT request to the NetXDuo web server to create a file and write content to it.
- The FileX write path calls the RAM disk driver, which computes a destination pointer beyond the buffer.
- The driver copies the request data with memcpy, overflowing the RAM disk buffer.
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.
A RAM disk is a chunk of memory treated like a small storage drive. The software was told the drive is much bigger than the memory actually reserved for it, and nothing checked this, so writing files to it spills into neighbouring memory. Spilling into memory that holds program pointers can let an attacker redirect execution.
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.