Описание
tmp allows arbitrary temporary file / directory write via symbolic link dir parameter
Summary
tmp@0.2.3 is vulnerable to an Arbitrary temporary file / directory write via symbolic link dir parameter.
Details
According to the documentation there are some conditions that must be held:
Related issue: https://github.com/raszi/node-tmp/issues/207.
The issue occurs because _resolvePath does not properly handle symbolic link when resolving paths:
If the dir parameter points to a symlink that resolves to a folder outside the tmpDir, it's possible to bypass the _assertIsRelative check used in _assertAndSanitizeOptions:
PoC
The following PoC demonstrates how writing a tmp file on a folder outside the tmpDir is possible.
Tested on a Linux machine.
- Setup: create a symbolic link inside the
tmpDirthat points to a directory outside of it
- check the folder is empty:
- run the poc
- the temporary file is created under
$HOME/mydir1(outside thetmpDir):
main.js
A Potential fix could be to call fs.realpathSync (or similar) that resolves also symbolic links.
Impact
Arbitrary temporary file / directory write via symlink
Ссылки
- https://github.com/raszi/node-tmp/security/advisories/GHSA-52f5-9888-hmc6
- https://nvd.nist.gov/vuln/detail/CVE-2025-54798
- https://github.com/raszi/node-tmp/issues/207
- https://github.com/raszi/node-tmp/commit/188b25e529496e37adaf1a1d9dccb40019a08b1b
- https://lists.debian.org/debian-lts-announce/2025/08/msg00007.html
Пакеты
tmp
<= 0.2.3
0.2.4
Связанные уязвимости
tmp is a temporary file and directory creator for node.js. In versions 0.2.3 and below, tmp is vulnerable to an arbitrary temporary file / directory write via symbolic link dir parameter. This is fixed in version 0.2.4.
tmp is a temporary file and directory creator for node.js. In versions 0.2.3 and below, tmp is vulnerable to an arbitrary temporary file / directory write via symbolic link dir parameter. This is fixed in version 0.2.4.
tmp is a temporary file and directory creator for node.js. In versions 0.2.3 and below, tmp is vulnerable to an arbitrary temporary file / directory write via symbolic link dir parameter. This is fixed in version 0.2.4.
tmp is a temporary file and directory creator for node.js. In versions ...