joi has an uncaught RangeError on deeply nested input through recursive `link()` schemasGHSA-q7cg-457f-vx79
MEDIUMFix: hapijs/joi#3113GHSA-q7cg-457f-vx79 is a medium-severity (CVSS 5.3) CWE-248 vulnerability in joi. A fix is available for joi — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-q7cg-457f-vx79.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-q7cg-457f-vx79 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 395,249 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
joinpmDescription
Impact
Denial of service via untrapped exception in services validating user-supplied JSON / object input with recursive link schemas.
The blast radius depends on how the application invokes joi:
- Highest impact:
validate()called withouttry/catchin a request handler would cause an unhandled exception, potentially crashing the process. - Lower impact:
validateAsync()orvalidate()inside atry/catch, the validation fails, but the error type isRangeErrorrather than a structuredValidationError, complicating error handling.
Patches
Upgrade to version >= 18.2.1.
Workarounds
Try/catch the validation to avoid uncaught exceptions.
References
- Pull request: hapijs/joi#3113
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | joi | ≥ 18.0.0&&< 18.2.1 | 18.2.1npm install joi@18.2.1 |
| 📦npm | joi | all versions | 17.13.4npm install joi@17.13.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for joi, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update joi to 18.2.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-q7cg-457f-vx79 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
A flaw was found in joi, a data validation library for JavaScript. Deeply nested input validated against recursive link() schemas triggers an uncaught RangeError that can crash the process when validate() is called without try/catch, leading to denial of service.
Upgrade to joi 17.13.4 or 18.2.1. As a workaround, wrap validate() calls in try/catch to prevent uncaught exceptions from crashing the process.Source: Red Hat security advisory for GHSA-q7cg-457f-vx79 (CC BY 4.0)
Frequently Asked Questions
Is GHSA-q7cg-457f-vx79 in your dependencies?
Find it across npm, including transitive dependencies.