← Java / Spring · Contents

JAVA-035 / Advanced

Zip Slip: missing extraction-path validation

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

Why is this a problem?

An archive entry named ../../x.jsp enables writes to arbitrary locations.

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