Medium

Pkg Local Privilege Escalation

  • Disclosed: 09.02.2024
  • Updated: 11.10.2026 10:22

Impact

Any native code packages built by pkg are written to a hardcoded directory. On unix systems, this is /tmp/pkg/* which is a shared directory for all users on the same local system. There is no uniqueness to the package names within this directory, they are predictable.

An attacker who has access to the same local system has the ability to replace the genuine executables in the shared directory with malicious executables of the same name. A user may then run the malicious executable without realising it has been modified.

Patches

This package is deprecated. Therefore, there will not be a patch provided for this vulnerability.

Recommended Action:

To check if your executable build by pkg depends on native code and is vulnerable, run the executable and check if /tmp/pkg/ was created.

Users should transition to actively maintained alternatives. We would recommend investigating Node.js 21’s support for single executable applications.

Workarounds

Given the decision to deprecate the pkg package, there are no official workarounds or remediations provided by our team. Users should prioritize migrating to other packages that offer similar functionality with enhanced security.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package pkg <= 5.8.1 no fix

References

CVSS score 6.6/10
CVSS vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
Weakness (CWE)
CWE-276
Platform
npm
Package
pkg
Disclosed
09.02.2024
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-22r3-9w55-cj54 - CC BY 4.0

Vulnerability history: pkg

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

This is the only known vulnerability of this package.

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.