joi denial of service in multiple-email validation
hapijs joi · @hapi joi
hapijs joi · @hapi joi
joi is a schema description language and data validator for JavaScript. From 17.1.1 until 17.13.9 and 18.3.1, the Joi.string().email({ multiple: true }) rule uses a separator regular expression whose leading whitespace quantifier is retried at every position in a long whitespace run that contains no separator, causing quadratic work during String.prototype.split. The behavior applies to the default separator and every custom separator. Applications that validate attacker-controlled values with the multiple option and no effective prior length limit can have the Node.js event loop blocked for seconds by one request, preventing other work. A .max() rule is not sufficient when abortEarly: false allows the email rule to run after the maximum-length check fails. This vulnerability is fixed in versions 17.13.9 and 18.3.1.
From the CVE record · GitHub_M
The Joi.string().email({ multiple: true }) rule can take quadratic time when splitting a long whitespace run with no separator. An attacker can block a Node.js application's event loop with one request if the application validates attacker-controlled values using this rule without an effective prior length limit. A .max() rule does not prevent this when abortEarly: false allows email validation to continue after the length check fails.
Check applications using npm joi versions >=17.1.1 <17.13.9 or >=18.0.0 <18.3.1, or npm @hapi/joi versions >=16.0.0 <=17.1.1.