CVE-2026-84368: joi: Prototype pollution via a `__proto__` language key in custom messages

Published Sep 1, 2026
·
Updated

Impact An application that passes attacker-controlled data into joi's custom message configuration (messages(), message(), prefs({ messages }), Joi.extend({ messages }) or rule({ message })) lets the attacker write properties onto Object.prototype, where every object in the process then inherits them. A key named proto was treated as a language name, and the code reused the object it found at that key, which resolves to the prototype rather than to a new own property; a key named constructor did the same to the Object function's statics. A consuming application that gates on the mere presence of a property (if (user.isAdmin)) can be made to take the wrong branch for every object it inspects.

This is not reachable from data that joi validates. Custom messages are schema-construction configuration, normally written by the application developer. Exploitation therefore requires an application that feeds untrusted input straight into schema construction.

Patches Upgrade to version 18.2.5 or 17.13.6.

Workarounds Do not pass untrusted input into messages(), message(), prefs({ messages }), Joi.extend({ messages }) or rule({ message }). Or validate that they don't contain any proto or constructor property.

Other sources

Joi 17.13.6 before 17.13.9 and 18.2.5 before 18.3.1 contains a prototype pollution vulnerability in lib/messages.js compile() and merge() that fails to reject a proto language key. Attackers supplying untrusted message configuration via any().messages(), prefs, validate options or Joi.extend can replace the compiled messages prototype, altering or breaking validation error rendering and dependent logic.

— OSV

joi is a schema description language and data validator for JavaScript. From 16.0.0 until 17.13.6 and 18.2.5, the @hapi/joi package through 17.1.1 and the successor joi package contain prototype pollution in lib/messages.js, where exports.compile() and exports.merge() reuse inherited objects for attacker-controlled language keys supplied through messages(), message(), prefs({ messages }), Joi.extend({ messages }), or rule({ message }). A language key named proto writes properties onto Object.prototype, and constructor writes to the Object function's static properties. A consuming application that gates on the presence of an inherited property can take the wrong branch for every inspected object. The flaw is not reachable from data that joi validates and requires an application to feed untrusted input directly into schema-construction configuration. This issue is fixed in joi versions 17.13.6 and 18.2.5; no fixed @hapi/joi version is available.

— MITRE

Affected Software

7 affected componentsFixes available
@hapi joi>=16.0.0<17.13.6
npm/@hapi/joi>=0.0.0<17.1.1
npm/joi>0.0.0<=18.2.5
npm/joi>=18.0.0<18.2.5
18.2.5
npm/@hapi/joi>=16.0.0<=17.1.1
npm/joi>=17.2.0<17.13.6
17.13.6
IBM API Connect V12 OnPrem<=v12.1.0.0 - v12.1.1.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/joi to a version that resolves this vulnerability.

    Fixed in 18.2.5
  2. Upgrade

    Upgrade npm/joi to a version that resolves this vulnerability.

    Fixed in 17.13.6
  3. Upgrade

    Upgrade joi to a version that resolves this vulnerability.

    Fixed in 17.13.6
  4. Upgrade

    Upgrade joi to a version that resolves this vulnerability.

    Fixed in 18.2.5
  5. Compensating control

    Do not pass untrusted input into joi custom message configuration APIs, including messages(), message(), prefs({ messages }), Joi.extend({ messages }), validate options, or rule({ message }); validate configuration objects to ensure they do not contain __proto__ or constructor properties.

Event History

Sep 1, 2026
CVE Published
via MITRE·08:36 PM
Data Sourced
via MITRE·08:36 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:18 PM
DescriptionSeverityWeakness
Sep 8, 2026
Advisory Published
via GitHub·08:55 PM
Data Sourced
via GitHub·08:55 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·08:55 PM
Affected Software
Oct 8, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

Which applications are realistically exposed to this issue?

Applications are exposed only if they pass untrusted input directly into Joi schema-construction message configuration, including messages(), message(), prefs({ messages }), Joi.extend({ messages }), or rule({ message }). Data being validated by Joi does not reach the vulnerable path.

2

What does an attacker need to provide to exploit it?

An attacker needs control over a language key in custom message configuration and must be able to supply a key named __proto__. Exploitation can pollute Object.prototype, potentially causing applications that test inherited properties to take an incorrect branch.

3

Are default Joi configurations affected?

The issue requires attacker-controlled custom message language keys during schema construction. The provided information does not indicate that ordinary validation input or a configuration without untrusted message definitions is affected.

4

What versions should be used to remediate the issue?

Upgrade joi to version 17.13.6 or 18.2.5. No fixed version is available for @hapi/joi.

5

What can be done if upgrading is not immediately possible?

Do not feed untrusted input into Joi custom-message or schema-construction configuration. In particular, prevent attacker-controlled language keys from reaching the listed message configuration APIs.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203