Skip to content

Pre-Auth Arbitrary File Upload

Critical
robinshine published GHSA-62m2-38q5-96w9 Jan 11, 2021

Package

No package listed

Affected versions

<4.0.2

Patched versions

4.0.3

Description

Impact

AttachmentUploadServlet also saves user controlled data (request.getInputStream()) to a user specified location (request.getHeader("File-Name")):

String fileName = URLDecoder.decode(request.getHeader("File-Name"), StandardCharsets.UTF_8.name());
...
String attachmentName = attachmentSuppport.saveAttachment(fileName, request.getInputStream());

This file system operation occurs before any authentication or authorization checks are enforced.

This issue may lead to arbitrary file upload which can be used to upload a WebShell to OneDev server

Patches

This issue is addressed in 4.0.3 by only allowing uploaded file to be in attachments folder. The webshell issue is not possible as OneDev never executes files in attachments folder.

Credits

This issue was discovered by @pwntester

Severity

Critical

CVE ID

CVE-2021-21245

Weaknesses

No CWEs