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.
Published: 2026-04-22
Score: 2.1 Low
EPSS: < 1% Very Low
KEV: No
Impact: Cross‑site scripting via cookie rendering
Action: Patch
AI Analysis

Impact

The http.cookies.Morsel.js_output function emits an inline <script> element, escaping only the double‑quote character for JavaScript string contexts. It fails to neutralize the HTML‑parser sensitive sequence </script> that could appear inside a cookie value. Because the value is inserted directly into the script tag, an attacker who can manipulate the cookie could close the script prematurely and inject arbitrary JavaScript, resulting in cross‑site scripting. The weakness is classified as CWE‑79. The CVSS score of 2.1 indicates a low severity, but the vulnerability remains exploitable when the vulnerable code is used.

Affected Systems

All CPython implementations provided by the Python Software Foundation that employ the http.cookies.Morsel.js_output method are affected. The CVE record does not specify exact affected releases, so any CPython version prior to the commit that base64‑encodes cookie values for js_output is potentially vulnerable. Applications that render cookie values via js_output should verify that the patched code is present.

Risk and Exploitability

The EPSS score is less than 1 %, and the vulnerability is not listed in CISA’s KEV catalog, indicating that no active exploitation is currently reported. Nonetheless, if an attacker can control the cookie value, they can inject malicious scripts into the page, compromising confidentiality and integrity of user data. The risk is mitigated by applying the patched CPython release or by ensuring that cookie values are properly sanitized before being embedded in a script element.

Generated by OpenCVE AI on April 28, 2026 at 20:42 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update CPython to a release that contains the commit which base64‑encodes cookie values for js_output.
  • In applications that call http.cookies.Morsel.js_output, ensure that cookie values are base64‑encoded or otherwise sanitized before rendering the script element.
  • If a patch cannot be applied immediately, implement server‑side validation that rejects or encodes any cookie value containing the sequence </script> to prevent premature script termination.

Generated by OpenCVE AI on April 28, 2026 at 20:42 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 29 Apr 2026 16:15:00 +0000


Sat, 25 Apr 2026 12:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-79
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.8, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N'}

threat_severity

Moderate


Wed, 22 Apr 2026 22:15:00 +0000

Type Values Removed Values Added
First Time appeared Python
Python cpython
Vendors & Products Python
Python cpython

Wed, 22 Apr 2026 20:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 22 Apr 2026 20:00:00 +0000

Type Values Removed Values Added
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.
Title BaseCookie.js_output() does not neutralize embedded characters
Weaknesses CWE-150
References
Metrics cvssV4_0

{'score': 2.1, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: PSF

Published:

Updated: 2026-04-29T15:31:09.049Z

Reserved: 2026-04-09T15:35:00.668Z

Link: CVE-2026-6019

cve-icon Vulnrichment

Updated: 2026-04-22T20:02:21.519Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-04-22T20:16:42.617

Modified: 2026-04-29T16:16:28.240

Link: CVE-2026-6019

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-04-22T19:28:08Z

Links: CVE-2026-6019 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-04-28T20:45:16Z

Weaknesses