Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1xdnhnLXdqeGMtcjRnZ84AAzug

Vapor vulnerable to denial of service in URLEncodedFormDecoder

Vapor is an HTTP web framework for Swift. Vapor versions earlier than 4.61.1 are vulnerable to a denial of service in the URLEncodedFormDecoder.

Impact

When using automatic content decoding, e.g.

app.post("foo") { request -> String in
  let foo = try request.content.decode(Foo.self)
  return "\(foo)"
}

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.

Patches

Fixed in 4.61.1

Workarounds

If you don't need to decode Form URL Encoded data, you can disable the ContentConfiguration so it won't be used. E.g. in configure.swift

var contentConfig = ContentConfiguration()
contentConfig.use(encoder: JSONEncoder.custom(dates: .iso8601), for: .json)
contentConfig.use(decoder: JSONDecoder.custom(dates: .iso8601), for: .json)
contentConfig.use(encoder: JSONEncoder.custom(dates: .iso8601), for: .jsonAPI)
contentConfig.use(decoder: JSONDecoder.custom(dates: .iso8601), for: .jsonAPI)
ContentConfiguration.global = contentConfig

For more information

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-qvxg-wjxc-r4gg
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xdnhnLXdqeGMtcjRnZ84AAzug
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 11 months ago
Updated: 10 months ago


CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Identifiers: GHSA-qvxg-wjxc-r4gg, CVE-2022-31019
References: Repository: https://github.com/vapor/vapor
Blast Radius: 21.8

Affected Packages

swift:github.com/vapor/vapor
Dependent packages: 105
Dependent repositories: 796
Downloads:
Affected Version Ranges: < 4.61.1
Fixed in: 4.61.1
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.6.0, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.13.0, 0.14.0, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.1.9, 1.1.10, 1.1.11, 1.1.12, 1.1.13, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11, 4.48.5, 4.48.6, 4.48.7, 4.48.8, 4.49.0, 4.49.1, 4.49.2, 4.50.0, 4.51.0, 4.51.1, 4.52.0, 4.52.1, 4.52.2, 4.52.3, 4.52.4, 4.52.5, 4.53.0, 4.54.0, 4.54.1, 4.54.2, 4.55.0, 4.55.1, 4.55.2, 4.55.3, 4.55.4, 4.56.0, 4.57.0, 4.57.1, 4.58.0, 4.59.0, 4.59.1, 4.60.0, 4.60.1, 4.60.2, 4.60.3, 4.61.0
All unaffected versions: 4.61.1, 4.62.0, 4.62.1, 4.62.2, 4.63.0, 4.64.0, 4.65.0, 4.65.1, 4.65.2, 4.66.0, 4.66.1, 4.67.0, 4.67.1, 4.67.2, 4.67.3, 4.67.4, 4.67.5, 4.68.0, 4.69.0, 4.69.1, 4.69.2, 4.70.0, 4.71.0, 4.71.1, 4.72.0, 4.72.1, 4.73.0, 4.74.0, 4.74.1, 4.74.2, 4.75.0, 4.75.1, 4.75.2, 4.76.0, 4.76.1, 4.76.2, 4.76.3, 4.76.4, 4.77.0, 4.77.1, 4.77.2, 4.78.0, 4.78.1, 4.78.2, 4.79.0, 4.80.0, 4.81.0, 4.81.1, 4.82.0, 4.83.0, 4.83.1, 4.83.2, 4.84.0, 4.84.1, 4.84.2, 4.84.3, 4.84.4, 4.84.5, 4.84.6, 4.85.0, 4.85.1, 4.86.0, 4.86.1, 4.86.2, 4.87.0, 4.87.1, 4.88.0, 4.89.0, 4.89.1, 4.89.2, 4.89.3, 4.90.0, 4.91.0, 4.91.1, 4.92.0, 4.92.1, 4.92.2, 4.92.3, 4.92.4, 4.92.5, 4.92.6, 4.92.7, 4.92.8, 4.92.9, 4.93.0, 4.93.1, 4.93.2, 4.94.0, 4.94.1