CVE-2026-6019

BaseCookie.js_output() does not neutralize embedded characters

Published Apr 22, 2026 CVSS 4.0 · 2.1 Low EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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, CWE‑116, and CWE‑150. 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.

Remediation

No solution or workaround provided in the CVE record.

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 May 18, 2026 at 18:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4827-1 python3.11 security update
Ubuntu USN Ubuntu USN USN-8509-1 Python vulnerabilities
History
Type Values Removed Values Added
First Time appeared Python python
CPEs cpe:2.3:a:python:cpython:*:*:*:*:*:*:*:* cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
Vendors & Products Python python
Type Values Removed Values Added
Weaknesses CWE-116
CPEs cpe:2.3:a:python:cpython:*:*:*:*:*:*:*:*
Metrics 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'}

cvssV3_1

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

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

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

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

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'}

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-150

    Improper Neutralization of Escape, Meta, or Control Sequences

  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
PSF
Published
Updated
Nov 10, 2026, 12:40 PM
Reserved
Apr 9, 2026, 3:35 PM
Status
Modified
Published
Apr 22, 2026, 8:16 PM
Modified
Nov 10, 2026, 1:19 PM
Severity
Moderate
Public date
Apr 22, 2026, 7:28 PM