CVE-2022-31019 DoS Vulnerability in URLEncodedFormDecoder in Vapor

High 7.5 Published Updated

An attacker can crash the Vapor server by sending a crafted request with deeply nested array structures, causing a stack overflow.

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-31019?

CVE-2022-31019 is a high-severity denial of service vulnerability in vapor, published on 6 Jun 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Vapor is a server-side Swift HTTP web framework. When using automatic content decoding an attacker can craft a request body that can make the server crash with the following request: `curl -d "array[_0][0][array][_0][0][array]$(for f in $(seq 1100); do echo -n '[_0][0][array]'; done)[string][_0]=hello%20world" http://localhost:8080/foo`. The issue is unbounded, attacker controlled stack growth which will at some point lead to a stack overflow and a process crash. This issue has been fixed in version 4.61.1.

Weakness: CWE-674, CWE-120

Which versions are affected by CVE-2022-31019?

2 open source packages ship an affected version, including github.com/vapor/vapor. It affects 1 product.

PackageAffectedFixed in
github.com/vapor/vapor SwiftURLAll versions4.61.1
github.com/vapor/vapor SwiftURLAll versions4.61.1

Products include Vapor Vapor.

How do I fix CVE-2022-31019?

Upgrade github.com/vapor/vapor to 4.61.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-31019 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-31019 exists.

Sources

Also known as GHSA-qvxg-wjxc-r4gg.

Is CVE-2022-31019 in your software?

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

Check your SBOMs for free