XSS Vulnerability in knockout

knockout Updated 02 Oct 2025

Summary

25/02/2021
MODERATE
Yes i
Moderate
Not published

GHSA-qfmr-6qvh-49gm: XSS. Affects knockout versions < 3.5.0. Fixed in 3.5.0. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Knockout is an open-source JavaScript library that helps developers create dynamic user interfaces with a clean underlying data model. It provides a simple and declarative way to bind data to the UI, making it easier to manage and update the UI as the data changes. However, versions of Knockout before 3.5.0-beta are vulnerable to an XSS injection point in the attr name binding for Internet Explorer 7 and older browsers.

Vulnerability Detail

The XSS vulnerability in Knockout arises from a lack of proper input sanitization in the attr name binding for older versions of Internet Explorer. This allows an attacker to inject malicious code into the rendered HTML, potentially leading to unauthorized access, data theft, or other malicious activities. The vulnerability has a moderate severity rating.

How To Fix

Minimum fixed version

3.5.0

This is the first release that contains the fix.

npm install knockout@3.5.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 Knockout is not immediately feasible, a temporary workaround is to manually sanitize the input before binding it to the attr name. This can be done by using a library or function that escapes special characters and prevents the execution of injected scripts. Here is an example using the DOMPurify library:

const sanitizedValue = DOMPurify.sanitize(value);

Conclusion

The XSS vulnerability in Knockout can pose a significant security risk, allowing attackers to inject malicious code into web pages viewed by users. To mitigate this risk, it is crucial to upgrade to the latest version of Knockout or apply the recommended workaround. For further assistance and support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for knockout →

Share this vulnerability

FAQ

Knockout is a JavaScript library that helps developers create dynamic user interfaces with a clean underlying data model. It simplifies the process of binding data to the UI and updating it as the data changes.

XSS (Cross-Site Scripting) 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.

Versions of Knockout before 3.5.0-beta are vulnerable to this XSS injection point in the attr name binding for Internet Explorer 7 and older browsers.

The XSS vulnerability in Knockout can allow attackers to execute arbitrary code in the context of a user's browser, potentially leading to unauthorized access, data theft, or other malicious activities.

Yes, upgrading to version 3.5.0 or later of the Knockout library includes the necessary fixes to prevent XSS attacks. It is recommended to update to the latest version and ensure all affected code is updated accordingly.

Related vulnerabilities

Recent vulnerabilities recorded for knockout.

How To Fix

Minimum fixed version

3.5.0

This is the first release that contains the fix.

npm install knockout@3.5.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