Zip It And Rip It How Unvalidated Uploads Turned Into Full Server Access Via Zip Slip
An unauthenticated file upload endpoint extracted ZIP archives without validating entry paths, allowing an attacker to write a PHP web shell outside the upload directory. The attacker then executed commands on the server and escalated to production SSH access using exposed credentials.
Free Link 🎈
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
Impact
An attacker could execute arbitrary commands on the server and escalate to production SSH access, potentially compromising the entire system.
What the attacker needed
No authentication required; Endpoint accepts ZIP files; Server extracts ZIPs without path validation
The fix
The upload endpoint should validate and sanitise ZIP entry paths to prevent directory traversal, and extracted files should be stored outside the web root with restricted permissions.
How it was found
- Discover the upload endpoint via subdomain enumeration and wayback data.
- Upload a ZIP file containing a PHP shell with a path traversal filename.
- Access the uploaded shell via a crafted URL to execute commands.
- Explore the filesystem and find .env files with database credentials and a hardcoded SSH private key.
- Use the SSH key to log in to the production server.
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 files with names that include folder navigation like '../', which means 'go up one folder'. If a server extracts such a ZIP without checking these names, files can be written outside the intended folder. Here, the attacker placed a malicious script in the web server's root, allowing them to run commands on the server.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.