GHSA-57h7-r3q3-w57j: Djangorestframework Cross-Site Scripting Vulnerability
MODERATEGHSA-57h7-r3q3-w57j is a MODERATE cross-site scripting vulnerability (General Security Weakness) affecting Djangorestframework libraries in the PyPI ecosystem. The issue involves cross-site scripting. Remediation is available by upgrading affected packages to version 3.9.1.
GHSA-57h7-r3q3-w57j at a Glance
How to Fix GHSA-57h7-r3q3-w57j
To remediate this vulnerability, upgrade all affected Djangorestframework dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install djangorestframework>=3.9.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show djangorestframework
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-57h7-r3q3-w57j, inspect your installed packages using pip:
pip show djangorestframework
Analyze the terminal output to locate any version of Djangorestframework in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.9.1), your application is affected.
Note: The pip show djangorestframework command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Djangorestframework, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-57h7-r3q3-w57j Affected Djangorestframework Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
djangorestframework
|
PyPI |
< 3.9.1
|
3.9.1
|
References
Frequently Asked Questions
What is GHSA-57h7-r3q3-w57j?
Which Djangorestframework versions are affected?
What version fixes GHSA-57h7-r3q3-w57j?
Is djangorestframework affected?
What CWE is associated with GHSA-57h7-r3q3-w57j?
How can I check PyPI dependencies for GHSA-57h7-r3q3-w57j?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-57h7-r3q3-w57j",
"modified" : "2021-02-24T19:46:00Z",
"published" : "2021-02-24T19:46:00Z",
"withdrawn" : "2021-02-24T19:46:00Z",
"aliases" : [ ],
"summary" : "Cross-Site Scripting",
"details" : "Django-Rest-Framework, before 3.9.1, has a XSS vulnerability caused by disabled autoescaping in the default DRF Browsable API view templates.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "djangorestframework"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.9.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/encode/django-rest-framework/pull/6330"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/django-rest-framework/commit/343ce4a03cad02631752a5e9bde26218fd647c14"
}, {
"type" : "WEB",
"url" : "https://github.com/encode/django-rest-framework/commit/75a489150ae24c2f3c794104a8e98fa43e2c9ce9"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2019-05-22T15:03:51Z",
"nvd_published_at" : null
}
}