Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-32804 PoC — node-tar 路径遍历漏洞

Source
Associated Vulnerability
Title:node-tar 路径遍历漏洞 (CVE-2021-32804)
Description:node-tar是一款用于文件压缩/解压缩的软件包。 node-tar 存在路径遍历漏洞,该漏洞源于绝对路径清理不足而具有任意文件创建/覆盖漏洞。
Readme
# CVE-2021-32804

yamory blog 「[CVE-2021-32804 npmにも影響があるnode-tarのパストラバーサルの脆弱性](https://yamory.io/blog/cve-2021-32804-node-tar-reproduce/)」 で利用したDocker環境の構築を行うためのレポジトリです。

## 環境構築

```
docker build -t cve-2021-32804 .
docker run -it cve-2021-32804 /bin/bash
```

## 脆弱性の再現

### node-tar

```
root@5e1af2148215:/poc# node tar.js
root@5e1af2148215:/poc# su node
Hello, world!
```

### npm

```
root@5e1af2148215:/poc# npm i bashrc.tgz
root@5e1af2148215:/poc# su node
Hello, world!
```

File Snapshot

[4.0K] /data/pocs/9f371460af50b5df1f65aa1214c6f4c23ebbe2bd ├── [ 107] Dockerfile ├── [4.0K] poc │   ├── [ 151] bashrc.tgz │   ├── [4.0K] node_modules │   │   ├── [4.0K] chownr │   │   │   ├── [4.2K] chownr.js │   │   │   ├── [ 765] LICENSE │   │   │   ├── [ 649] package.json │   │   │   └── [ 59] README.md │   │   ├── [4.0K] fs-minipass │   │   │   ├── [9.8K] index.js │   │   │   ├── [ 765] LICENSE │   │   │   ├── [ 865] package.json │   │   │   └── [2.4K] README.md │   │   ├── [4.0K] minipass │   │   │   ├── [ 14K] index.js │   │   │   ├── [ 756] LICENSE │   │   │   ├── [ 808] package.json │   │   │   └── [ 21K] README.md │   │   ├── [4.0K] minizlib │   │   │   ├── [3.7K] constants.js │   │   │   ├── [9.2K] index.js │   │   │   ├── [1.3K] LICENSE │   │   │   ├── [ 907] package.json │   │   │   └── [1.9K] README.md │   │   ├── [4.0K] mkdirp │   │   │   ├── [4.0K] bin │   │   │   │   └── [1.8K] cmd.js │   │   │   ├── [ 448] CHANGELOG.md │   │   │   ├── [1.0K] index.js │   │   │   ├── [4.0K] lib │   │   │   │   ├── [ 763] find-made.js │   │   │   │   ├── [1.6K] mkdirp-manual.js │   │   │   │   ├── [ 969] mkdirp-native.js │   │   │   │   ├── [ 784] opts-arg.js │   │   │   │   ├── [ 730] path-arg.js │   │   │   │   └── [ 448] use-native.js │   │   │   ├── [1.1K] LICENSE │   │   │   ├── [ 804] package.json │   │   │   └── [8.3K] readme.markdown │   │   ├── [4.0K] tar │   │   │   ├── [1.7K] CHANGELOG.md │   │   │   ├── [ 683] index.js │   │   │   ├── [4.0K] lib │   │   │   │   ├── [2.3K] create.js │   │   │   │   ├── [2.7K] extract.js │   │   │   │   ├── [ 921] get-write-flag.js │   │   │   │   ├── [8.8K] header.js │   │   │   │   ├── [ 760] high-level-opt.js │   │   │   │   ├── [2.1K] large-numbers.js │   │   │   │   ├── [3.1K] list.js │   │   │   │   ├── [5.1K] mkdir.js │   │   │   │   ├── [ 619] mode-fix.js │   │   │   │   ├── [9.5K] pack.js │   │   │   │   ├── [ 14K] parse.js │   │   │   │   ├── [3.2K] path-reservations.js │   │   │   │   ├── [3.9K] pax.js │   │   │   │   ├── [2.6K] read-entry.js │   │   │   │   ├── [5.3K] replace.js │   │   │   │   ├── [1.1K] types.js │   │   │   │   ├── [ 18K] unpack.js │   │   │   │   ├── [ 842] update.js │   │   │   │   ├── [ 697] warn-mixin.js │   │   │   │   ├── [ 535] winchars.js │   │   │   │   └── [ 12K] write-entry.js │   │   │   ├── [ 765] LICENSE │   │   │   ├── [1.4K] package.json │   │   │   └── [ 44K] README.md │   │   └── [4.0K] yallist │   │   ├── [ 207] iterator.js │   │   ├── [ 765] LICENSE │   │   ├── [ 652] package.json │   │   ├── [4.6K] README.md │   │   └── [8.2K] yallist.js │   ├── [ 242] package.json │   ├── [4.8K] package-lock.json │   └── [ 60] tar.js └── [ 596] README.md 12 directories, 66 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.