Lucene search

K
hackeroneDanny_granderH1:362118
HistoryJun 05, 2018 - 3:58 p.m.

Node.js third-party modules: Arbitrary File Write Through Archive Extraction

2018-06-0515:58:26
danny_grander
hackerone.com
69

0.001 Low

EPSS

Percentile

47.6%

I would like to report arbitrary file write vulnerability in adm-zip module
It allows attackers to write arbitrary files when a malicious archive is extracted.
More info here:
https://snyk.io/research/zip-slip-vulnerability
https://github.com/snyk/zip-slip-vulnerability#affected-libraries

Module

module name: adm-zipversion:<0.4.9npm page: https://www.npmjs.com/package/adm-zip

Module Description

ADM-ZIP for NodeJS with added support for electron original-fs
ADM-ZIP is a pure JavaScript implementation for zip data compression for NodeJS.

Module Stats

> Replace stats below with numbers from npmโ€™s module page:

1.5M downloads in the last week

Vulnerability

Vulnerability Description

The vulnerability is a form of directory traversal that can be exploited by extracting files from an archive. The premise of the directory traversal vulnerability is that an attacker can gain access to parts of the file system outside of the target folder in which they should reside. The attacker can then overwrite executable files and either invoke them remotely or wait for the system or user to call them, thus achieving remote command execution on the victimโ€™s machine. The vulnerability can also cause damage by overwriting configuration files or other sensitive resources, and can be exploited on both client (user) machines and servers.

The vulnerability is exploited using a specially crafted archive that holds directory traversal filenames (e.g. โ€ฆ/โ€ฆ/evil.sh). The Zip Slip vulnerability can affect numerous archive formats, including tar, jar, war, cpio, apk, rar and 7z. If youโ€™d like the information on this page in a downloadable technical white paper, click the button below.

More info here:
https://snyk.io/research/zip-slip-vulnerability
https://github.com/snyk/zip-slip-vulnerability

Steps To Reproduce:

Sample files can be found here: https://github.com/snyk/zip-slip-vulnerability/tree/master/archives

Patch

Vulnerability is already fixed in ver 0.4.9.
We opened a fix PR on 23rd of April, https://github.com/cthackers/adm-zip/pull/212

CVE id for the vuln was assigned: CVE-2018-1002204

Supporting Material/References:

There are multiple libraries affected, across different ecosystems.
Full list here: https://github.com/snyk/zip-slip-vulnerability#affected-libraries

https://snyk.io/research/zip-slip-vulnerability
https://github.com/snyk/zip-slip-vulnerability

Wrap up

  • I contacted the maintainer to let them know: Y, and helped fix the issue
  • I opened an issue in the related repository: N

Impact

Writing arbitrary files on the system