// For flags

CVE-2022-24795

Buffer Overflow and Integer Overflow in yajl-ruby

Severity Score

7.5
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

2
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

yajl-ruby is a C binding to the YAJL JSON parsing and generation library. The 1.x branch and the 2.x branch of `yajl` contain an integer overflow which leads to subsequent heap memory corruption when dealing with large (~2GB) inputs. The reallocation logic at `yajl_buf.c#L64` may result in the `need` 32bit integer wrapping to 0 when `need` approaches a value of 0x80000000 (i.e. ~2GB of data), which results in a reallocation of buf->alloc into a small heap chunk. These integers are declared as `size_t` in the 2.x branch of `yajl`, which practically prevents the issue from triggering on 64bit platforms, however this does not preclude this issue triggering on 32bit builds on which `size_t` is a 32bit integer. Subsequent population of this under-allocated heap chunk is based on the original buffer size, leading to heap memory corruption. This vulnerability mostly impacts process availability. Maintainers believe exploitation for arbitrary code execution is unlikely. A patch is available and anticipated to be part of yajl-ruby version 1.4.2. As a workaround, avoid passing large inputs to YAJL.

yajl-riuby es un enlace en C a la biblioteca de análisis y generación de JSON YAJL. La rama 1.x y la rama 2.x de yajl contienen un desbordamiento de enteros que conlleva a una posterior corrupción de la memoria de la pila cuando trata con entradas grandes (~2GB). La lógica de reasignación en "yajl_buf.c#L64" puede hacer que el entero de 32 bits "need" sea convertido en 0 cuando "need" es acercado a un valor de 0x80000000 (es decir, ~2GB de datos), lo que resulta en una reasignación de buf-)alloc en un pequeño trozo de pila. Estos enteros están declarados como "size_t" en la rama 2.x de "yajl", lo que prácticamente evita que el problema ses desencadenado en plataformas de 64 bits, sin embargo esto no impide que este problema sea desencadenado en construcciones de 32 bits en las que "size_t" es un entero de 32 bits. El poblamiento posterior de este trozo de pila infra asignado es basado en el tamaño original del buffer, conllevando una corrupción de la memoria de la pila. Esta vulnerabilidad afecta principalmente a la disponibilidad de los procesos. Los mantenedores creen que la explotación para una ejecución de código arbitrario es poco probable. Se presenta un parche disponible y se espera que forme parte de la versión 1.4.2. Como medida de mitigación, evite pasar entradas grandes a YAJL

A flaw was found in the YAJL library in the way it reallocates a memory buffer to store more data. A very large input causes the value used to calculate the buffer size to overflow, resulting in a heap-based buffer overflow.

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
Attack Vector
Network
Attack Complexity
Low
Authentication
None
Confidentiality
Partial
Integrity
None
Availability
None
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2022-02-10 CVE Reserved
  • 2022-04-05 CVE Published
  • 2024-08-03 CVE Updated
  • 2024-08-03 First Exploit
  • 2024-11-09 EPSS Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
CWE
  • CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
  • CWE-122: Heap-based Buffer Overflow
  • CWE-190: Integer Overflow or Wraparound
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Yajl-ruby Project
Search vendor "Yajl-ruby Project"
Yajl-ruby
Search vendor "Yajl-ruby Project" for product "Yajl-ruby"
< 1.4.2
Search vendor "Yajl-ruby Project" for product "Yajl-ruby" and version " < 1.4.2"
ruby
Affected