CVE-2026-6019
Analyzed Analyzed - Analysis Complete

Cross-Site Scripting in Python http.cookies.Morsel.js_output

Vulnerability report for CVE-2026-6019, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-04-22

Last updated on: 2026-05-28

Assigner: Python Software Foundation

Description

http.cookies.Morsel.js_output() returns an inline <script> snippet and only escapes " for JavaScript string context. It does not neutralize the HTML parser-sensitive sequence </script> inside the generated script element. Mitigation base64-encodes the cookie value to disallow escaping using cookie value.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-04-22
Last Modified
2026-05-28
Generated
2026-07-26
AI Q&A
2026-04-23
EPSS Evaluated
2026-07-25
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
python python to 3.15.0 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-116 The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
CWE-150 The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

The vulnerability in CVE-2026-6019 exists in Python's http.cookies.Morsel.js_output() method, which generates an inline <script> snippet embedding cookie values for JavaScript use.

The method only escapes double quotes (") within the JavaScript string context but does not neutralize the HTML parser-sensitive sequence </script>. This allows an attacker to inject malicious HTML or JavaScript by prematurely terminating the script element.

The issue is mitigated by base64-encoding the cookie value before embedding it in the JavaScript, preventing malicious sequences from breaking out of the script context.

Detection Guidance

This vulnerability involves the `http.cookies.Morsel.js_output()` method embedding cookie values directly into JavaScript without proper encoding, allowing HTML injection via sequences like </script>.

To detect this vulnerability on your system or network, you can inspect HTTP responses that include inline JavaScript snippets generated by this method and check if cookie values are embedded without Base64 encoding.

A practical approach is to capture HTTP traffic and search for inline <script> elements containing cookie values that include suspicious sequences such as </script> or unescaped characters.

  • Use a network capture tool like tcpdump or Wireshark to capture HTTP responses.
  • Run a command to filter HTTP responses containing inline scripts with cookie values, for example using grep:
  • tcpdump -A -s 0 'tcp port 80' | grep -i '<script' -A 5 | grep -E '</script>|"'
  • Alternatively, if you have access to the Python environment, review the source code or logs to verify if the `js_output()` method is used without Base64 encoding.

Since the fix involves Base64 encoding cookie values before embedding, detecting unencoded cookie values in inline scripts is a key indicator of vulnerability.

Impact Analysis

This vulnerability can lead to cross-site scripting (XSS) attacks by allowing an attacker to inject malicious scripts into web pages through cookie values.

Such XSS attacks can compromise user data, hijack user sessions, or perform unauthorized actions on behalf of the user.

However, the vulnerability is considered low severity and requires specific conditions to be exploitable.

Compliance Impact

The provided information does not specify how CVE-2026-6019 affects compliance with common standards and regulations such as GDPR or HIPAA.

Mitigation Strategies

To mitigate this vulnerability, you should ensure that cookie values embedded in JavaScript are base64-encoded before insertion. This prevents malicious sequences like </script> from breaking out of the script context and causing HTML injection or cross-site scripting (XSS) attacks.

Specifically, update to the fixed version of Python where the http.cookies.Morsel.js_output() method has been modified to base64-encode cookie values. This fix was merged on April 22, 2026, and backported automatically to Python versions 3.13 and 3.14.

If you are using affected Python versions prior to these fixes, consider applying the patch from the official Python repository or upgrading to a patched version to prevent exploitation.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-6019. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart