CVE-2022-25881: Regular Expression Denial of Service in http-cache-semantics
Summary
Your scan reports http-cache-semantics 3.8.1. Fixed in 4.1.1.
CVE-2022-25881: http-cache-semantics vulnerable to Regular Expression Denial of Service. Affects http-cache-semantics versions < 4.1.1. Fixed in 4.1.1. How to fix ↓
Background
The http-cache-semantics package is a library used for managing HTTP cache semantics in Node.js applications. It provides functionality for parsing and generating cache control directives, allowing developers to implement caching strategies. However, versions of the package before 4.1.1 are vulnerable to a Regular Expression Denial of Service (ReDoS) attack. This vulnerability can be exploited by sending malicious request header values to a server that reads the cache policy from the request using this library.
Vulnerability Detail
The vulnerability in http-cache-semantics arises from an inefficient regular expression used for parsing cache control directives. An attacker can craft a specially crafted request header value that triggers a ReDoS attack, causing the server to consume excessive CPU resources and potentially leading to a denial of service. This can impact the availability of the affected server and disrupt its normal operation. The vulnerability has been assigned a CVSS score of 7.5, indicating a high severity.
How To Fix
Latest published version: 4.3.0 as of 22 Oct 2026
npm install http-cache-semantics@4.3.0
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
4.1.1
This is the first release that contains the fix.
npm install http-cache-semantics@4.1.1
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is essential to upgrade to the fixed version of the http-cache-semantics package to address the issue.
Conclusion
The http-cache-semantics package before version 4.1.1 is vulnerable to a Regular Expression Denial of Service (ReDoS) attack. This can lead to a denial of service by consuming excessive CPU resources on the affected server. It is crucial to upgrade to version 4.1.1 or later of the package to mitigate the vulnerability. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for http-cache-semantics →
FAQ
This vulnerability can lead to a denial of service by consuming excessive CPU resources on the affected server, potentially impacting its availability.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and the tool will provide real-time alerts for open-source vulnerabilities.
While there are no known public exploits at the moment, it is crucial to address this vulnerability promptly to prevent potential attacks.
No, the recommended mitigation is to upgrade to the fixed version of the http-cache-semantics package. There are no known workarounds for this vulnerability.
You can find more information about this vulnerability in the GitHub Security Advisory at [link to advisory].
Related vulnerabilities
Recent vulnerabilities recorded for http-cache-semantics.
Follow Vulert in Google
Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.