ghsa-r6r4-5pr8-gjcp
Vulnerability from github
Vapor's vapor_urlparser_parse
function uses uint16_t
indexes when parsing a URI's components, which may cause integer overflows when parsing untrusted inputs.
This vulnerability does not affect Vapor directly but could impact applications relying on the URI type for validating user input.
The URI type is used in several places in Vapor. A developer may decide to use URI to represent a URL in their application (especially if that URL is then passed to the HTTP Client) and rely on its public properties and methods. However, URI may fail to properly parse a valid (albeit abnormally long) URL, due to string ranges being converted to 16-bit integers. An attacker may use this behaviour to trick the application into accepting a URL to an untrusted destination.
By padding the port number with zeros, an attacker can cause an integer overflow to occur when the URL authority is parsed and, as a result, spoof the host.
Impact
Users attempting to treat untrusted input as a URI are vulnerable to a host spoofing attack due to an integer overflow.
Workarounds
Validate user input before parsing as a URI or, if possible, use Foundation's URL
and URLComponents
utilities.
{ "affected": [ { "database_specific": { "last_known_affected_version_range": "\u003c= 4.89.3" }, "package": { "ecosystem": "SwiftURL", "name": "github.com/vapor/vapor" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "4.90.0" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2024-21631" ], "database_specific": { "cwe_ids": [ "CWE-1104", "CWE-190" ], "github_reviewed": true, "github_reviewed_at": "2024-01-03T21:44:35Z", "nvd_published_at": "2024-01-03T17:15:12Z", "severity": "MODERATE" }, "details": "Vapor\u0027s `vapor_urlparser_parse` function uses `uint16_t` indexes when parsing a URI\u0027s components, which may cause integer overflows when parsing untrusted inputs.\n\nThis vulnerability does not affect Vapor directly but could impact applications relying on the URI type for validating user input. \n\nThe URI type is used in several places in Vapor. A developer may decide to use URI to represent a URL in their application (especially if that URL is then passed to the HTTP Client) and rely on its public properties and methods. However, URI may fail to properly parse a valid (albeit abnormally long) URL, due to string ranges being converted to 16-bit integers. An attacker may use this behaviour to trick the application into accepting a URL to an untrusted destination.\n\nBy padding the port number with zeros, an attacker can cause an integer overflow to occur when the URL authority is parsed and, as a result, spoof the host.\n\n### Impact\nUsers attempting to treat untrusted input as a URI are vulnerable to a host spoofing attack due to an integer overflow.\n\n### Workarounds\nValidate user input before parsing as a URI or, if possible, use Foundation\u0027s `URL` and `URLComponents` utilities.", "id": "GHSA-r6r4-5pr8-gjcp", "modified": "2024-02-09T00:29:14Z", "published": "2024-01-03T21:44:35Z", "references": [ { "type": "WEB", "url": "https://github.com/vapor/vapor/security/advisories/GHSA-r6r4-5pr8-gjcp" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-21631" }, { "type": "WEB", "url": "https://github.com/vapor/vapor/commit/6db3d917b5ce5024a84eb265ef65691383305d70" }, { "type": "PACKAGE", "url": "https://github.com/vapor/vapor" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N", "type": "CVSS_V3" } ], "summary": "Vapor contains an integer overflow in URI leading to potential host spoofing" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.