CVE-2023-4316

7.5 HIGH

📋 TL;DR

Zod versions 3.21.0 through 3.22.3 contain a vulnerability where attackers can cause denial of service by sending specially crafted email addresses during validation. This affects any application using Zod for email validation, particularly web applications and APIs that process user input.

💻 Affected Systems

Products:
  • Zod
Versions: 3.21.0 through 3.22.3
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using Zod's email validation functionality. Applications not validating emails with Zod are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to resource exhaustion, potentially affecting all users of the vulnerable application.

🟠

Likely Case

Degraded performance or temporary service disruption for specific endpoints that validate email addresses.

🟢

If Mitigated

Minimal impact with proper input validation and rate limiting in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending malicious email addresses to validation endpoints. No authentication needed if endpoints are public.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.22.4

Vendor Advisory: https://www.npmjs.com/package/zod

Restart Required: No

Instructions:

1. Update Zod package: npm update zod
2. Verify version: npm list zod
3. Test email validation functionality

🔧 Temporary Workarounds

Input Sanitization

all

Implement custom email validation or sanitization before passing to Zod

Rate Limiting

all

Implement rate limiting on email validation endpoints

🧯 If You Can't Patch

  • Disable email validation functionality if not critical
  • Implement WAF rules to block suspicious email patterns

🔍 How to Verify

Check if Vulnerable:

Check package.json or run: npm list zod | grep zod

Check Version:

npm list zod | grep zod

Verify Fix Applied:

Confirm installed version is 3.22.4 or higher: npm list zod

📡 Detection & Monitoring

Log Indicators:

  • Unusually long email addresses in validation logs
  • High CPU/memory usage on validation endpoints
  • Increased error rates on email validation

Network Indicators:

  • Multiple requests with malformed email addresses from single IP
  • Unusual patterns in email validation API calls

SIEM Query:

source="application_logs" AND ("email validation" OR "zod") AND (error OR timeout OR "high resource")

🔗 References

📤 Share & Export