CVE-2022-30241: Cross-site Scripting in jquery.json-viewer

jquery.json-viewer Updated 02 Oct 2025

Summary

05/05/2022
Yes i
Moderate
6.1

CVE-2022-30241: Cross-site Scripting in jquery.json-viewer. Affects jquery.json-viewer versions < 1.5.0. Fixed in 1.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 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

The jquery.json-viewer library is a Node.js package that provides a JSON viewer for displaying JSON data in a user-friendly format. It allows users to visualize and navigate through complex JSON structures. However, prior to version 1.5.0, the library did not properly escape certain characters, such as '<', in a JSON object. This vulnerability can lead to cross-site scripting (XSS) attacks, where an attacker can inject malicious scripts into a web page viewed by a user.

Vulnerability Detail

The vulnerability in jquery.json-viewer arises from the lack of proper character escaping in JSON objects. When rendering JSON data that contains unescaped characters, such as '<', the library does not sanitize the input, allowing an attacker to inject arbitrary scripts. This can lead to the execution of malicious code in the context of the user's browser, potentially compromising sensitive information or performing unauthorized actions. The vulnerability has a CVSS score of 6.1, indicating a moderate severity level.

How To Fix

Latest published version: 1.5.0 as of 22 Oct 2026

npm install jquery.json-viewer@1.5.0

The newest release already contains this fix.

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

Workaround

If updating to the latest version of jquery.json-viewer is not immediately feasible, developers can implement a workaround by manually sanitizing the JSON data before passing it to the library for rendering. This can be achieved by using a library or function that escapes special characters in JSON strings, such as the 'escape-html' module in Node.js. Here is an example of how to sanitize the JSON data using the 'escape-html' module:

const escapeHtml = require('escape-html');
const json = '{ "name": "<script>alert(1)</script>" }';
const sanitizedJson = escapeHtml(json);

By sanitizing the JSON data before rendering, the vulnerability can be mitigated.

Conclusion

In conclusion, the jquery.json-viewer library prior to version 1.5.0 is vulnerable to cross-site scripting (XSS) attacks due to improper character escaping in JSON objects. Developers should update to the latest version of the library or implement a workaround to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for jquery.json-viewer →

Share this vulnerability

FAQ

The vulnerability allows an attacker to inject malicious scripts into a web page viewed by a user. This can lead to the execution of arbitrary code in the user's browser, potentially compromising sensitive information or performing unauthorized actions.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. The playground allows you to analyze your package-lock.json file and provides real-time monitoring and alerts for open-source vulnerabilities, including this one.

The CVSS score of this vulnerability is 6.1, indicating a moderate severity level.

Yes, developers can fix this vulnerability by updating their usage of the jquery.json-viewer library to version 1.5.0 or later. This version includes the necessary fixes to properly escape characters in JSON objects, preventing the possibility of XSS attacks.

If updating to the latest version of jquery.json-viewer is not immediately feasible, developers can implement a workaround by manually sanitizing the JSON data before passing it to the library for rendering. This can be achieved by using a library or function that escapes special characters in JSON strings, such as the 'escape-html' module in Node.js.

Related vulnerabilities

Recent vulnerabilities recorded for jquery.json-viewer.

How To Fix

Latest published version: 1.5.0 as of 22 Oct 2026

npm install jquery.json-viewer@1.5.0

The newest release already contains this fix.

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