Advisory Database
  • Advisories
  • Dependency Scanning
  1. swift
  2. ›
  3. github.com/vapor/vapor
  4. ›
  5. CVE-2024-21631

CVE-2024-21631: Vapor contains an integer overflow in URI leading to potential host spoofing

January 3, 2024 (updated February 9, 2024)

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.

References

  • github.com/advisories/GHSA-r6r4-5pr8-gjcp
  • github.com/vapor/vapor
  • github.com/vapor/vapor/commit/6db3d917b5ce5024a84eb265ef65691383305d70
  • github.com/vapor/vapor/security/advisories/GHSA-r6r4-5pr8-gjcp
  • nvd.nist.gov/vuln/detail/CVE-2024-21631

Detect and mitigate CVE-2024-21631 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 4.90.0

Fixed versions

  • 4.90.0

Solution

Upgrade to version 4.90.0 or above.

Impact 6.5 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-1104: Use of Unmaintained Third Party Components
  • CWE-190: Integer Overflow or Wraparound

Source file

swift/github.com/vapor/vapor/CVE-2024-21631.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:04 +0000.