# Zip Slip meets Artifactory: A Bug Bounty Story

Zip Slip in Artifactory's Bower external-dependency rewrite extracted tar.gz entries with ../ names, letting a deployer write a WAR into Tomcat webapps and get RCE.

- Payout: $5,000
- Severity: critical
- Program: JFrog
- Found by: Egidio Romano
- Disclosed: 2024-06-23
- Write-up quality: 8/10
- Original: https://karmainsecurity.com/zip-slip-meets-artifactory-a-bug-bounty-story
- Library page: https://bugbountylibrary.com/r/blog%3Akarmainsecurity-com-zip-slip-meets-artifactory-a-bug-bounty-story
- Tags: area:web domain:web impact:rce kind:bounty platform:blog sev:critical tech:java technique:chained technique:source-review vuln:file-upload vuln:path-traversal vuln:rce

**Target:** Bower package extraction (BowerExternalDependenciesHandler.copyEntryToFile) in Artifactory <= 7.12.10
**Root cause:** copyEntryToFile concatenates the attacker-controlled archive entry name with the temp directory via new File(tempBowerDirectory, entry.getName()) without validating for ../ traversal, then writes the entry there.
**Steps:**
1. Build rce.war containing WEB-INF/classes/ShellServlet.class (reverse shell servlet).
2. Create rce.tar.gz with Python tarfile adding rce.war under name `../../../../../../../../../../../../../opt/jfrog/artifactory/app/artifactory/tomcat/webapps/rce.war` plus a bower.json with an external dependency.
3. As admin (or user with deploy rights), create Bower local, remote, and virtual repos; enable 'Dependency Rewrite' on the virtual repo.
4. Deploy rce.tar.gz to the Bower virtual repo, then download it to trigger extractBowerPackage().
5. WAR lands in Tomcat webapps and auto-deploys; access `http://[instance]:8081/rce/` to execute the shell.
6. On JFrog Cloud where 8081 is closed, create a Generic Remote Repository with URL `http://0.0.0.0:8081/rce` and click Test to trigger the shell via SSRF.
**How found:** Downloaded and installed Artifactory, reverse-engineered its Java source, and audited archive-extraction code paths; spotted the unvalidated entry.getName() concatenation in the Bower dependency-rewrite handler.
**Exploitation:** Attacker with deploy permission uploads a crafted .tar.gz Bower package whose entry name traverses to the Tomcat webapps dir; downloading the artifact triggers extraction, writing a malicious WAR that Tomcat auto-deploys, yielding a reverse shell as the artifactory user. On cloud, an SSRF via Generic Remote Repository 'Test' reaches localhost:8081 to execute the WAR.
**Escalation:** Chained an SSRF (Generic Remote Repository URL test) to reach the internal Tomcat port 8081 on JFrog Cloud where it wasn't internet-exposed, converting file-write into RCE in the cloud environment.
**Insight:** Package-manager 'dependency rewrite'/proxy features that unpack upstream archives are prime Zip Slip surfaces; check every ArchiveEntry.getName() sink, and remember internal-only ports can be reached via the product's own SSRF-capable 'test connection' features.

