Code Injection The advisory has been revoked - it doesn't affect any version of package pdfmake  (opens in a new tab)


Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.4% (74th 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 Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-PDFMAKE-3160329
  • published7 Dec 2022
  • disclosed7 Dec 2022
  • creditRyan Finn

Introduced: 7 Dec 2022

CVE-2022-46161  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade pdfmake to version 0.2.7 or higher.

Amendment

This was deemed not a vulnerability.

Overview

pdfmake is a Client/server side PDF printing in pure JavaScript

Affected versions of this package are vulnerable to Code Injection because it contains an unsafe evaluation of user-controlled input in the /pdf endpoint.

Note: Users are affected by this vulnerability only if using the dev-playground component of the library. This component is not bundled in any of the versions available on package managers.

Workaround

Users are advised to restrict access to trusted user input.

PoC

const {execSync} = require('node:child_process');
var out = execSync('cat /etc/passwd');
dd = {
    content: [
        out.toString()
        ]
}