CVE-2022-24795 Buffer Overflow and Integer Overflow in yajl-ruby

Medium 5.9 Published Updated

Integer overflow in yajl-ruby causes heap corruption and denial of service when processing large inputs, primarily affecting 32-bit systems.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-24795?

CVE-2022-24795 is a medium-severity vulnerability in brianmario yajl-ruby, published on 5 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-190, CWE-122

Which versions are affected by CVE-2022-24795?

2 open source packages ship an affected version, including yajl-ruby. It affects 1 product.

PackageAffectedFixed in
yajl-ruby RubyGemsAll versions1.4.3
yajl-ruby RubyGemsAll versions1.4.3
Linux distribution packages (31)
yajl AlmaLinux:8All versions2.1.0-11.el8
yajl-devel AlmaLinux:8All versions2.1.0-11.el8
yajl AlmaLinux:9All versions2.1.0-21.el9
yajl-devel AlmaLinux:9All versions2.1.0-21.el9
yajl Red Hat:enterprise_linux:8::appstreamAll versions0:2.1.0-11.el8
yajl-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:2.1.0-11.el8
yajl-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:2.1.0-11.el8
yajl-debuginfo Red Hat:enterprise_linux:8::crbAll versions0:2.1.0-11.el8
yajl-debugsource Red Hat:enterprise_linux:8::crbAll versions0:2.1.0-11.el8
yajl-devel Red Hat:enterprise_linux:8::crbAll versions0:2.1.0-11.el8
yajl Red Hat:enterprise_linux:9::appstreamAll versions0:2.1.0-21.el9
yajl-debuginfo Red Hat:enterprise_linux:9::appstreamAll versions0:2.1.0-21.el9
yajl-debugsource Red Hat:enterprise_linux:9::appstreamAll versions0:2.1.0-21.el9
yajl-debuginfo Red Hat:enterprise_linux:9::crbAll versions0:2.1.0-21.el9
yajl-debugsource Red Hat:enterprise_linux:9::crbAll versions0:2.1.0-21.el9
yajl-devel Red Hat:enterprise_linux:9::crbAll versions0:2.1.0-21.el9
yajl Rocky Linux:8All versions0:2.1.0-11.el8
yajl Rocky Linux:9All versions0:2.1.0-21.el9
yajl Rocky Linux:9All versions0:2.1.0-21.el9_0
libyajl SUSE:Linux Enterprise Micro 5.1All versions2.1.0-150000.4.3.1
libyajl SUSE:Linux Enterprise Micro 5.2All versions2.1.0-150000.4.3.1
libyajl SUSE:Linux Enterprise Module for Basesystem 15 SP3All versions2.1.0-150000.4.3.1
libyajl SUSE:Linux Enterprise Module for Basesystem 15 SP4All versions2.1.0-150000.4.3.1
libyajl SUSE:Linux Enterprise Server 12 SP5All versions2.0.1-18.7.1
libyajl SUSE:Linux Enterprise Server for SAP Applications 12 SP5All versions2.0.1-18.7.1
libyajl SUSE:Linux Enterprise Software Development Kit 12 SP5All versions2.0.1-18.7.1
rubygem-yajl-ruby SUSE:OpenStack Cloud Crowbar 8All versions1.3.1-4.6.1
rubygem-yajl-ruby SUSE:OpenStack Cloud Crowbar 9All versions1.3.1-4.6.1
libyajl openSUSE:Leap 15.3All versions2.1.0-150000.4.3.1
libyajl openSUSE:Leap 15.4All versions2.1.0-150000.4.3.1
libyajl openSUSE:Leap Micro 5.2All versions2.1.0-150000.4.3.1

Products include Yajl-Ruby Project Yajl-Ruby.

How do I fix CVE-2022-24795?

Upgrade yajl-ruby to 1.4.3 or later.

Is CVE-2022-24795 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-24795 exists.

Sources

Also known as ALSA-2022:7524, ALSA-2022:8252, AZL-10552, AZL-35233, CLSA-2026-1791550583, DEBIAN-CVE-2022-24795 and 12 more.

Is CVE-2022-24795 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free