joi has an uncaught RangeError on deeply nested input through recursive `link()` schemas
Affected releases · joi
- 18.x18.0.0 – 18.2.0Fixed in 18.2.1
- 17.x17.1.1 – 17.13.3Fixed in 17.13.4
- 14.x and older0.0.1 – 14.3.1No fix, no longer updated
On 18.x, the newest line:
npm install joi@18.2.1Every release on a timeline
Affected
18.0.0 – 18.2.0
7 releases
Fixed
18.2.1 – 18.3.1
11 releases, latest
Affected
17.1.1 – 17.13.3
37 releases
Fixed
17.13.4 – 17.13.9
6 releases
Affected
14.0.0 – 14.3.1
12 releases
Affected
13.0.0 – 13.7.0
15 releases
Affected
12.0.0 – 12.1.1
2 releases
Affected
11.0.0 – 11.4.0
12 releases
Affected
10.0.0 – 10.6.0
22 releases
Affected
9.0.0 – 9.2.0
8 releases
Affected
8.0.0 – 8.4.2
14 releases
Affected
7.0.0 – 7.3.0
8 releases
Affected
6.0.0 – 6.10.1
29 releases
Affected
5.0.0 – 5.1.0
4 releases
Affected
4.0.0 – 4.9.0
14 releases
Affected
3.0.0 – 3.1.0
2 releases
Affected
2.0.0 – 2.9.0
17 releases
Affected
1.0.0 – 1.2.3
6 releases
Affected
0.0.1 – 0.4.0
30 releases
What happens
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