{"id":"CVE-2024-21631","published":"2024-01-03T16:55:02Z","modified":"2024-09-18T17:28:33Z","title":"Integer overflow in URI leading to potential host spoofing","vendor":"vapor","product":"vapor","tier":"tail","description":{"text":"Vapor is an HTTP web framework for Swift. Prior to version 4.90.0, 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 behavior 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. Version 4.90.0 contains a patch for this issue. As a workaround, validate user input before parsing as a URI or, if possible, use Foundation's `URL` and `URLComponents` utilities.\n","provenance":"source","from":"CVE.org"},"cvss":{"score":6.5,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0085,"percentile":0.55593,"provenance":"source"},"cwes":[{"id":"CWE-20","name":"Improper Input Validation"},{"id":"CWE-190","name":"Integer Overflow or Wraparound"},{"id":"CWE-1104","name":"Use of Unmaintained Third Party Components"}],"references":[{"url":"https://github.com/vapor/vapor/security/advisories/GHSA-r6r4-5pr8-gjcp","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/vapor/vapor/commit/6db3d917b5ce5024a84eb265ef65691383305d70","tags":["x_refsource_MISC"]}],"priority":{"score":15.7,"factors":[{"name":"EPSS percentile","points":11.12},{"name":"CVSS severity","points":4.55}]},"vendorSlug":"vapor","affectedVersions":[{"vendor":"vapor","product":"vapor","versions":["< 4.90.0"]}],"ssvc":{"exploitation":"none","automatable":"yes","technicalImpact":"partial","timestamp":"2024-01-03T19:21:44.394603Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"SwiftURL","package":"github.com/vapor/vapor","vulnerableRanges":["<4.90.0"],"patched":["4.90.0"],"from":["GHSA-r6r4-5pr8-gjcp"],"provenance":"source"}],"summary":{"text":"The Vapor web framework's vapor_urlparser_parse function in the URI type (versions before 4.90.0) uses 16-bit indexes when parsing URI components, so untrusted input can trigger integer overflows. An attacker who can supply a URL to an application that relies on the URI type for validation can, by padding the port number with zeros, cause the authority to be misparsed and spoof the host, which requires the application to accept that URL and pass it onward, such as to the HTTP Client.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:36:20Z"},"euvd":{"id":"EUVD-2024-0412","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2022-31005","published":"2022-05-31","fixed":"4.60.3","kev":false},{"cve":"CVE-2022-31019","published":"2022-06-06","fixed":"4.61.1","kev":false},{"cve":"CVE-2023-44386","published":"2023-10-05","fixed":"4.84.2","kev":false,"link":{"from":"CVE-2023-44386","to":"CVE-2024-21631","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"SwiftURL:github.com/vapor/vapor","fromFixed":"4.84.2","toFixed":"4.90.0","daysApart":90}]}},{"cve":"CVE-2024-21631","published":"2024-01-03","fixed":"4.90.0","kev":false}],"package":"SwiftURL:github.com/vapor/vapor"}}