# CVE-2023-4316: Zod email validation regular expression denial of service

Source: https://junglewise.ai/threats/cve-2023-4316-zod-email-validation-regular-expression-denial-of-service  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2023-09-28. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2023-4316 · Severity: low · CVSS 3.1 · Published 2023-09-28

Zod is a popular data validation library for JavaScript/TypeScript applications. The email validation function uses a regular expression vulnerable to ReDoS (Regular Expression Denial of Service), allowing an attacker to cause excessive CPU consumption and application hang by providing a maliciously crafted email string during validation.

## Quick answers

**Is CVE-2023-4316 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2023-4316 being exploited in the wild.

**How severe is CVE-2023-4316?** Low severity, with a CVSS score of 3.1, published 28 September 2023.

**Which products and versions are affected?** Zod SEMVER:introduced=0,fixed=3.22.3.

**Is there a fix for CVE-2023-4316?** Yes. Zod: upgrade to 3.22.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2023-4316 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2023-4316?** Check whether you run Zod at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- Zod: upgrade to 3.22.3 or later

## Technical details

The vulnerability is a ReDoS (Regular Expression Denial of Service) flaw in the email validation regex pattern. The complex email regex contains nested quantifiers that cause catastrophic backtracking when processing certain input patterns, leading to exponential time complexity. An unauthenticated network attacker can trigger the vulnerability by submitting a specially crafted email string to any application using Zod's z.string().email() validator, causing the validation to hang and consume CPU resources. The vulnerability affects Zod versions up to 3.22.2 and was fixed in version 3.22.3 by replacing the vulnerable regex with a safer implementation.

## Affected products

- Colinhacks Zod up to 3.22.2

## Identifiers

- CVE-2023-4316
- GHSA-m95q-7qp3-xv42

## Timeline

- 2023-07-26: disclosed: Issue reported on GitHub
- 2023-09-28: advisory: GHSA and CVE advisory published
- 2023-09-28: patched: Fix released in version 3.22.3

## References

- [https://github.com/colinhacks/zod/issues/2609](https://github.com/colinhacks/zod/issues/2609)

## Related threats

- [Zod schema-validation library uncontrolled resource consumption](https://junglewise.ai/threats/cve-2023-54404-zod-schema-validation-library-through-4-6-5-contains-an)
