GHSA-q6j3-c4wc-63vw: Datasette CSRF Tokens Leaked Vulnerability

MODERATE
CVSS 4.3
CWE-200
Published
Advisory Summary

GHSA-q6j3-c4wc-63vw is a MODERATE (CVSS 4.3) csrf tokens leaked vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Datasette libraries in the PyPI ecosystem. The issue involves csrf tokens leaked in url by canned query form. Remediation is available by upgrading affected packages to version 0.46.

GHSA-q6j3-c4wc-63vw at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-q6j3-c4wc-63vw
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Datasette
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.3

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:R/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-q6j3-c4wc-63vw

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.

datasette fixed: 0.46
pip install datasette>=0.46
Verify Direct and Transitive Dependencies

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 GHSA-q6j3-c4wc-63vw, 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.46), 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. 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

### Impact The HTML form for a read-only canned query includes the hidden CSRF token field added in #798 for writable canned queries (#698). This means that submitting those read-only forms exposes the CSRF token in the URL - for example on https://latest.datasette.io/fixtures/neighborhood_search submitting the form took me to: https://latest.datasette.io/fixtures/neighborhood_search?text=down&csrftoken=CSRFTOKEN-HERE This token could potentially leak to an attacker if the resulting page has a link to an external site on it and the user clicks the link, since the token would be exposed in the referral logs. ### Patches A fix for this issue has been released in Datasette 0.46. ### Workarounds You can fix this issue in a Datasette instance without upgrading by copying the [0.46 query.html template](https://raw.githubusercontent.com/simonw/datasette/0.46/datasette/templates/query.html) into a custom `templates/` directory and running Datasette with the `--template-dir=templates/` option. ### References Issue 918 discusses this in details: https://github.com/simonw/datasette/issues/918 ### For more information Contact swillison at gmail with any questions.

GHSA-q6j3-c4wc-63vw Affected Datasette Versions

1 component(s)
Fixed Versions:
0.46
Product / Package Ecosystem Affected Versions Fixed Version
datasette
PyPI
< 0.46
0.46

References

Frequently Asked Questions

What is GHSA-q6j3-c4wc-63vw?
GHSA-q6j3-c4wc-63vw is a security vulnerability in Datasette involving CSRF tokens leaked in URL by canned query form under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Datasette versions are affected?
Affected versions include releases prior to 0.46 across affected packages: datasette.
What version fixes GHSA-q6j3-c4wc-63vw?
Upgrading to 0.46 (or the latest patched release for your respective branch) resolves the vulnerability.
Is datasette affected?
Yes, datasette is affected in releases prior to 0.46. Upgrade your dependency to 0.46 or later.
What is the CVSS score of GHSA-q6j3-c4wc-63vw?
GHSA-q6j3-c4wc-63vw has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N.
What CWE is associated with GHSA-q6j3-c4wc-63vw?
GHSA-q6j3-c4wc-63vw is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check PyPI dependencies for GHSA-q6j3-c4wc-63vw?
Run the dependency tree command: 'pip show datasette'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q6j3-c4wc-63vw",
  "modified" : "2021-09-23T18:50:16Z",
  "published" : "2020-08-11T14:54:40Z",
  "aliases" : [ ],
  "summary" : "CSRF tokens leaked in URL by canned query form",
  "details" : "### Impact\n\nThe HTML form for a read-only canned query includes the hidden CSRF token field added in #798 for writable canned queries (#698).\n\nThis means that submitting those read-only forms exposes the CSRF token in the URL - for example on https://latest.datasette.io/fixtures/neighborhood_search submitting the form took me to:\n\nhttps://latest.datasette.io/fixtures/neighborhood_search?text=down&csrftoken=CSRFTOKEN-HERE\n\nThis token could potentially leak to an attacker if the resulting page has a link to an external site on it and the user clicks the link, since the token would be exposed in the referral logs.\n\n### Patches\n\nA fix for this issue has been released in Datasette 0.46.\n\n### Workarounds\n\nYou can fix this issue in a Datasette instance without upgrading by copying the [0.46 query.html template](https://raw.githubusercontent.com/simonw/datasette/0.46/datasette/templates/query.html) into a custom `templates/` directory and running Datasette with the `--template-dir=templates/` option.\n\n### References\n\nIssue 918 discusses this in details: https://github.com/simonw/datasette/issues/918\n\n### For more information\n\nContact swillison at gmail with any questions.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "datasette"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.46"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/simonw/datasette/security/advisories/GHSA-q6j3-c4wc-63vw"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simonw/datasette/issues/918"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/simonw/datasette/commit/7f10f0f7664d474c1be82bf668829e3b736a3d2b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/simonw/datasette"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-PYTHON-DATASETTE-598229"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-10T22:36:11Z",
    "nvd_published_at" : null
  }
}