Skip to content
Path traversal Write-up Intermediate

ZIP It Good: How Unzipping a File Gave Me Shell Access

The upload endpoint accepted ZIP files and extracted them without validating entry paths, allowing a crafted archive to write a PHP shell outside the intended directory. The attacker could then execute commands on the server as the web user.

medium.com

Published on medium.com

Free Link 🎈

Iski, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ZIP extraction routine did not sanitise entry paths, allowing directory traversal during unzip.

Impact

The attacker gained remote code execution as the web server user, could read configuration files and database credentials, and potentially pivot to internal services.

What the attacker needed

Upload endpoint accepts ZIP files; no path sanitisation during extraction

The fix

The vulnerability was fixed by the vendor after responsible disclosure.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A ZIP file can contain file names with '../' sequences that, when extracted, cause files to be written outside the intended folder. This is called Zip Slip. The attacker used it to place a malicious script in a web-accessible directory, then ran commands through it.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.