-
@robin Actually, I discovered another vulnerability on the same day as my previous report. I hadn't reported it yet because I was too busy with my main job to verify it thoroughly, but since quite some time has passed, I wanted to submit it first.
Please note that the severity/risk level might change. I will verify it and get back to you as soon as possible.
This was tested on version 15.0.6.
-
Thanks for reporting. As you've discovered, this can only called by Administrator when restore a backup or by system when unpacks a plugin (normal user cannot upload plugin). So this will not do any harm to the system, and should not be treated as security vulnerability.
Nevertheless, fixing the zip slip will prevent possible vulnerabilities in future in case it is used to unzip untrusted source by mistake.
-
Thank you. To be honest, I hesitated a lot about whether or not to report this. I submitted it first because I wanted it to be judged from a maintainer's perspective. I hope this could be of even a little help. Thank you.
Best regards, -
Please consider this report as just a minor bug report. Thank you.
-
Name Previous Value Current Value Type
Security Vulnerability
Bug
Affected Versions
empty <= 15.0.6
-
Name Previous Value Current Value Priority
Normal
Minor
-
Previous Value Current Value Security Issue in Bootstrap.unzip
Minor Bug Issue in Bootstrap.unzip
-
Previous Value Current Value true
false
-
Already fixed
-
Previous Value Current Value Open
Closed
| Type |
Bug
|
| Priority |
Minor
|
| Assignee | |
| Affected Versions |
<= 15.0.6
|
| Labels |
No labels
|
Although I withheld the report as it required additional verification, I have not yet been able to proceed due to being occupied with my primary job. Given that significant time has passed since I identified it, I decided to report it first.
Title
Zip Slip in Bootstrap.unzip allows arbitrary file write via crafted ZIP archive
Summary
Bootstrap.unzip()extracts ZIP entries usingnew File(destDir, entry.getName())without any canonical-path validation. A crafted ZIP archive with../sequences in entry names can write files outside the intended destination directory on the OneDev server.RestoreDatabase.java:73) or plugin.zipdeployment. Local network or admin console access required.Bootstrap.unzip()passesZipEntry.getName()directly tonew File(destDir, entryName)(lines 351–363, Bootstrap.java). NogetCanonicalPath().startsWith()guard is present. Entry names containing../../../../etc/cron.d/backdoorresolve outsidedestDirat the OS level.cron.dinjection or overwriting server configuration files.Details
File:
commons-bootstrap/src/main/java/io/onedev/commons/bootstrap/Bootstrap.java, lines 347–369Missing guard:
file.getCanonicalPath().startsWith(destDir.getCanonicalPath() + File.separator).Trigger paths:
RestoreDatabase.java:73— backup restore via CLI/UI.zipdeployment via admin panelPoC
Dynamic verification — exact Bootstrap.unzip replica:
File written 4 directory levels above
destDir.Impact
Any OneDev instance where an administrator performs a backup restore or installs a plugin via ZIP upload. Allows overwrite of arbitrary server-side files at OneDev process privilege, leading to RCE via
cron.d, SSH key injection, or config file tampering.Recommended Fix