CVE-2022-25881: Regular Expression Denial of Service in http-cache-semantics

http-cache-semantics Updated 02 Oct 2025

Summary

31/01/2023
Yes i
High
7.5

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 ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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 →

Share this vulnerability

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.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback