CVE-2022-21221 Directory Traversal

Medium 5.9 Published Updated

Attackers can read arbitrary files on Windows systems via directory traversal in the fasthttp library's ServeFile function.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-21221?

CVE-2022-21221 is a medium-severity path traversal vulnerability in github.com/valyala/fasthttp, published on 17 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

The package github.com/valyala/fasthttp before 1.34.0 are vulnerable to Directory Traversal via the ServeFile function, due to improper sanitization. It is possible to be exploited by using a backslash %5c character in the path. **Note:** This security issue impacts Windows users only.

Weakness: CWE-22

Which versions are affected by CVE-2022-21221?

3 open source packages ship an affected version, including github.com/valyala/fasthttp. It affects 1 product.

PackageAffectedFixed in
github.com/valyala/fasthttp GoAll versions1.34.0
github.com/valyala/fasthttp GoAll versions1.34.0
github.com/valyala/fasthttp GoAll versions1.34.0

Products include Fasthttp Project Fasthttp.

How do I fix CVE-2022-21221?

Upgrade github.com/valyala/fasthttp to 1.34.0 or later.

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

Is CVE-2022-21221 being exploited?

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

Sources

Also known as GHSA-fx95-883v-4q4h, GO-2022-0355, SNYK-GOLANG-GITHUBCOMVALYALAFASTHTTP-2407866.

Is CVE-2022-21221 in your software?

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

Check your SBOMs for free