Skip to content
Fencer Vulns
medium 5.9

CVE-2022-24795 json

Buffer Overflow and Integer Overflow in yajl-ruby

published 2022-04-05 4 y ago modified 2026-06-17 4 mo ago also GHSA-jj47-x69x-mxrm , EUVD-2022-1773

cvss
5.9
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
3.4%
EPSS 3.4% chance of exploitation in 30 days, percentile 89%
public exploits
0
none known

Summary

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.

Patch / fix

  • rubygems yajl-ruby 1.4.3
  • yajl-ruby_project yajl-ruby 1.4.2
  • burp Debian 13 3.1.4-2
  • yajl Debian 12 2.1.0-3+deb12u2
  • yajl Debian 14, Debian 13 2.1.0-4
  • ruby-yajl Debian 14, Debian 13, Debian 12 1.4.3-1
  • r-cran-jsonlite Debian 14, Debian 13 1.8.8+dfsg-1

debian advisories DEBIAN-CVE-2022-24795

  • yajl Ubuntu 20.04 LTS 2.1.0-3ubuntu0.20.04.1
  • yajl Ubuntu 22.04 LTS 2.1.0-3ubuntu0.22.04.1
  • yajl Ubuntu Pro 14.04 LTS 2.0.4-4ubuntu0.1~esm1
  • yajl Ubuntu Pro 16.04 LTS 2.1.0-2ubuntu0.16.04.1~esm1
  • yajl Ubuntu Pro 18.04 LTS 2.1.0-2ubuntu0.18.04.1~esm1

ubuntu advisories UBUNTU-CVE-2022-24795

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • yajl RHEL 9 2.1.0-21.el9
  • yajl RHEL 8 2.1.0-11.el8
  • yajl RHEL 8.6 EUS 2.1.0-13.el8_6

red hat advisories RHSA-2024:2063RHSA-2022:8252RHSA-2022:7524

  • libyajl SLE Module for Basesystem 15 SP4, SLE Module for Basesystem 15 SP3, SLE Micro 5.2 +4 more 2.1.0-150000.4.3.1
  • libyajl SLES for SAP 12 SP5, SLES 12 SP5, SLE Software Development Kit 12 SP5 2.0.1-18.7.1
  • rubygem-yajl-ruby OpenStack Cloud Crowbar 9, OpenStack Cloud Crowbar 8 1.3.1-4.6.1

suse advisories SUSE-SU-2022:3162-1SUSE-SU-2022:1746-1SUSE-SU-2022:1918-1

  • yajl AlmaLinux 9 2.1.0-21.el9
  • yajl AlmaLinux 8 2.1.0-11.el8

almalinux advisories ALSA-2022:8252ALSA-2022:7524

  • yajl Rocky Linux 9 2.1.0-21.el9
  • yajl Rocky Linux 9 2.1.0-21.el9_0
  • yajl Rocky Linux 8 2.1.0-11.el8

rocky linux advisories RLSA-2022:8252RLSA-2022:7524

  • rubygem-yajl-ruby CBL-Mariner 2.0 1.3.1-2
  • rubygem-yajl-ruby Azure Linux 3.0 1.4.3-1

azure linux advisories AZL-10552AZL-35233

Azure Linux vulnerability data, Copyright (c) Microsoft Corporation, from https://github.com/microsoft/AzureLinuxVulnerabilityData via OSV, under the MIT licence; changed: normalised to fixed package versions per release. MIT

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2022-24795 updated cvss 5.9

yajl: heap-based buffer overflow when handling large inputs due to an integer overflow

  • Red Hat Enterprise Linux 6 yajl Red Hat Enterprise Linux 7 yajl Red Hat Enterprise Linux 8 yajl
    affected: workaround, no fix planned “Avoid passing large inputs to the YAJL library.”
  • Red Hat Enterprise Linux 9 yajl
    affected: workaround, no fix available “Avoid passing large inputs to the YAJL library.”
  • Red Hat OpenShift Container Platform 3.11 rubygem-yajl-ruby
    affected: workaround, no fix planned “Avoid passing large inputs to the YAJL library.”
  • Red Hat CodeReady Linux Builder (v. 8) yajl-devel 2.1.0-11.el8, yajl-debuginfo 2.1.0-11.el8, yajl-debugsource 2.1.0-11.el8
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2022:7524
  • Red Hat CodeReady Linux Builder (v. 9) yajl-devel 2.1.0-21.el9, yajl-debuginfo 2.1.0-21.el9, yajl-debugsource 2.1.0-21.el9
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2022:8252
  • Red Hat CodeReady Linux Builder EUS (v.8.6) yajl-devel 2.1.0-13.el8_6, yajl-debuginfo 2.1.0-13.el8_6, yajl-debugsource 2.1.0-13.el8_6
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2024:2063
  • Red Hat Enterprise Linux AppStream (v. 8) yajl 2.1.0-11.el8
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2022:7524
  • Red Hat Enterprise Linux AppStream (v. 9) yajl 2.1.0-21.el9
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2022:8252
show 1 more
  • Red Hat Enterprise Linux AppStream EUS (v.8.6) yajl 2.1.0-13.el8_6
    fixed: vendor fix “Avoid passing large inputs to the YAJL library.” RHSA-2024:2063

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
Proof of concept is public
Automatable
no
Technical impact
partial
Assessed
18 mo ago

Exploit prediction

3.44% chance of exploitation in the next 30 days, higher than 89% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com https://github.com/brianmario/yajl-ruby/security/advisories/GHSA-jj47-x69x-mxrm referenced PoC, tagged "exploit" by a source, unverified
  • github.com https://github.com/brianmario/yajl-ruby/blob/7168bd79b888900aa94523301126f968a93eb3a6/ext/yajl/yajl_buf.c#L64 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
CNA 3.1 5.9 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD 2.0 5.0 AV:N/AC:L/Au:N/C:P/I:N/A:N
GitHub 3.1 5.9 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected packages

ecosystem package affected fixed in
rubygems yajl-ruby
<1.4.3
1.4.3

Affected products

  • brianmario yajl-ruby

Classification

Weakness
  • CWE-122 Heap-based Buffer Overflow
  • CWE-190 Integer Overflow or Wraparound

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.