CVE-2021-21328: Vapor's Metrics integration could cause a system drain
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.62356%
CWE
Published
6/9/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:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
github.com/vapor/vapor | swift | <= 4.40.0 | 4.40.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how metrics were recorded for undefined routes. The unpatched version in DefaultResponder.swift used the actual request path (request.url.path) for metric dimensions when no route was found. This allowed attackers to exhaust system resources by sending requests with unique paths. The patched version introduces path/method normalization to 'vapor_route_undefined' for undefined routes, preventing metric explosion. The commit diff shows critical changes to the metrics handling logic in DefaultResponder's updateMetrics function, confirming this as the vulnerable component.