Integer Overflow and Buffer Overflow in Hiredis RESP multi-bulk Parsing
CVE-2021-32765 is a vulnerability in Hiredis, a minimalistic C client library for Redis. The vulnerability arises when parsing RESP multi-bulk (array-like) replies: Hiredis fails to check whether the product of the element count and the size of a redisReply pointer can be represented in SIZE_MAX. If an attacker provides a maliciously crafted or corrupted multi-bulk reply with a large count, this can cause an integer overflow, leading to a short allocation by calloc() and a subsequent buffer overflow when the code writes beyond the allocated memory.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation allows an attacker to trigger a buffer overflow in the client application using Hiredis, potentially leading to remote code execution or denial of service, depending on how memory corruption is leveraged. The vulnerability is exploitable if the attacker can control or inject RESP protocol data processed by Hiredis.
If you can’t patch tonight, do this now.
If updating is not possible, set the 'maxelements' context option in Hiredis to a sufficiently low value to ensure that no integer overflow can occur during multi-bulk reply parsing. This limits the maximum number of elements in a multi-bulk reply and prevents the vulnerable code path from being triggered.
Patch, then assume compromise.
Update Hiredis to a version that includes the fix for this vulnerability, which properly checks for integer overflows before allocating memory for multi-bulk replies. The fix ensures that the allocation size is validated and prevents the buffer overflow condition.
No validated public exploits yet. Hidden: 1 rejected by Mallory's analysis as not a working exploit.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
No public activity tracked yet. Mallory keeps watching.
No public activity observed for this vulnerability.