CVE-2021-2429: A Heap-based Buffer Overflow Bug In The Mysql Innodb Memcached Plugin
A heap-based buffer overflow exists in the MySQL InnoDB memcached plugin's GET command when handling multiple keys of the form @@containers.name. An unauthenticated remote attacker could exploit this to execute arbitrary code on the MySQL server.
In April 2021, the ZDI received a submission of a vulnerability in the MySQL database. It turned out to be a heap-based buffer overflow bug in the InnoDB memcached plugin.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code checks available buffer space only with an assert(), which is compiled out in release builds, so the subsequent memcpy overflows the heap buffer.
What the attacker needed
MySQL built with InnoDB memcached plugin; Network access to memcached port 11211
How it was found
- Build MySQL from source with the InnoDB memcached plugin enabled.
- Ensure the memcached daemon is listening on its default port.
- Send a single GET command containing many keys of the form @@containers.name.
- The plugin replaces each key with a table name, causing a heap overflow in the mysqld process.
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 write-up has not been written yet. The Original tab links to the source.
This is a memory corruption bug in a MySQL plugin that lets you store and retrieve data using a protocol called memcached. When the plugin processes a request with many specially formatted keys, it writes more data into a fixed-size memory buffer than it should, overflowing it. An attacker who can reach the memcached port can send such a request and potentially run their own code on the database server.
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.