CVE-2026-53538
Incorrect semicolon handling in form data allows parameter smuggling.
- CVSS 3.7
- CWE-436
- Input Validation and Sanitization
- Remote
Python-Multipart is a streaming multipart parser for Python. Prior to 0.0.30, QuerystringParser treated ; as a field separator in application/x-www-form-urlencoded bodies, in addition to &. The WHATWG URL standard, modern browsers, and Python's urllib.parse (since the CVE-2021-23336 fix) treat only & as a separator. This creates a parser differential: the same bytes are tokenized into different fields than a WHATWG compliant intermediary would produce, allowing an attacker to smuggle extra form fields past an upstream body inspecting component. This vulnerability is fixed in 0.0.30.
- CWE
- CWE-436
- CVSS base score
- 3.7
- Published
- 2026-06-22
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Algorithm
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Fixed by upgrading
- Yes
Solution
Upgrade python-multipart to version 0.0.30 or later.
Vulnerable code sample
# This code requires a vulnerable version of python-multipart (e.g., 0.0.5).
# It demonstrates how the parser incorrectly treats ';' as a field separator.
from multipart.querystring_parser import QuerystringParser
# A payload where an 'is_admin=true' field is smuggled using a semicolon.
# A compliant parser would see 'user' with the value 'guest;is_admin=true'.
# The vulnerable parser sees 'user=guest' and a separate 'is_admin=true' field.
smuggled_payload = b"user=guest;is_admin=true&action=view"
# Dictionary to hold the parsed form data
parsed_form = {}
def on_part_begin(name: bytes):
"""Callback triggered when a new form field is found."""
parsed_form[name.decode('latin-1')] = b''
def on_part_data(data: bytes, name: bytes):
"""Callback triggered with data for the current form field."""
parsed_form[name.decode('latin-1')] += data
# Instantiate the vulnerable parser with the callbacks
parser = QuerystringParser(
on_part_begin=on_part_begin,
on_part_data=on_part_data
)
# Process the malicious payload
parser.write(smuggled_payload)
parser.finalize()
# The output shows that 'is_admin' was parsed as a separate field,
# demonstrating the smuggling vulnerability.
print(f"Parsed by vulnerable version: {parsed_form}")Patched code sample
import urllib.parse
def fixed_querystring_parser(body: bytes) -> dict:
"""
Represents the fixed parser. It correctly parses an
application/x-www-form-urlencoded body by treating only '&' as a field
separator, adhering to the WHATWG standard. Semicolons are now
correctly treated as part of the value.
"""
fields = {}
# The core of the fix: The string is split *only* by b"&".
# The vulnerable version would also split by b";".
for pair in body.split(b"&"):
if b"=" in pair:
key, value = pair.split(b"=", 1)
# Use urllib.parse for proper decoding of URL-encoded values.
key_str = urllib.parse.unquote_plus(key.decode("latin-1"))
value_str = urllib.parse.unquote_plus(value.decode("latin-1"))
fields[key_str] = value_str
return fields
# A payload that would be vulnerable to the old parser.
# The old parser would see two fields: 'user' and 'role'.
malicious_payload = b"user=guest;role=admin"
# Using the fixed parser, the semicolon is treated as part of the value.
# The 'role=admin' field is not injected.
parsed_data = fixed_querystring_parser(malicious_payload)
# This will print: {'user': 'guest;role=admin'}
# This demonstrates that the smuggled 'role' field was not created.
print(parsed_data)Payload
username=guest;is_admin=true
Cite this entry
@misc{vaitp:cve202653538,
title = {{Incorrect semicolon handling in form data allows parameter smuggling.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-53538},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-53538/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
