joi is vulnerable to Prototype Pollution
63
Medium Risk
Joi's message compilation and merging logic in lib/messages.js accepts a message code named __proto__ and assigns it directly onto a plain messages object. Because the assigned value is always wrapped in a Template instance, the inherited __proto__ accessor replaces the object's own prototype instead of creating a property, so every other message code then resolves through that same template. Custom messages passed through .messages(), .prefs(), .validate(), and Joi.extend() can all reach this path in both flat and language-scoped message maps. The fix rejects __proto__ as a message code across all four entry points.
You are affected if you are using a version that falls within the vulnerable range and your application passes externally influenced message codes into .messages(), .prefs(), .validate(), or Joi.extend().
joi is vulnerable to Prototype Pollution in versions 16.0.0 - 17.13.7 and 18.0.0 - 18.2.8.
Upgrade the joi library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.