{"id":"CVE-2023-54404","kind":"vulnerability","aliases":["CVE-2023-54404","GHSA-mrhx-c7xc-m3w5"],"related":[],"title":"Zod can exhaust memory while validating oversized constrained collections","description":"Zod schema-validation library contains an uncontrolled resource consumption vulnerability that allows attackers to exhaust memory by submitting a large array, set or map to an application that uses a container schema without an explicit size constraint. The handleArrayResult parse logic in $ZodArray (and the equivalent set and map paths) accumulates every validation issue for each failing element with no cap or early termination, causing the process to allocate one issue object per element and crash under out-of-memory conditions. This is reachable in the default configuration whenever a container schema such as z.array() is declared without a size bound. The upstream change in commit e06a510 (pull request 6652, first released in 4.6.6) only moves the .max(), .length() and .size() size checks to run before element parsing, so it rejects oversized input for schemas that declare an explicit upper bound; per the maintainer, unbounded containers are unchanged. No released version remediates the unbounded (default) case described here, and an opt-in setting to cap total accumulated errors was proposed but not merged.","summary":"Zod, a TypeScript schema-validation library, accumulates every validation issue for each failing element of an array with no cap, so a large array of bad items makes memory use grow without bound. An attacker who can submit such a payload to an app that validates it with an uncapped array schema can crash the process with an out-of-memory error.","severity":"high","cvss":8.2,"epss":0.0035000001080334187,"exploited":false,"exploited_at":null,"products":[{"name":"zod","fixed":["4.6.6"],"affected":"< 4.6.6","ecosystem":"npm"}],"ecosystems":["npm"],"tags":["cwe-770","node","npm","package","typescript","zod"],"not_affected_if":["array-schemas-have-max-length","no-untrusted-input","zod-at-4.6.6-or-later"],"how_to_check":"Check the installed zod version with npm ls zod or in package-lock.json; anything below 4.6.6 is affected.\nFind array schemas in the app (z.array) that parse untrusted input and lack a .max() length limit.","fix":"Upgrade zod to 4.6.6 or later.\nUntil then, add .max() length limits to array schemas that parse untrusted input.","status":"open","published_at":"2026-10-01T18:17:11+00:00","first_seen_at":"2026-10-23T19:11:31+00:00","triaged_at":"2026-10-23T19:56:18+00:00","updated_at":"2026-10-23T23:44:52+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-23T19:56:18Z","model":"claude-haiku-5-5","output":{"fix":"Upgrade zod to 4.6.6 or later.\nUntil then, add .max() length limits to array schemas that parse untrusted input.","summary":"Zod, a TypeScript schema-validation library, accumulates every validation issue for each failing element of an array with no cap, so a large array of bad items makes memory use grow without bound. An attacker who can submit such a payload to an app that validates it with an uncapped array schema can crash the process with an out-of-memory error.","category":"package","who_cares":["npm","zod","node","typescript"],"confidence":0.8,"analyst_note":"","how_to_check":"Check the installed zod version with npm ls zod or in package-lock.json; anything below 4.6.6 is affected.\nFind array schemas in the app (z.array) that parse untrusted input and lack a .max() length limit.","needs_analyst":false,"not_affected_if":["zod-at-4.6.6-or-later","no-untrusted-input","array-schemas-have-max-length"],"severity_if_unknown":"unknown"},"cost_usd":0.000598,"input_tokens":2111,"output_tokens":773,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2023':11A,19A '-54404':12A,20A '-770':23B '4.6.6':208C '6652':204C 'accumul':36B,144C,262C 'alloc':162C 'allow':105C 'app':73B 'applic':120C 'array':46B,53B,80B,114C 'attack':64B,106C 'bad':55B 'bound':62B,195C,235C 'c7xc':16A 'cap':49B,154C,260C 'case':250C 'caus':158C 'chang':198C 'check':217C 'collect':9A 'commit':200C 'condit':175C 'configur':182C 'constrain':8A 'constraint':130C 'consumpt':102C 'contain':98C,124C,185C,240C 'crash':83B,169C 'cve':10A,18A 'cwe':22B 'declar':191C,231C 'default':181C,249C 'describ':251C 'e06a510':201C 'earli':156C 'element':43B,151C,167C,221C 'equival':139C 'error':92B,263C 'everi':37B,145C 'exhaust':3A,108C 'explicit':128C,233C 'fail':42B,150C 'first':205C 'ghsa':14A 'ghsa-mrhx-c7xc-m3w5':13A 'grow':60B 'handlearrayresult':132C 'input':227C 'issu':39B,147C,164C 'item':56B 'larg':52B,113C 'length':213C 'librari':35B,97C 'logic':134C 'm3w5':17A 'maintain':238C 'make':57B 'map':117C,142C 'max':212C 'memori':4A,58B,91B,109C,174C 'merg':268C 'move':210C 'mrhx':15A 'node':24B 'npm':25B 'object':165C 'one':163C 'opt':256C 'opt-in':255C 'out-of-memori':88B,171C 'overs':7A,226C 'packag':26B 'pars':133C,222C 'path':143C 'payload':70B 'per':166C,236C 'process':85B,160C 'propos':265C 'pull':202C 'reachabl':178C 'reject':225C 'releas':206C,244C 'remedi':246C 'request':203C 'resourc':101C 'run':219C 'schema':33B,81B,95C,125C,186C,229C 'schema-valid':32B,94C 'set':115C,140C,258C 'size':129C,194C,215C,216C 'submit':67B,111C 'termin':157C 'total':261C 'typescript':27B,31B 'unbound':239C,248C 'uncap':79B 'unchang':242C 'uncontrol':100C 'upper':234C 'upstream':197C 'use':59B,122C 'valid':6A,34B,38B,75B,96C,146C 'version':245C 'vulner':103C 'whenev':183C 'without':61B,126C,192C 'z.array':189C 'zod':1A,21A,28B,29B,93C 'zodarray':136C","nicknames":[],"mitigations":[],"who_affected":null,"tier":null,"verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-01T18:17:11+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-mrhx-c7xc-m3w5","url":"https://github.com/advisories/GHSA-mrhx-c7xc-m3w5","severity":"high","published_at":"2026-10-01T18:32:46+00:00","modified_at":"2026-10-23T18:26:52+00:00","first_seen_at":"2026-10-23T19:11:31+00:00","fetched_at":"2026-10-23T19:11:31+00:00","note":null},{"source":"nvd","external_id":"CVE-2023-54404","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-54404","severity":null,"published_at":"2026-10-01T18:17:11+00:00","modified_at":"2026-10-22T19:17:32+00:00","first_seen_at":"2026-10-23T23:44:52+00:00","fetched_at":"2026-10-23T23:44:52+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}