Arbitrary Code Execution Affecting lilconfig package, versions >=3.1.0 <3.1.1


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team

    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-LILCONFIG-6263789
  • published 30 Oct 2024
  • disclosed 22 Feb 2024
  • credit Anton Kastritskiy

How to fix?

Upgrade lilconfig to version 3.1.1 or higher.

Overview

lilconfig is an A zero-dependency alternative to cosmiconfig

Affected versions of this package are vulnerable to Arbitrary Code Execution due to the insecure usage of eval in the dynamicImport function. An attacker can exploit this vulnerability by passing a malicious input through the defaultLoaders function.

PoC

const { defaultLoaders } = require('lilconfig');
const maliciousInput = "'+console.log('hacked!!!')+'";
defaultLoaders[".js"](maliciousInput);

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
9.3 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    High
  • Integrity (VI)
    High
  • Availability (VA)
    High
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None