CVE-2021-32670: Datasette Cross-Site Scripting Vulnerability
MODERATECVE-2021-32670 is a MODERATE (CVSS 7.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Datasette libraries in the PyPI ecosystem. The issue involves reflected cross-site scripting issue in datasette. Remediation is available by upgrading affected packages to version 0.56.1.
CVE-2021-32670 at a Glance
Security Impact
CVSS: 7.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N).
How to Fix CVE-2021-32670
To remediate this vulnerability, upgrade all affected Datasette 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 datasette>=0.56.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show datasette
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-32670, inspect your installed packages using pip:
pip show datasette
Analyze the terminal output to locate any version of Datasette in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.56.1), your application is affected.
Note: The pip show datasette command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Datasette, 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
CVE-2021-32670 Affected Datasette Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
datasette
|
PyPI |
< 0.56.1
|
0.56.1
|
References
Frequently Asked Questions
What is CVE-2021-32670?
Which Datasette versions are affected?
What version fixes CVE-2021-32670?
Is datasette affected?
What is the CVSS score of CVE-2021-32670?
What CWE is associated with CVE-2021-32670?
How can I check PyPI dependencies for CVE-2021-32670?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xw7c-jx9m-xh5g",
"modified" : "2024-11-18T16:26:14Z",
"published" : "2021-06-07T21:47:41Z",
"aliases" : [ "CVE-2021-32670" ],
"summary" : "Reflected cross-site scripting issue in Datasette",
"details" : "### Impact\n\nThe `?_trace=1` debugging feature in Datasette does not correctly escape generated HTML, resulting in a [reflected cross-site scripting](https://owasp.org/www-community/attacks/xss/#reflected-xss-attacks) vulnerability.\n\nThis vulnerability is particularly relevant if your Datasette installation includes authenticated features using plugins such as [datasette-auth-passwords](https://datasette.io/plugins/datasette-auth-passwords) as an attacker could use the vulnerability to access protected data.\n\n### Patches\n\nDatasette 0.57 and 0.56.1 both include patches for this issue.\n\n### Workarounds\n\nIf you run Datasette behind a proxy you can workaround this issue by rejecting any incoming requests with `?_trace=` or `&_trace=` in their query string parameters.\n\n### References\n\n- [OWASP guide to reflected cross-site scripting](https://owasp.org/www-community/attacks/xss/#reflected-xss-attacks)\n- [Datasette issue #1360](https://github.com/simonw/datasette/issues/1360)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a discussion in [simonw/datasette](https://github.com/simonw/datasette/discussions)\n* Email us at `swillison+datasette @ gmail.com`\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "datasette"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.56.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/simonw/datasette/security/advisories/GHSA-xw7c-jx9m-xh5g"
}, {
"type" : "WEB",
"url" : "https://github.com/simonw/datasette/issues/1360"
}, {
"type" : "WEB",
"url" : "https://datasette.io/plugins/datasette-auth-passwords"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-gff3-739c-gxfq"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/datasette/PYSEC-2021-89.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/simonw/datasette"
}, {
"type" : "WEB",
"url" : "https://owasp.org/www-community/attacks/xss/#reflected-xss-attacks"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/datasette"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-07T20:59:14Z",
"nvd_published_at" : null
}
}