Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

ZIP Slip vulnerability #154

@kukuxumushi

Description

@kukuxumushi

Description

Attackers can create Zip archives that use path traversal to overwrite important files on affected systems, destroying them or replacing them with malicious alternatives or upload a new one with a malicious code.

How to reproduce

  1. Create file with some code, for example:
<?php
phpinfo();
?>
  1. Name it somehow like this "xxxphpinfo.php".
  2. Create a zip archive.
  3. Open zip archive in hex editor. Change xxx to ../ in two places: in the top of the hex and in the bottom.
  4. Pass modified archive to the Ne-Lexa/php-zip extraction function. For example:
Zipper::make('phpinfo.zip')->folder('')->extractTo('uploads/');

I don't have folders in archive, but with and without it works the same.
6) Navigate to ../uploads and execute phpinfo.php.

Possible Solution

Use php zlib or somehow escape ../ characters.

Additional context

More about vulnerability:
https://snyk.io/research/zip-slip-vulnerability
Archive example:
php2.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions