CVE-2024-21631
Swift vulnerability analysis and mitigation

Overview

CVE-2024-21631 affects Vapor, an HTTP web framework for Swift, in versions prior to 4.90.0. The vulnerability exists in the vapor_urlparser_parse function which uses uint16_t indexes when parsing URI components, potentially causing integer overflows when processing untrusted inputs (Vendor Advisory).

Technical details

The vulnerability stems from the use of 16-bit integers (uint16_t) for string range indexing in URI parsing. When parsing abnormally long URLs, particularly in the port number section, the integer overflow can occur during URL authority parsing. The vulnerability has been assigned a CVSS v3.1 base score of 6.5 (Medium) with the vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N (NVD).

Impact

While this vulnerability doesn't directly affect Vapor's core functionality, it can impact applications that rely on the URI type for validating user input. An attacker could potentially exploit this vulnerability to trick an application into accepting URLs to untrusted destinations through host spoofing. This is achieved by manipulating port numbers with padding zeros to trigger integer overflow during URL authority parsing (Vendor Advisory).

Mitigation and workarounds

The vulnerability has been patched in Vapor version 4.90.0. For users unable to update immediately, two workarounds are recommended: 1) Validate user input before parsing as a URI, or 2) Use Foundation's URL and URLComponents utilities instead of Vapor's URI parser (Vendor Advisory).

Additional resources


SourceThis report was generated using AI

Related Swift vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-54951CRITICAL9.8
  • JavaJava
  • executorch
NoYesAug 07, 2025
CVE-2025-54950CRITICAL9.8
  • JavaJava
  • org.pytorch:executorch-android
NoYesAug 07, 2025
GHSA-88q6-jcjg-hvmwHIGH8.8
  • SwiftSwift
  • github.com/beatt83/jose-swift
NoNoJan 09, 2026
GHSA-xvr7-p2c6-j83wMEDIUM6.3
  • SwiftSwift
  • SwiftNIOHPACK
NoYesAug 13, 2025
GHSA-pc9j-5v36-2mwwLOW3.7
  • SwiftSwift
  • github.com/awslabs/aws-sdk-swift
NoYesJan 08, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management