Zod can exhaust memory while validating oversized constrained collections

GHSA-mrhx-c7xc-m3w5
OSV

At a glance

Source
OSV
Published
Updated
CVE
CVE-2023-54404
CVSS_V3
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CVSS_V4
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Description

Zod schema-validation library through 4.6.5 contains an uncontrolled resource consumption vulnerability that allows attackers to exhaust memory by submitting a large array to an application using an array schema without a length constraint. Attackers can exploit the handleArrayResult parse logic in $ZodArray, which accumulates every validation issue for each failing element with no cap or early termination, causing the process to allocate excessive issue objects and crash due to out-of-memory conditions.

References

Affected packages

PackageVersions
npm · zodintroduced 0, fixed 4.6.6

Sources

SourceLicence
OSV.devCC-BY 4.0 — GitHub Advisory Database