NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2024-24828: Pkg Local Privilege Escalation

mediumCVSS 3.1 6.6GHSA-22r3-9w55-cj54

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.

Published Feb 9, 2024 · Updated Feb 12, 2024

Affected packages

pkg

Ecosystem
npm
Affected
<= 5.8.1
Fixed in
No patched version yet
Check
npm ls pkg

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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.

Credited to TomiBelan.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology