CVE-2021-41253 Possible heap buffer overflow when using zycore string functions in formatter hooks
Heap buffer overflow in Zydis library allows attackers to corrupt memory via custom formatter hooks using zycore string functions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-41253?
CVE-2021-41253 is a medium-severity memory corruption vulnerability in zyantific zydis, published on 8 Nov 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Zydis is an x86/x86-64 disassembler library. Users of Zydis versions v3.2.0 and older that use the string functions provided in `zycore` in order to append untrusted user data to the formatter buffer within their custom formatter hooks can run into heap buffer overflows. Older versions of Zydis failed to properly initialize the string object within the formatter buffer, forgetting to initialize a few fields, leaving their value to chance. This could then in turn cause zycore functions like `ZyanStringAppend` to make incorrect calculations for the new target size, resulting in heap memory corruption. This does not affect the regular uncustomized Zydis formatter, because Zydis internally doesn't use the string functions in zycore that act upon these fields. However, because the zycore string functions are the intended way to work with the formatter buffer for users of the library that wish to extend the formatter, we still consider this to be a vulnerability in Zydis. This bug is patched starting in version 3.2.1. As a workaround, users may refrain from using zycore string functions in their formatter hooks until updating to a patched version.
Which versions are affected by CVE-2021-41253?
It affects 1 product.
Products include Zyantific Zydis.
How do I fix CVE-2021-41253?
Upgrade to a fixed version.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2021-41253 being exploited?
There is no known exploitation of CVE-2021-41253 in the wild and no public exploit code.
Sources
Also known as DEBIAN-CVE-2021-41253, GHSA-q42v-hv86-3m4g.