{"id":"CVE-2026-59923","aliases":["CVE-2026-59923","GHSA-8c25-4j27-2rv3","PYSEC-2026-2211"],"related":[],"kind":"vulnerability","state":"published","title":"Mistune: XSS via percent-encoded javascript URI bypass in safe_url()","summary":"Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, HTMLRenderer.safe_url() does not block percent-encoded javascript URIs, allowing attacker-supplied Markdown links or images to bypass URL protections and execute script in rendered HTML. This issue is fixed in version 3.3.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, HTMLRenderer.safe_url() does not block percent-encoded javascript URIs, allowing attacker-supplied Markdown links or images to bypass URL protections and execute script in rendered HTML. This issue is fixed in version 3.3.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nAn XSS vulnerability in Mistune allows bypassing of safe_url() protections via percent-encoded javascript URIs.\n\n\n### Details\nThe vulnerability exists in HTMLRenderer.safe_url() in Mistune.\n\nThe function is intended to block harmful URL schemes such as \"javascript:\" by checking the prefix of the provided URL:\n\n    _url = url.lower()\n    if _url.startswith(self.HARMFUL_PROTOCOLS):\n        return \"#harmful-link\"\n\nHowever, the input URL is not URL-decoded before this check. Because of this, an attacker can use percent-encoding to bypass the filter. For example:\n\n    javascript%3Aalert(1)\n\nSince \"%3A\" is not decoded to \":\", the check does not detect the \"javascript:\" scheme.\n\nWhen rendered in a browser, the URL is decoded, resulting in execution of arbitrary JavaScript upon user interaction.\n\nThis effectively bypasses Mistune's built-in safe_url() protection mechanism.\n\n\n\n### PoC\n1. Install vulnerable version:\n\n    pip install mistune==3.2.0\n\n2. Run the following code:\n\n    import mistune\n\n    markdown = mistune.create_markdown()\n    html = markdown(\"[j](javascript%3Aalert(1))\")\n\n    print(html)\n\n3. Output:\n\n    <p><a href=\"javascript%3Aalert(1)\">j</a></p>\n\n4. Open the rendered HTML in a browser and click the link.\n\n5. The browser decodes \"%3A\" into \":\" and executes:\n\n    javascript:alert(1)\n\n\n### Impact\nThis is a cross-site scripting (XSS) vulnerability.\n\nAn attacker can craft a malicious Markdown link that executes JavaScript in the victim's browser when clicked.\n\nImpact includes:\n- Session hijacking (e.g., cookie theft)\n- Execution of arbitrary JavaScript in the victim's context\n- Potential account takeover depending on the application\n\nThis affects any application that renders user-controlled Markdown using Mistune without additional URL sanitization.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Mistune es un analizador de Markdown en Python con renderizadores y complementos. Antes de la versión 3.3.0, HTMLRenderer.safe_url() no bloquea las URIs de javascript codificadas por porcentaje, lo que permite que los enlaces o imágenes de Markdown proporcionados por el atacante eludan las protecciones de URL y ejecuten scripts en el HTML renderizado. Este problema se corrigió en la versión 3.3.0.","source":"nvd"}],"published":"2026-07-08T16:14:39.266Z","modified":"2026-10-25T17:10:00.197Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 3.3.0","status":"affected"}],"vendor":"lepture","product":"mistune","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.3.0"}],"ecosystem":"PyPI","package":"mistune","purl":"pkg:pypi/mistune","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.3.0"}],"vendor":"mistune_project","product":"mistune","cpe":"cpe:2.3:a:mistune_project:mistune:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.3.0"}],"ecosystem":"PyPI","package":"mistune","purl":"pkg:pypi/mistune","source":"pysec"}],"references":[{"url":"https://github.com/lepture/mistune/security/advisories/GHSA-8c25-4j27-2rv3","tags":["evidence","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/lepture/mistune/commit/c7101fcbb6e8790e8e39157c5ca2238fc6dd6cbc","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/lepture/mistune/releases/tag/v3.3.0","tags":["advisory","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59923","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/lepture/mistune","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/mistune/PYSEC-2026-2211.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-08T16:41:40.162Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-59923","url":"https://www.cve.org/CVERecord?id=CVE-2026-59923","licence":"CVE Terms of Use","modified":"2026-07-08T16:41:52.111Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8c25-4j27-2rv3","url":"https://github.com/advisories/GHSA-8c25-4j27-2rv3","licence":"CC-BY-4.0","modified":"2026-07-20T21:46:43.351Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-59923","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59923","licence":"Public domain","modified":"2026-10-25T17:10:00.197Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2211","url":"https://osv.dev/vulnerability/PYSEC-2026-2211","licence":"CC-BY-4.0","modified":"2026-07-13T07:15:29.095Z"}],"updatedAt":"2026-11-25T22:59:27.403Z","epss":{"score":0.00239,"percentile":0.15998,"date":"2026-12-01T12:00:22.000Z"}}