CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-WWV5-G3V4-889X

GHSA-wwv5-g3v4-889x: Cookie Attribute Injection in Tornado via Legacy Case-Insensitive kwargs

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 2, 2026·6 min read·5 visits

Executive Summary (TL;DR)

Tornado's cookie validation bypassed legacy case-insensitive kwargs, allowing arbitrary attribute injection.

An incomplete sanitization fix for CVE-2026-35536 in Tornado allowed cookie attribute injection. The framework's validation loop checked lowercase keyword arguments but neglected legacy case-insensitive parameters passed through arbitrary keyword arguments, which Python's underlying library parses case-insensitively.

Vulnerability Overview

The Tornado web framework utilizes a standard request-handling pipeline that provides cookie-setting utilities to web developers via the RequestHandler.set_cookie API. Historically, this method accepted both explicit lowercase parameter definitions and an arbitrary dictionary of keyword arguments passed through Python's variable argument unpacking mechanism. This dual-path architectural design was intended to maintain compatibility with legacy versions of Tornado and Python's native standard library cookie modules.

Under CVE-2026-35536, a security vulnerability was identified where malicious characters injected into standard cookie parameters could manipulate the structure of the resulting HTTP Set-Cookie response header. While the maintainers implemented a filtering mechanism to restrict dangerous characters within explicitly defined lowercase attributes, they omitted identical validation on legacy keyword parameters. This oversight created an alternative, unvalidated code path that leads to cookie attribute injection under specific application configurations.

The primary security risk of this design omission lies in the mismatch between Tornado's validation logic and the underlying parsing behavior of Python's standard library. Specifically, Python's http.cookies.Morsel class treats cookie option dictionary keys in a case-insensitive manner. By utilizing mixed-case or capitalized keyword arguments, an application inadvertently routes raw, unvalidated input to the exact same sensitive cookie fields that the original sanitization patch intended to protect.

Root Cause Analysis

To understand the root cause of GHSA-wwv5-g3v4-889x, it is necessary to examine how the Python standard library represents individual cookie elements. The http.cookies.Morsel class acts as a specialized dictionary containing key-value pairs representing standard cookie directives like domain, path, samesite, and secure. Internally, this class overrides the dictionary __setitem__ method to map keys in a case-insensitive fashion. Consequently, assigning a value to morsel["Domain"] has the exact same structural outcome as assigning a value to morsel["domain"].

Tornado's patch for CVE-2026-35536 established a validation loop that inspected a static list of explicit, lowercase parameter names. Specifically, the method evaluated the variables domain, path, and samesite against a regular expression designed to match forbidden characters, including carriage returns, line feeds, spaces, and semicolons. However, the subsequent step in the execution path processed any remaining entries inside the dynamic **kwargs dictionary without running them through this regular expression filter.

Because of this architectural structure, when a developer passes a capitalized keyword parameter such as Domain="example.com", the argument is captured by the variable keyword parameters dictionary instead of the explicit lowercase domain parameter. The validation routine is completely bypassed because the key Domain is not present in Tornado's static lowercase validation list. When Tornado later transfers the elements of kwargs to the Morsel object, Python's internal logic processes the assignment case-insensitively, applying the unvalidated, attacker-controlled payload directly to the cookie's domain attribute.

Code Flow and Diagram Analysis

The following architectural diagram illustrates the structural divergence between the validated lowercase path and the unvalidated legacy capitalized path inside the vulnerable framework version:

The core code flaw is located inside tornado/web.py within the RequestHandler.set_cookie method definition. The vulnerable implementation sequentially evaluates explicit parameter variables and then immediately assigns key-value pairs from kwargs directly to the Morsel instance. Below is an annotated representation of the vulnerable code section illustrating the exact bypass point:

# Vulnerable code structure in Tornado <= 6.5.7
 
