CVE-2022-31005: Vapor vulnerable to denial of service in HTTP Range Request of FileMiddleware
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.63056%
CWE
Published
6/7/2023
Updated
6/19/2023
KEV Status
No
Technology
Swift
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| github.com/vapor/vapor | swift | < 4.60.3 | 4.60.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the unvalidated handling of HTTP Range headers in FileMiddleware's range processing. The pre-patch version of asByteBufferBounds: 1) Didn't validate start/end positions against file size 2) Allowed negative values 3) Calculated 'end - start + 1' without overflow checks. The commit adds multiple guard clauses and overflow detection, confirming this was the vulnerable area. The test cases added in FileTests.swift specifically target this function's edge cases, and the CWE-190 classification directly maps to the integer overflow in range calculation.