CVE-2009-4924: python-cjson Remote Cross-Site Scripting (XSS) Vulnerability

python-cjson Updated 02 Oct 2025

Summary

02/07/2010
Yes i
Moderate
6.1

CVE-2009-4924: Dan Pascu python-cjson 1.0.5 does not properly handle a ['/'] argument to cjson.encode, which makes it easier for remote attackers to conduct certain cross-site scripting (XSS) attacks involving Firefox and the end tag o... Affects python-cjson versions < 1.1.0. Fixed in 1.1.0. How to fix ↓

Also tracked for

The same CVE-2009-4924 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

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

python-cjson is a Python extension module that provides a fast JSON encoder/decoder for Python. It is commonly used to encode and decode JSON data in Python applications. The vulnerability in python-cjson version 1.0.5 allows for a remote cross-site scripting (XSS) attack when handling a ['/'] argument to cjson.encode. This vulnerability can be exploited in conjunction with Firefox and the end tag of a SCRIPT element.

Vulnerability Detail

The vulnerability arises from a lack of proper handling of the ['/'] argument in the cjson.encode function. This allows remote attackers to conduct certain cross-site scripting (XSS) attacks. By manipulating the input, an attacker can inject malicious scripts into the output generated by python-cjson, which may be executed by a victim's browser. This can lead to various security risks, including the theft of sensitive information or the execution of unauthorized actions on behalf of the victim.

How To Fix

Minimum fixed version

1.1.0

This is the first release that contains the fix.

pip install --upgrade "python-cjson==1.1.0"

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

Workaround

If upgrading to the fixed version is not immediately feasible, a possible workaround is to sanitize the input before passing it to the cjson.encode function. This can be done by removing or escaping any characters that may be interpreted as HTML or JavaScript code. Here is an example of how to sanitize the input using the 'html' module in Python:

import html

input_data = ['\/']
sanitized_data = html.escape(input_data)
encoded_data = cjson.encode(sanitized_data)

Conclusion

The python-cjson version 1.0.5 is vulnerable to a remote cross-site scripting (XSS) attack when handling a ['/'] argument in the cjson.encode function. This vulnerability can be exploited in conjunction with Firefox and the end tag of a SCRIPT element. To mitigate this vulnerability, it is advised to upgrade to python-cjson version 1.1.0 or later. Alternatively, users can sanitize the input before passing it to the cjson.encode function. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for python-cjson →

Share this vulnerability

FAQ

python-cjson is a Python extension module that provides a fast JSON encoder/decoder for Python. It is commonly used to encode and decode JSON data in Python applications.

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 various security risks, including the theft of sensitive information or the execution of unauthorized actions on behalf of the victim.

The python-cjson XSS vulnerability occurs when the ['/'] argument is not properly handled in the cjson.encode function. This allows remote attackers to inject malicious scripts into the output generated by python-cjson, which may be executed by a victim's browser.

The python-cjson XSS vulnerability can lead to various security risks, including the theft of sensitive information, session hijacking, and the execution of unauthorized actions on behalf of the victim.

To protect your application from the python-cjson XSS vulnerability, it is recommended to upgrade to python-cjson version 1.1.0 or later. Additionally, you can sanitize the input before passing it to the cjson.encode function by removing or escaping any characters that may be interpreted as HTML or JavaScript code.

Related vulnerabilities

Recent vulnerabilities recorded for python-cjson.

How To Fix

Minimum fixed version

1.1.0

This is the first release that contains the fix.

pip install --upgrade "python-cjson==1.1.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