CVE-2021-21322 Prefix escape
Attackers can bypass proxy prefix restrictions to access unauthorized backend paths, requiring an upgrade to the fastify-http-proxy plugin.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-21322?
CVE-2021-21322 is a critical path traversal vulnerability in fastify-http-proxy, published on 2 Mar 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
fastify-http-proxy is an npm package which is a fastify plugin for proxying your http requests to another server, with hooks. By crafting a specific URL, it is possible to escape the prefix of the proxied backend service. If the base url of the proxied server is `/pub/`, a user expect that accessing `/priv` on the target service would not be possible. In affected versions, it is possible. This is fixed in version 4.3.1.
Weakness: CWE-20
Which versions are affected by CVE-2021-21322?
2 open source packages ship an affected version, including fastify-http-proxy. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
fastify-http-proxy npm | All versions | 4.3.1 |
fastify-http-proxy npm | All versions | 4.3.1 |
Products include Fastify-Http-Proxy Project Fastify-Http-Proxy.
How do I fix CVE-2021-21322?
Upgrade fastify-http-proxy to 4.3.1 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-21322 being exploited?
There is no known exploitation of CVE-2021-21322 in the wild and no public exploit code.
Sources
Also known as GHSA-c4qr-gmr9-v23w.