# 1. Validation loop targets only explicit lowercase parameters
for attr_name, attr_value in [
    ("domain", domain),
    ("path", path),
    ("samesite", samesite),
]:
    if attr_value is not None and re.search(r"[\x00-\x20\x3b\x7f]", str(attr_value)):
        raise http.cookies.CookieError(
            f"Invalid cookie attribute {attr_name}={attr_value!r}"
        )
 
# 2. Bypassed kwargs assignment to the Morsel object
for k, v in kwargs.items():
    # If k is "Domain", it bypasses the validation loop above
    # but still modifies the "domain" attribute within http.cookies.Morsel
    morsel[k] = v

Exploitation Methodology

Exploiting this vulnerability requires that a Tornado-based web application passes untrusted user input into a legacy, capitalized keyword argument inside a set_cookie call. A common scenario involves applications where legacy routing configurations, helper functions, or wrappers handle cookie generation dynamically using keyword unpacking. When an attacker is able to supply raw string inputs to these parameters, they can structure payloads that contain control characters.

An attacker crafts a malicious request targeting the input parameter mapped to the capitalized cookie keyword. By introducing a semicolon followed by a new attribute definition (e.g., ; Secure or ; SameSite=None), the attacker forces the underlying standard library serialization process to treat the injected string as additional, distinct cookie attributes. Because the semicolon is not stripped or escaped, it acts as a delimiter within the raw outbound HTTP header.

Upon receiving the response, the victim's web browser parses the raw Set-Cookie HTTP header sequentially. The injection allows the attacker to override existing flags, scope the cookie to wider domains, or drop security attributes such as HttpOnly and Secure. This enables subsequent administrative actions, session hijacking attempts, or cross-site request forgery attacks depending on the precise nature of the modified cookie attributes.

Remediation and Fix Assessment

To completely remediate this vulnerability, the Tornado development team introduced a secondary validation phase that systematically scans the elements of the kwargs collection. The official security advisory addresses this issue in version 6.5.8. Below is the annotated patch implementation showing how validation is now extended to all dynamic keyword arguments:

# Patched structure in tornado/web.py (6.5.8)
for k, v in kwargs.items():
    # Extended sanitization loop for deprecated legacy attributes
    if re.search(r"[\x00-\x20\x3b\x7f]", str(v)):
        raise http.cookies.CookieError(
            f"Invalid cookie attribute {k}={v!r} for cookie {name!r}"
        )

The primary mitigation strategy is a direct upgrade of the Python environment to ensure Tornado is running at version 6.5.8 or later. If immediate upgrades are blocked due to environment freeze policies, developers must rewrite existing set_cookie calls to eliminate capitalized or mixed-case parameter names. All calls should use standard lowercase attributes to ensure the inputs are routed through the validated explicit code path.

Additionally, organizations should run automated static analysis tools to audit codebase directories for improper usages of the set_cookie API. Applying strict regular expression validation to any application-level wrappers that interact with raw HTTP cookies provides a robust defense-in-depth layer. Security teams should ensure that downstream reverse proxies or Web Application Firewalls (WAFs) reject response headers containing anomalous or duplicated cookie parameters.

Official Patches

tornadowebOfficial Tornado Security Advisory

Fix Analysis (2)

Technical Appendix

CVSS Score
2.3/ 10
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

Affected Systems

Tornado web server applications using mixed-case cookie parameters (versions >= 6.5.5, < 6.5.8)

Affected Versions Detail

Product
Affected Versions
Fixed Version
tornado
tornadoweb
>= 6.5.5, < 6.5.86.5.8
AttributeDetail
CWE IDCWE-74
Attack VectorNetwork (AV:N)
CVSS Score2.3 (Low)
Exploit StatusProof-of-Concept (PoC)
KEV StatusNot Listed
ImpactCookie Attribute Injection / Security Policy Bypass

MITRE ATT&CK Mapping

T1539Steal Web Session Cookie
Credential Access
T1565Data Manipulation
Impair Defenses
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component

The product constructs an output that is used by a downstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the downstream component.

