Skip to content
Heist/ feed
Back to feed
Medium

Unsafe handling of user-specified cookies in treq

Type: advisorySources: OSV

treq is an HTTP library inspired by requests but written on top of Twisted's Agents. Treq's request methods (`treq.get`, `treq.post`, etc.) and `treq.client.HTTPClient` constructor accept cookies as a dictionary. Such cookies are not bound to a single domain, and are therefore sent to *every* domain ("supercookies"). This can potentially cause sensitive information to leak upon an HTTP redirect to a different domain., e.g. should `https://example.com` redirect to `http://cloudstorageprovider.com` the latter will receive the cookie `session`. Treq 2021.1.0 and later bind cookies given to request methods (`treq.request`, `treq.get`, `HTTPClient.request`, `HTTPClient.get`, etc.) to the origin of the *url* parameter. Users are advised to upgrade. For users unable to upgrade Instead of passing a dictionary as the *cookies* argument, pass a `http.cookiejar.CookieJar` instance with properly domain- and scheme-scoped cookies in it.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-23607
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 01:16 UTC · Revision 1

Source evidence

Unsafe handling of user-specified cookies in treq

core-osv · Original source

Published 1 Feb 2022, 11:01 UTC

treq is an HTTP library inspired by requests but written on top of Twisted's Agents. Treq's request methods (`treq.get`, `treq.post`, etc.) and `treq.client.HTTPClient` constructor accept cookies as a dictionary. Such cookies are not bound to a single domain, and are therefore sent to *every* domain ("supercookies"). This can potentially cause sensitive information to leak upon an HTTP redirect to a different domain., e.g. should `https://example.com` redirect to `http://cloudstorageprovider.com` the latter will receive the cookie `session`. Treq 2021.1.0 and later bind cookies given to request methods (`treq.request`, `treq.get`, `HTTPClient.request`, `HTTPClient.get`, etc.) to the origin of the *url* parameter. Users are advised to upgrade. For users unable to upgrade Instead of passing a dictionary as the *cookies* argument, pass a `http.cookiejar.CookieJar` instance with properly domain- and scheme-scoped cookies in it.

osv:CVE-2022-23607
Complete source record
{
  "id": "ebcdd5256051c47c28b863b4ea2ad7dd1214401682d450055b10acb0c43cad6f",
  "url": "https://osv.dev/vulnerability/CVE-2022-23607",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Unsafe handling of user-specified cookies in treq",
    "summary": "treq is an HTTP library inspired by requests but written on top of Twisted's Agents. Treq's request methods (`treq.get`, `treq.post`, etc.) and `treq.client.HTTPClient` constructor accept cookies as a dictionary. Such cookies are not bound to a single domain, and are therefore sent to *every* domain (\"supercookies\"). This can potentially cause sensitive information to leak upon an HTTP redirect to a different domain., e.g. should `https://example.com` redirect to `http://cloudstorageprovider.com` the latter will receive the cookie `session`. Treq 2021.1.0 and later bind cookies given to request methods (`treq.request`, `treq.get`, `HTTPClient.request`, `HTTPClient.get`, etc.) to the origin of the *url* parameter. Users are advised to upgrade. For users unable to upgrade Instead of passing a dictionary as the *cookies* argument, pass a `http.cookiejar.CookieJar` instance with properly domain- and scheme-scoped cookies in it.",
    "evidence": "osv:CVE-2022-23607",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2022-23607",
      "aliases": [
        "CVE-2022-23607",
        "GHSA-fhpf-pp6p-55qc",
        "PYSEC-2022-26"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/twisted/treq",
              "type": "GIT",
              "events": [
                {
                  "introduced": "606259031e17fb0cdd2143e11b988de525e89a3e"
                },
                {
                  "fixed": "82f01e68e02bd52ddf09e352d73e0bcaff122727"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "22.1.0"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "cpe": "cpe:2.3:a:twistedmatrix:treq:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "21.1.0"
                      },
                      {
                        "fixed": "22.1.0"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "release-21.5.0",
            "release-21.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-23607.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:48.883440364Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23607.json",
        "https://github.com/twisted/treq/security/advisories/GHSA-fhpf-pp6p-55qc",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-23607",
        "https://lists.debian.org/debian-lts-announce/2022/03/msg00025.html"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-200"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23607.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-23607",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 516910,
  "published_at": "2022-02-01T11:01:07+00:00"
}