CVE-2018-20677: bootstrap Cross-site Scripting vulnerability

bootstrap Updated 02 Oct 2025

Summary

17/01/2019
Yes i
Moderate
6.1

CVE-2018-20677: bootstrap Cross-site Scripting vulnerability. Affects bootstrap versions < 3.4.0. Fixed in 3.4.0. How to fix ↓

Also tracked for

The same CVE-2018-20677 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

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

Bootstrap is a popular open-source front-end framework used for building responsive and mobile-first websites. It provides a collection of CSS and JavaScript components that simplify the development process. The vulnerability in Bootstrap before version 3.4.0 allows for cross-site scripting (XSS) attacks when configuring the affix target property. This means that an attacker can inject malicious code into a website that uses Bootstrap, potentially leading to unauthorized access, data theft, or other malicious activities.

Vulnerability Detail

The vulnerability arises from a lack of proper input sanitization in the affix configuration target property. This allows an attacker to inject arbitrary JavaScript code into a website that uses Bootstrap. When a user interacts with the affected page, the injected code will execute within their browser, potentially compromising their session, stealing sensitive information, or performing other malicious actions. The severity of this vulnerability is rated as MODERATE with a CVSS score of 6.1.

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

3.4.0

This is the first release that contains the fix.

npm install bootstrap@3.4.0

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

Workaround

If upgrading to the latest version of Bootstrap is not immediately feasible, a temporary workaround is to manually sanitize and validate any user input that is used in the affix configuration target property. This can be done by implementing server-side input validation and sanitization techniques, such as using a library like OWASP Java Encoder or PHP's htmlspecialchars function. Additionally, implementing Content Security Policy (CSP) headers can help mitigate the impact of XSS attacks by restricting the execution of injected scripts.

Conclusion

The bootstrap Cross-site Scripting vulnerability (CVE-2018-20677) in versions prior to 3.4.0 can allow attackers to inject malicious code into websites using Bootstrap. To mitigate this vulnerability, it is crucial to upgrade to Bootstrap 3.4.0 or later and implement proper input sanitization and validation techniques. Content Security Policy (CSP) headers can also provide additional protection. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for bootstrap →

Share this vulnerability

FAQ

Bootstrap is an open-source front-end framework used for building responsive and mobile-first websites. It provides a collection of CSS and JavaScript components that simplify the development process.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to unauthorized access, data theft, or other malicious activities.

If you are using a version of Bootstrap prior to 3.4.0 and have not implemented proper input sanitization in the affix configuration target property, your website may be vulnerable to cross-site scripting (XSS) attacks. This could potentially lead to unauthorized access, data theft, or other malicious activities.

To fix this vulnerability, it is recommended to upgrade to Bootstrap version 3.4.0 or later. This version includes the necessary fixes to prevent the XSS vulnerability. Additionally, implementing server-side input validation and sanitization techniques, as well as Content Security Policy (CSP) headers, can provide additional protection against XSS attacks.

For more information about this vulnerability and how to mitigate it, you can refer to the official Bootstrap documentation, security advisories, or consult with a security professional.

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

3.4.0

This is the first release that contains the fix.

npm install bootstrap@3.4.0

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