GHSA-vm64-cfqx-3698

    Dashboard / Vulnerabilities / GHSA-vm64-cfqx-3698

    GHSA-vm64-cfqx-3698

    Published: 10 Feb 2022Last Modified: 8 Nov 2023
    Aliases:

    Summary: Code Injection in jsen

    Details: This affects all versions of package jsen. If an attacker can control the schema file, it could run arbitrary JavaScript code on the victim machine. In the module description and README file there is no mention about the risks of untrusted schema files, so it is assumed that this is applicable. In particular the required field of the schema is not properly sanitized. The resulting string that is build based on the schema definition is then passed to a `Function.apply();`, leading to an Arbitrary Code Execution. ### PoC ```js const jsen = require('jsen'); let schema = JSON.parse( { "type": "object", "properties": { "username": { "type": "string" } }, "required": ["\\"+process.mainModule.require(\'child_process\').execSync(\'touch malicious\')+\\""] } ); const validate = jsen(schema); validate({}); ```

    Affected packages

    Package

    Name: jsen

    Purl: pkg:npm/jsen

    Affected ranges

    Type: SEMVER

    Events:

    Introduced- 0
    Fixed -None

    Affected versions

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High
    GHSA-vm64-cfqx-3698 | CVE-DB