Configuration Override in helmet-csp

helmet-csp Updated 02 Oct 2025

Summary

03/09/2020
MODERATE
Yes i
Moderate
6.5

GHSA-c3m8-x3cg-qm2c: Configuration Override in helmet-csp. Affects helmet-csp versions >= 1.2.2, < 2.9.1. Fixed in 2.9.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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

helmet-csp is an npm package that provides middleware to set the Content Security Policy (CSP) for Express.js applications. CSP is a security mechanism that helps mitigate Cross-Site Scripting (XSS) attacks by defining a set of policies that restrict the types of content that can be loaded by a web page. By setting a CSP, developers can control which sources are allowed to load resources such as scripts, stylesheets, and images. However, versions of helmet-csp prior to 2.9.1 are vulnerable to a Configuration Override that affects the application's CSP.

Vulnerability Detail

The vulnerability in helmet-csp arises from the package's browser sniffing for Firefox, which inadvertently deletes the default-src CSP policy. The default-src policy serves as a fallback policy, specifying the default behavior when no other policies are defined. By removing the default-src policy, an attacker can potentially remove the application's default CSP, leaving it vulnerable to Cross-Site Scripting attacks. This can allow malicious actors to inject and execute arbitrary code on the affected web application.

How To Fix

Minimum fixed version

2.9.1

This is the first release that contains the fix.

npm install helmet-csp@2.9.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

A workaround for this vulnerability is to set the browserSniff configuration to false in vulnerable versions of helmet-csp. This can be done by modifying the configuration options when using the middleware. For example:

const helmet = require('helmet');
const helmetCsp = require('helmet-csp');

app.use(helmet());
app.use(helmetCsp({
  browserSniff: false
}));

Conclusion

In conclusion, the Configuration Override vulnerability in helmet-csp can expose web applications to Cross-Site Scripting attacks by removing the default Content Security Policy (CSP). It is crucial to upgrade to version 2.9.1 or later of helmet-csp or apply the workaround by setting browserSniff to false in vulnerable versions. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for helmet-csp →

Share this vulnerability

FAQ

helmet-csp is an npm package that provides middleware to set the Content Security Policy (CSP) for Express.js applications. CSP is a security mechanism that helps mitigate Cross-Site Scripting (XSS) attacks by defining a set of policies that restrict the types of content that can be loaded by a web page.

Content Security Policy (CSP) is a security mechanism that allows web developers to control the resources that a web page can load. It helps mitigate Cross-Site Scripting (XSS) attacks by specifying the sources from which various types of content can be loaded, such as scripts, stylesheets, and images.

The Configuration Override vulnerability in helmet-csp occurs due to the package's browser sniffing for Firefox. This browser sniffing inadvertently deletes the default-src CSP policy, which is the fallback policy. As a result, an attacker can remove the application's default CSP, potentially exposing it to Cross-Site Scripting attacks.

The Configuration Override vulnerability in helmet-csp can lead to Cross-Site Scripting (XSS) attacks. An attacker can exploit this vulnerability to inject and execute arbitrary code on the affected web application. This can result in unauthorized access, data theft, and other malicious activities.

To mitigate the Configuration Override vulnerability in helmet-csp, it is recommended to upgrade to version 2.9.1 or later. Alternatively, in vulnerable versions, setting the browserSniff configuration to false can also help mitigate the issue.

How To Fix

Minimum fixed version

2.9.1

This is the first release that contains the fix.

npm install helmet-csp@2.9.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