CVE-2022-24795
Buffer Overflow and Integer Overflow in yajl-ruby
Check your servers for CVE-2022-24795
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-24795 affects yajl-ruby, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
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.
Severity (CVSS)
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality none, integrity none, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 3.44%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 89.2% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 22 Apr 2025):
- Exploitation
- poc: a proof of concept is public
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Weakness
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| yajl-ruby |
affected <= 1.4.1
|
Is my server affected?
Find the installed version of yajl-ruby and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i yajl-ruby
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2022-24795 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2022-24795RHEL, Rocky, Alma, Fedora
rpm -q yajl-ruby
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2022-24795Alpine
apk list --installed | grep -i yajl-rubyWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-24795
trivy image --scanners vuln IMAGE | grep CVE-2022-24795
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- FEDORA-2023-00572178e1 lists.fedoraproject.org · vendor advisory
- FEDORA-2023-852b377773 lists.fedoraproject.org · vendor advisory
Other references
- https://github.com/brianmario/yajl-ruby/security/advisories/GHSA-jj47-x69x-mxrm github.com
- https://github.com/brianmario/yajl-ruby/commit/7168bd79b888900aa94523301126f968a93eb3a6 github.com
- https://github.com/brianmario/yajl-ruby/blob/7168bd79b888900aa94523301126f968a93eb3a6/ext/yajl/yajl_buf.c#L64 github.com
- [debian-lts-announce] 20230711 [SECURITY] [DLA 3492-1] yajl security update lists.debian.org · mailing list
- [debian-lts-announce] 20230805 [SECURITY] [DLA 3516-1] burp security update lists.debian.org · mailing list
Source: the record CVE-2022-24795 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse