GNU glibc ARMv7 memcpy() memory corruption vulnerability
The ARMv7 memcpy() implementation in GNU glibc uses signed comparisons on the size_t num parameter, so a negative value is treated as a small positive number. An attacker who can underflow num could cause out-of-bounds writes and potentially remote code execution.
Originally disclosed on Cisco Talos
An exploitable signed comparison vulnerability exists in the ARMv7 memcpy() implementation of GNU glibc. Calling memcpy() (on ARMv7 targets that utilize the GNU glibc implementation) with a negative value for the ‘num’ parameter results in a signed comparison 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 ARMv7 memcpy() implementation uses signed branch instructions (such as bge and blt) when comparing the size_t num parameter, instead of unsigned equivalents.
What the attacker needed
ARMv7 target using GNU glibc; attacker controls memcpy num argument
The fix
The signed branch instructions should be replaced with unsigned equivalents such as bhs/bcs so that the num parameter is always treated as unsigned.
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.
memcpy is a standard function that copies a given number of bytes from one place in memory to another. The number of bytes is supposed to be an unsigned value, meaning it can never be negative. On ARMv7, the code mistakenly treats that number as signed, so a very large value that looks negative is treated as a small positive number, causing the copy to go wrong and possibly overwrite memory it should not.
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.