{"id":"CVE-2026-91991","aliases":["CVE-2026-91991","GHSA-wwv5-g3v4-889x"],"related":[],"kind":"vulnerability","state":"published","title":"Tornado before 6.5.8 Cookie Attribute Injection via Capitalized kwargs","summary":"Tornado before 6.5.8 contains an incomplete fix for cookie attribute injection that allows attackers to inject arbitrary cookie attributes by passing capitalized or legacy keyword arguments to set_cookie. Attackers can embed semicolon-delimited data in capitalized parameters like Domain, Path, or SameSite to bypass validation and modify cookie security attributes.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Tornado before 6.5.8 contains an incomplete fix for cookie attribute injection that allows attackers to inject arbitrary cookie attributes by passing capitalized or legacy keyword arguments to set_cookie. Attackers can embed semicolon-delimited data in capitalized parameters like Domain, Path, or SameSite to bypass validation and modify cookie security attributes.","source":"cvelist"},{"lang":"en","text":"## Summary\nThe CVE-2026-35536 fix added a validation loop that rejects `[\\x00-\\x20\\x3b\\x7f]`, but only for the\nhardcoded **lowercase** keys `name`/`domain`/`path`/`samesite`. The still-live deprecated `**kwargs` path\nwrites attacker-supplied attribute values straight into the `Morsel` with no validation, and because\n`Morsel.__setitem__` is case-insensitive, a capitalized kwarg (`Domain=`, `Path=`, `SameSite=`, `Max-Age=`)\nroutes to the same reserved attribute while bypassing the loop — re-opening `;`-delimited attribute injection.\n\n```python\nself.set_cookie(\"sid\", \"abc\", Domain=\"evil.com; Secure; SameSite=None\")\n#  -> Set-Cookie: sid=abc; Domain=evil.com; Secure; SameSite=None; Path=/\n# Sanity (the canonical lowercase named arg IS blocked):\nself.set_cookie(\"sid\", \"abc\", domain=\"evil.com; Secure\")   # -> http.cookies.CookieError\n```\n\nThe patch's regression test (`SetCookieForbiddenCharHandler`) only exercises the four named params, never the\n`**kwargs` path, so the gap is not regression-covered.\n\n## Affected code\n- `tornado/web.py` → `RequestHandler.set_cookie`: the validation loop covers only the lowercase named args;\n  the trailing `if kwargs:` loop does `morsel[k] = v` with no character validation.\n\n## Steps to reproduce\n`GET /upper` (uses `Domain=` kwarg) emits `Set-Cookie: c_upper=v; Domain=evil.com; Secure; SameSite=None; Path=/`; `GET /lower` (uses lowercase\n`domain=`) returns a `CookieError`.\n\n## Impact\nInjection of independent cookie attributes (force/drop `Secure`/`HttpOnly`/`SameSite`, rebind `Domain`/`Path`)\n— the same impact CVE-2026-35536 closed, via the sibling path the patch missed. Conditional on the app using\na capitalized/legacy keyword.\n\n## Suggested remediation\nApply the same `[\\x00-\\x20\\x3b\\x7f]` validation to every entry in the `**kwargs` loop (after normalizing the\nkey case), or remove the deprecated kwargs path; add a regression test for capitalized kwargs.\n\n## Credit\nReported as part of an incomplete-patch measurement study (responsible disclosure).","format":"markdown","source":"ghsa"}],"published":"2026-09-01T20:17:23.000Z","modified":"2026-10-08T16:17:59.970Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"LOW"}],"cwes":["CWE-74","CWE-113"],"affected":[{"ranges":[{"type":"semver","introduced":"6.5.5","fixed":"6.5.8","status":"affected"},{"type":"semver","version":"6.5.8","status":"unaffected"}],"vendor":"tornadoweb","product":"tornado","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"6.5.5","status":"affected","fixed":"6.5.8"}],"ecosystem":"PyPI","package":"tornado","purl":"pkg:pypi/tornado","source":"ghsa"}],"references":[{"url":"https://github.com/tornadoweb/tornado/security/advisories/GHSA-wwv5-g3v4-889x","tags":["exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/tornado-before-6.5.8-cookie-attribute-injection-via-capitalized-kwargs","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/tornadoweb/tornado/pull/3704","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tornadoweb/tornado/pull/3706","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tornadoweb/tornado/commit/6ef836e43e1278530041376adb32504daa977b91","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tornadoweb/tornado/commit/da284767eae8e1f0484f123b8c3225f6465b09c7","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tornadoweb/tornado","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/tornadoweb/tornado/releases/tag/v6.5.8","tags":["web"],"sources":["ghsa"]}],"credits":["sec-reex","arpitjain099"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-09-21T19:14:08.258Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-91991","url":"https://www.cve.org/CVERecord?id=CVE-2026-91991","licence":"CVE Terms of Use","modified":"2026-10-08T15:26:01.123Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wwv5-g3v4-889x","url":"https://github.com/advisories/GHSA-wwv5-g3v4-889x","licence":"CC-BY-4.0","modified":"2026-09-16T03:56:00.367Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-91991","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-91991","licence":"Public domain","modified":"2026-10-08T16:17:59.970Z"}],"updatedAt":"2026-11-25T22:59:38.588Z","epss":{"score":0.00225,"percentile":0.13976,"date":"2026-12-01T12:00:22.000Z"}}