{"id":"CVE-2022-24795","aliases":["CVE-2022-24795","GHSA-jj47-x69x-mxrm"],"related":[],"kind":"vulnerability","state":"published","title":"Buffer Overflow and Integer Overflow in yajl-ruby","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"_NOTE: A previous patch, 1.4.2, fixed the heap memory issue, but could still lead to a DoS infinite loop. Please update to version 1.4.3_\n\nThe 1.x branch and the 2.x branch of [yajl](https://github.com/lloyd/yajl) contain an integer overflow which leads to subsequent heap memory corruption when dealing with large (~2GB) inputs.\n\n### Details\n\nThe [reallocation logic at yajl_buf.c#L64](https://github.com/brianmario/yajl-ruby/blob/7168bd79b888900aa94523301126f968a93eb3a6/ext/yajl/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.\n\nThese 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.\n\nSubsequent population of this under-allocated heap chunk is based on the original buffer size, leading to heap memory corruption.\n\n### Impact\n\nWe rate this as a moderate severity vulnerability which mostly impacts process availability as we believe exploitation for arbitrary code execution to be unlikely.\n\n### Patches\n\nPatched in yajl-ruby 1.4.3\n\n### Workarounds\n\nAvoid passing large inputs to YAJL\n\n### References\nhttps://github.com/brianmario/yajl-ruby/blob/7168bd79b888900aa94523301126f968a93eb3a6/ext/yajl/yajl_buf.c#L64\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [yajl-ruby](https://github.com/brianmario/yajl-ruby/issues)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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","source":"nvd"}],"published":"2022-04-05T00:00:00.000Z","modified":"2026-06-17T04:32:32.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:N/A:N","score":5,"rating":"MEDIUM"}],"cwes":["CWE-122","CWE-190"],"affected":[{"ranges":[{"version":"<= 1.4.1","status":"affected"}],"vendor":"brianmario","product":"yajl-ruby","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.4.3"}],"ecosystem":"RubyGems","package":"yajl-ruby","purl":"pkg:gem/yajl-ruby","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.4.2"}],"vendor":"yajl-ruby_project","product":"yajl-ruby","cpe":"cpe:2.3:a:yajl-ruby_project:yajl-ruby:*:*:*:*:*:ruby:*:*","source":"nvd"}],"references":[{"url":"https://github.com/brianmario/yajl-ruby/security/advisories/GHSA-jj47-x69x-mxrm","tags":["exploit","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/brianmario/yajl-ruby/commit/7168bd79b888900aa94523301126f968a93eb3a6","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/brianmario/yajl-ruby/blob/7168bd79b888900aa94523301126f968a93eb3a6/ext/yajl/yajl_buf.c#L64","tags":["exploit","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2023/07/msg00013.html","tags":["mailing-list","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KLE3C4CECEJ4EUYI56KXI6OWACWXX7WN/","tags":["vendor-advisory","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YO32YDJ74DADC7CMJNLSLBVWN5EXGF5J/","tags":["vendor-advisory","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2023/08/msg00003.html","tags":["mailing-list","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24795","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/brianmario/yajl-ruby","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/yajl-ruby/CVE-2022-24795.yml","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KLE3C4CECEJ4EUYI56KXI6OWACWXX7WN","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YO32YDJ74DADC7CMJNLSLBVWN5EXGF5J","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:49:09.360Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-24795","url":"https://www.cve.org/CVERecord?id=CVE-2022-24795","licence":"CVE Terms of Use","modified":"2025-04-22T18:17:37.564Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jj47-x69x-mxrm","url":"https://github.com/advisories/GHSA-jj47-x69x-mxrm","licence":"CC-BY-4.0","modified":"2024-02-16T08:22:00.241Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-24795","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24795","licence":"Public domain","modified":"2026-06-17T04:32:32.170Z"}],"updatedAt":"2026-11-25T22:58:10.433Z","epss":{"score":0.03444,"percentile":0.89299,"date":"2026-12-01T12:00:22.000Z"}}