OSV 1.4.0 · github-reviewed · 修改于 2023-09-12 07:08
发布时间
2022-02-11 04:18
GitHub 审查时间
2021-04-15 03:49
NVD 发布时间
2020-11-24 00:15
源文件
advisories/github-reviewed/2022/02/GHSA-vm64-cfqx-3698/GHSA-vm64-cfqx-3698.json
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.
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({});