CVE-2018-14041: Bootstrap Cross-site Scripting vulnerability

bootstrap Updated 02 Oct 2025

Summary

13/09/2018
Yes i
Moderate
6.1

CVE-2018-14041: Bootstrap Cross-site Scripting vulnerability. Affects bootstrap versions >= 4.0.0, < 4.1.2. Fixed in 4.1.2. 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

Bootstrap is a popular front-end framework used for developing responsive and mobile-first websites. It provides a set of CSS and JavaScript components that help in creating a consistent and visually appealing user interface. This vulnerability affects versions of Bootstrap before 4.1.2. Bootstrap's scrollspy feature allows developers to automatically update navigation elements based on scroll position. However, an XSS (Cross-site Scripting) vulnerability exists in the data-target property of scrollspy. This vulnerability is similar to CVE-2018-14042.

Vulnerability Detail

The XSS vulnerability in Bootstrap's scrollspy feature allows an attacker to inject malicious scripts into the data-target property. When a user interacts with the affected navigation element, the injected script is executed in the context of the user's browser. This can lead to various attacks, such as stealing sensitive information, session hijacking, or performing actions on behalf of the user. The vulnerability has a CVSS score of 6.1, indicating a moderate severity.

How To Fix

Latest published version: 5.3.8 as of 23 Oct 2026

npm install bootstrap@5.3.8

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.2

This is the first release that contains the fix.

npm install bootstrap@4.1.2

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

Workaround

If updating Bootstrap is not feasible immediately, a temporary workaround is to sanitize the data-target property value before using it in the application. This can be done by implementing input validation and escaping special characters. Here's an example in JavaScript:

function sanitizeDataTarget(dataTarget) {
  return dataTarget.replace(/[<>&]/g, function (c) {
    return {
      '<': '&lt;',
      '>': '&gt;',
      '&': '&amp;'
    }[c];
  });
}

Conclusion

The XSS vulnerability in Bootstrap's scrollspy feature (CVE-2018-14041) can be mitigated by updating to version 4.1.2 or later. If immediate update is not possible, developers should sanitize the data-target property value to prevent script injection. It is important to stay updated with the latest security patches and regularly monitor for vulnerabilities in your application. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for bootstrap →

Share this vulnerability

FAQ

Bootstrap is a front-end framework that provides CSS and JavaScript components for building responsive websites.

XSS (Cross-site Scripting) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

If your application uses Bootstrap versions before 4.1.2 and utilizes the scrollspy feature with the data-target property, it is vulnerable to XSS attacks. An attacker can exploit this vulnerability to execute malicious scripts in the context of your users' browsers.

You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities using package-lock.json.

The vulnerability has a CVSS score of 6.1, indicating a moderate severity.

Related vulnerabilities

Recent vulnerabilities recorded for bootstrap.

How To Fix

Latest published version: 5.3.8 as of 23 Oct 2026

npm install bootstrap@5.3.8

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.2

This is the first release that contains the fix.

npm install bootstrap@4.1.2

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