← PHP / Laravel · Contents

PHP-073 / Advanced

Zip Slip: missing path checks during extraction

A01:2021 Broken Access Control · CWE-22 Path Traversal

Why is this a problem?

An archive entry named ../../index.php overwrites the web root.

How to fix it

검토 순서
1. Create a new private directory.
2. Reject absolute paths and links in each entry.
3. Verify that the normalized destination is under the extraction root.
4. Create only new regular files and limit actual bytes written and the file count.

Further reading