CVE-2021-21251 ZipSlip Arbitrary File Upload

High 7.7 Published Updated

Attackers with valid job tokens can exploit a zip slip vulnerability in OneDev to write arbitrary files, potentially leading to code execution.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2021-21251?

CVE-2021-21251 is a high-severity path traversal vulnerability in theonedev onedev, published on 15 Jan 2021. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

OneDev is an all-in-one devops platform. In OneDev before version 4.0.3 there is a critical "zip slip" vulnerability. This issue may lead to arbitrary file write. The KubernetesResource REST endpoint untars user controlled data from the request body using TarUtils. TarUtils is a custom library method leveraging Apache Commons Compress. During the untar process, there are no checks in place to prevent an untarred file from traversing the file system and overriding an existing file. For a successful exploitation, the attacker requires a valid __JobToken__ which may not be possible to get without using any of the other reported vulnerabilities. But this should be considered a vulnerability in `io.onedev.commons.utils.TarUtils` since it lives in a different artifact and can affect other projects using it. This issue was addressed in 4.0.3 by validating paths in tar archive to only allow them to be in specified folder when extracted.

Weakness: CWE-22

Which versions are affected by CVE-2021-21251?

It affects 1 product.

Products include Onedev Project Onedev.

How do I fix CVE-2021-21251?

No fix has been published for CVE-2021-21251 yet. Limit exposure of the affected software until one is available.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2021-21251 being exploited?

There is no known exploitation of CVE-2021-21251 in the wild and no public exploit code.

Sources

Also known as GHSA-2w6j-wc8c-9mq2.

Is CVE-2021-21251 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free