CVE-2024-21631: Github.com/vapor/vapor Vapor Contains An Integer Overflow Vulnerability
MODERATECVE-2024-21631 is a MODERATE (CVSS 6.5) vapor contains an integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Github.com/vapor/vapor libraries in the SwiftURL ecosystem. The issue involves vapor contains an integer overflow in uri leading to potential host spoofing. Remediation is available by upgrading affected packages to version 4.90.0.
CVE-2024-21631 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2024-21631
To remediate this vulnerability, upgrade all affected Github.com/vapor/vapor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/vapor/vapor to 4.90.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/vapor/vapor
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-21631, inspect your project dependencies for Github.com/vapor/vapor:
inspect dependencies for github.com/vapor/vapor
Analyze the terminal output to locate any version of Github.com/vapor/vapor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.90.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Github.com/vapor/vapor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-21631 Affected Github.com/vapor/vapor Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/vapor/vapor
|
SwiftURL |
< 4.90.0
|
4.90.0
|
References
Frequently Asked Questions
What is CVE-2024-21631?
Which Github.com/vapor/vapor versions are affected?
What version fixes CVE-2024-21631?
Is github.com/vapor/vapor affected?
What is the CVSS score of CVE-2024-21631?
What CWE is associated with CVE-2024-21631?
How can I check SwiftURL dependencies for CVE-2024-21631?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r6r4-5pr8-gjcp",
"modified" : "2024-02-09T00:29:14Z",
"published" : "2024-01-03T21:44:35Z",
"aliases" : [ "CVE-2024-21631" ],
"summary" : "Vapor contains an integer overflow in URI leading to potential host spoofing",
"details" : "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.\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's `URL` and `URLComponents` utilities.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "SwiftURL",
"name" : "github.com/vapor/vapor"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.90.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.89.3"
}
} ],
"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"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1104", "CWE-190" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-01-03T21:44:35Z",
"nvd_published_at" : "2024-01-03T17:15:12Z"
}
}