Miggo Logo

CVE-2022-31005: Vapor vulnerable to denial of service in HTTP Range Request of FileMiddleware

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.63056%
Published
6/7/2023
Updated
6/19/2023
KEV Status
No
Technology
TechnologySwift

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/vapor/vaporswift< 4.60.34.60.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

V*por is *n *TTP w** *r*m*work *or Swi*t *n* [mi**l*w*r*](*ttps://*o*s.v*por.*o**s/**v*n***/mi**l*w*r*/) is * lo*i* ***in **tw**n t** *li*nt *n* * V*por rout* **n*l*r. [*il*Mi**l*w*r*](*ttps://*o*s.v*por.*o**s/**v*n***/mi**l*w*r*/#*il*-mi**l*w*r*) *n

Reasoning

T** vuln*r**ility st*ms *rom t** unv*li**t** **n*lin* o* *TTP R*n** *****rs in *il*Mi**l*w*r*'s r*n** pro**ssin*. T** pr*-p*t** v*rsion o* *s*yt**u***r*oun*s: *) *i*n't v*li**t* st*rt/*n* positions ***inst *il* siz* *) *llow** n***tiv* v*lu*s *) **l*