BIT-python-2026-0672: Header injection in http.cookies.Morsel
When using http.cookies.Morsel, user-controlled cookie values and parameters can allow injecting HTTP headers into messages. Patch rejects all control characters within cookie names, values, and parameters.
Affected Software
Event History
Frequently Asked Questions
What input must be attacker-controlled for exploitation to be possible?
An attacker must be able to supply or influence cookie names, values, or parameters passed to http.cookies.Morsel. Exploitation relies on control characters being accepted in those fields, allowing HTTP headers to be injected into messages.
How can exposure be reduced if the patch cannot be applied immediately?
Do not pass untrusted data directly into Morsel cookie names, values, or parameters. Reject or remove all control characters from those inputs before constructing cookies.
How can I determine whether an application may be affected?
Review uses of http.cookies.Morsel and trace the sources of cookie names, values, and parameters. The application may be affected where any of those fields can contain user-controlled data without validation that rejects control characters.