{"id":"CVE-2022-23607","aliases":["CVE-2022-23607","GHSA-fhpf-pp6p-55qc","PYSEC-2022-26"],"related":[],"kind":"vulnerability","state":"published","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nTreq's request methods (`treq.get`, `treq.post`, `HTTPClient.request`, `HTTPClient.get`, etc.) accept cookies as a dictionary, for example:\n\n```py\ntreq.get('https://example.com/', cookies={'session': '1234'})\n```\n\nSuch 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`.\n\n### Patches\n\nTreq 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.\n\n### Workarounds\n\nInstead of passing a dictionary as the *cookies* argument, pass a `http.cookiejar.CookieJar` instance with properly domain- and scheme-scoped cookies in it:\n\n```py\nfrom http.cookiejar import CookieJar\nfrom requests.cookies import create_cookie\n\njar = CookieJar()\njar.add_cookie(\n    create_cookie(\n        name='session',\n        value='1234',\n        domain='example.com',\n        secure=True,\n    ),\n)\nclient = HTTPClient(cookies=jar)\nclient.get('https://example.com/')\n```\n\n### References\n\n* Originally reported at [huntr.dev](https://huntr.dev/bounties/3c9204fc-a3d1-4441-8599-924c5f57e7ae/?token=06d930e37046c914bcb037e85cc227dc7b510b475989fc69837566562ba899277d46b0fb4b1e21cdcb6ddc1b7d9b1ded632cf3a3551ecb89afca16a63b34641284b50479d5195bba2ac09b116f3dd4fad27f54404c2de922c05c8c8b744aec27bb4d4d198cb8b3abf479af0c2d5fbaa10412da7922594ac3eb39)\n* A related issue in the handling of HTTP basic authentication was addressed in Twisted 22.1 ([GHSA-92x2-jw7w-xvvx](https://github.com/twisted/twisted/security/advisories/GHSA-92x2-jw7w-xvvx), CVE-2022-21712).","format":"markdown","source":"ghsa"},{"lang":"es","text":"treq es una librería HTTP inspirada en peticiones pero escrita sobre los Agentes de Twisted. Los métodos de petición de Treq (\"treq.get\", \"treq.post\", etc.) y el constructor \"treq.client.HTTPClient\" aceptan cookies como diccionario. Dichas cookies no están vinculadas a un único dominio, por lo que son enviadas a *every* los dominios (\"supercookies\"). Esto puede potencialmente causar que se filtre información confidencial en un redireccionamiento HTTP a un dominio diferente, por ejemplo, si \"https://example.com\" es redirigido a \"http://cloudstorageprovider.com\" este último recibirá la cookie \"session\". Treq versiones 2021.1.0 y posteriores vinculan las cookies dadas a los métodos de petición (\"treq.request\", \"treq.get\", \"HTTPClient.request\", \"HTTPClient.get\", etc.) al origen del parámetro *url*. Se recomienda a usuarios que actualicen. Para usuarios que no puedan actualizarse En lugar de pasar un diccionario como argumento *cookies*, pase una instancia de \"http.cookiejar.CookieJar\" con las cookies apropiadas para el dominio y el esquema","source":"nvd"}],"published":"2022-02-01T00:43:38.000Z","modified":"2026-06-17T04:30:28.133Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:P/I:N/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-425","CWE-601"],"affected":[{"ranges":[{"version":"< 22.1.0","status":"affected"}],"vendor":"twisted","product":"treq","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"22.1.0"}],"ecosystem":"PyPI","package":"treq","purl":"pkg:pypi/treq","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"21.1.0","fixed":"22.1.0"}],"vendor":"twistedmatrix","product":"treq","cpe":"cpe:2.3:a:twistedmatrix:treq:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"9.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"21.1.0","status":"affected","fixed":"22.1.0"}],"ecosystem":"PyPI","package":"treq","purl":"pkg:pypi/treq","source":"pysec"}],"references":[{"url":"https://github.com/twisted/treq/security/advisories/GHSA-fhpf-pp6p-55qc","tags":["advisory","mitigation","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2022/03/msg00025.html","tags":["mailing-list","third-party-advisory","web","x-refsource-mlist","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23607","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/twisted/treq/commit/1da6022cc880bbcff59321abe02bf8498b89efb2","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/treq/PYSEC-2022-26.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/twisted/treq","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/twisted/treq/releases/tag/release-22.1.0","tags":["web"],"sources":["ghsa"]},{"url":"https://huntr.dev/bounties/3c9204fc-a3d1-4441-8599-924c5f57e7ae/?token=06d930e37046c914bcb037e85cc227dc7b510b475989fc69837566562ba899277d46b0fb4b1e21cdcb6ddc1b7d9b1ded632cf3a3551ecb89afca16a63b34641284b50479d5195bba2ac09b116f3dd4fad27f54404c2de922c05c8c8b744aec27bb4d4d198cb8b3abf479af0c2d5fbaa10412da7922594ac3eb39","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-23607","url":"https://www.cve.org/CVERecord?id=CVE-2022-23607","licence":"CVE Terms of Use","modified":"2024-08-03T03:43:46.835Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fhpf-pp6p-55qc","url":"https://github.com/advisories/GHSA-fhpf-pp6p-55qc","licence":"CC-BY-4.0","modified":"2024-11-13T23:23:04.346Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-23607","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23607","licence":"Public domain","modified":"2026-06-17T04:30:28.133Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2022-26","url":"https://osv.dev/vulnerability/PYSEC-2022-26","licence":"CC-BY-4.0","modified":"2023-11-08T04:08:24.827Z"}],"updatedAt":"2026-11-25T22:58:09.454Z","epss":{"score":0.01164,"percentile":0.68175,"date":"2026-12-01T12:00:22.000Z"}}