Memcached Server Update Remote Code Execution Vulnerability
Integer overflows in the binary protocol's process_bin_update function allow a negative value length, causing a heap buffer overflow when the key is copied. An attacker could send a crafted packet to corrupt heap memory and potentially achieve remote code execution.
Originally disclosed on Cisco Talos
Multiple integer overflows in processbinupdate function which is responsible for processing multiple commands of Memcached binary protocol can be abused to cause heap overflow and lead to remote 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 a signedness mismatch: an unsigned body length minus key and extras lengths is assigned to a signed int, producing a negative value that is then used in memory allocation, leading to a heap overflow.
Impact
The heap overflow could be abused to modify internal slab metadata and cause information leaks, potentially leading to remote code execution.
What the attacker needed
Network access to Memcached binary port; no authentication required
The fix
The vendor patched the vulnerability, likely by correcting the signedness or bounds checks in the binary protocol handling.
How it was found
- Craft a binary protocol packet with extra length 8, key length 0xfa, and body length 0xffffffd0.
- Send the packet to the Memcached server over TCP.
- The server processes the ADD command and calculates a negative value length.
- The negative length causes an undersized allocation, and the key copy overflows the heap 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.
Memcached is a fast in-memory cache used by websites. A flaw in how it handles certain binary commands lets an attacker send a specially crafted request that makes the server miscalculate a size, writing more data than intended into memory. This can crash the server or let the attacker run their own 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.