Vulnerability Timeline

Vulnerability resolved in fix commits by Tornado maintainers
2026-08-06
Public advisory disclosure and GHSA publication
2026-09-01

References & Sources

  • [1]GitHub Security Advisory GHSA-wwv5-g3v4-889x
  • [2]Tornado Security Advisory
  • [3]Tornado Pull Request 3704
  • [4]Tornado Pull Request 3706

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•13 minutes ago•CVE-2026-82395
5.3

CVE-2026-82395: Insecure Direct Object Reference (IDOR) in Sulu CMS Media Move Authorization

Sulu CMS, an open-source PHP content management system based on the Symfony framework, is affected by an Insecure Direct Object Reference (IDOR) vulnerability within its media relocation API. Authenticated users with restricted edit permissions can relocate media out of secure, unauthorized collections into folders they control, bypassing access controls entirely. This security issue is tracked under CVE-2026-82395 and GHSA-h6cx-gjxx-v25c.

Amit Schendel
Amit Schendel
0 views•6 min read
•about 2 hours ago•GHSA-8423-8FGW-73VQ
5.3

GHSA-8423-8FGW-73VQ: Memory Amplification Denial of Service in Tornado Multipart Form Parser

GHSA-8423-8FGW-73VQ is a pre-authentication denial of service vulnerability in the Tornado web server's handling of multipart/form-data. The flaw allows an unauthenticated remote attacker to cause memory exhaustion and CPU starvation by transmitting a crafted HTTP request containing a high density of boundary delimiters. Because Tornado splits the entire request body in memory prior to enforcing the max_parts validation threshold, the Python interpreter attempts to materialize a massive list of byte segments. This triggers an immediate memory exhaustion (OOM) crash or server-wide CPU starvation before the payload can be validated and rejected.

Alon Barad
Alon Barad
2 views•6 min read
•about 3 hours ago•GHSA-J8PM-GJ4C-RQ4X
7.5

GHSA-J8PM-GJ4C-RQ4X: Algorithmic Complexity Denial of Service in league/commonmark

The league/commonmark library is subject to multiple denial of service vulnerabilities. These stem from three independent algorithmic complexity weaknesses in Markdown parsing: regular expression backtracking, reference link normalization, and delimiter processing. Remote, unauthenticated attackers can exploit these flaws by submitting crafted Markdown input to exhaust CPU execution resources, leading to application-wide thread exhaustion.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 4 hours ago•GHSA-F8FG-PG57-V4J8
5.8

GHSA-f8fg-pg57-v4j8: Sanitizer Filter Bypass via Control Character Injection in league/commonmark

An inconsistency in whitespace handling between the PCRE regex engine, PHP's native trim function, and web browsers allows unauthenticated attackers to bypass XSS protections in the league/commonmark AttributesExtension by injecting a Form Feed (U+000C) control character.

Alon Barad
Alon Barad
2 views•7 min read
•about 5 hours ago•GHSA-JJV6-8J6V-6J52
7.5

GHSA-JJV6-8J6V-6J52: Algorithmic Complexity Denial of Service in league/commonmark

GHSA-JJV6-8J6V-6J52 details multiple algorithmic complexity issues in the SmartPunct and Attributes extensions of the league/commonmark PHP library, leading to high CPU consumption and Denial of Service (DoS) when parsing pathological Markdown inputs.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 6 hours ago•CVE-2026-78680
7.8

CVE-2026-78680: Arbitrary Code Execution in NLTK via Untrusted Graphviz Path Resolution

An Untrusted Search Path (CWE-426) vulnerability exists in the Natural Language Toolkit (NLTK) library when executing the Graphviz 'dot' utility. Because the library fails to enforce absolute paths when executing external commands, local attackers can plant a malicious binary named 'dot' inside the current working directory. The library then executes the malicious binary, resulting in local arbitrary code execution under the context of the running Python process.

Alon Barad
Alon Barad
6 views•6 min read