Описание
yyjson has a Double Free vulnerability
Summary
The pool series allocator (pool_malloc/pool_free/pool_realloc) by yysjon has a Double Free vulnerability, which may lead to arbitrary address writing and Denial of Service (DoS) attacks. Arbitrary address writing, combined with other legitimate or illegitimate operations of programs using this library, can lead to remote code execution.
Details
The core cause of this vulnerability lies in the pool_free function's lack of loop checks, while the direct cause stems from the pool_free function and similar free-series functions not performing pointer destruction, resulting in Use-After-Free (UAF) vulnerabilities.
PoC
Below, a C language program using yyjson 0.8.0 is written to show how to exploit a Double Free vulnerability to cause chunk overlaps, which then allows the modification of a chunk's next pointer to point to an arbitrary address. If the targeted address is valid, modifications can be made. However, if the address is invalid, it could lead to the program crashing, which could be exploited for a Denial of Service (DoS) attack. Additionally, constructing a cyclic chain of chunks could force the service into an infinite loop, also exploitable for a DoS attack.
Impact
What kind of vulnerability is it? Who is impacted?
Note from yyjson
yyjson_mut_doc_free() is well-documented: https://github.com/ibireme/yyjson/blob/0.8.0/src/yyjson.h#L2090-L2093
If you have already called yyjson_mut_doc_free() on a doc, the doc and its internal values are invalid. Any further operation on the doc or its values is undefined behavior.
While this is not a bug in yyjson itself, a defensive patch has been provided: 0eca326 If you mistakenly call yyjson_mut_doc_free() twice on the same doc against the documentation, this patch will cause your program to crash immediately, alerting you to the incorrect usage.
Ссылки
- https://github.com/ibireme/yyjson/security/advisories/GHSA-q4m7-9pcm-fpxh
- https://nvd.nist.gov/vuln/detail/CVE-2024-25713
- https://github.com/ibireme/yyjson/commit/0eca326fe57aeeb866e6f04c9ef9ea9f8343157e
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6KQ67T4R7QEWURW5NMCCVLTBASL4ECHE
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NNICQVIF7BRYFWYRL3HPVAJIPXN4OVTX
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TKQPEREDUDKGYJMFNFDQVYCVLWDRO2Y2
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6KQ67T4R7QEWURW5NMCCVLTBASL4ECHE
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NNICQVIF7BRYFWYRL3HPVAJIPXN4OVTX
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TKQPEREDUDKGYJMFNFDQVYCVLWDRO2Y2
Пакеты
github.com/ibireme/yyjson
< 0.9.0
0.9.0
Связанные уязвимости
yyjson through 0.8.0 has a double free, leading to remote code execution in some cases, because the pool_free function lacks loop checks. (pool_free is part of the pool series allocator, along with pool_malloc and pool_realloc.)
yyjson through 0.8.0 has a double free, leading to remote code executi ...