{"id":"CVE-2026-105829","aliases":["CVE-2026-105829","GHSA-97jj-33gv-5xf9"],"related":[],"kind":"vulnerability","state":"published","title":"League CommonMark 1.3.0 before 2.10.2 Stored XSS via DisallowedRawHtml Bypass","summary":"League CommonMark from 1.3.0 before 2.10.2 contains a cross-site scripting vulnerability that allows users posting Markdown to bypass the DisallowedRawHtml extension by ending raw HTML with a bare disallowed tag name. Attackers can place a lone <script or <iframe line followed by a block supplying attributes like src or onload, executing stored scripts in viewers' browsers under default GFM settings.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"League CommonMark from 1.3.0 before 2.10.2 contains a cross-site scripting vulnerability that allows users posting Markdown to bypass the DisallowedRawHtml extension by ending raw HTML with a bare disallowed tag name. Attackers can place a lone <script or <iframe line followed by a block supplying attributes like src or onload, executing stored scripts in viewers' browsers under default GFM settings.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe `DisallowedRawHtml` extension does not escape a disallowed tag when the tag name is the last thing in the raw HTML. A Markdown line containing just `<script` is emitted unchanged, and the next block can supply its attributes. With the shipped GFM defaults this allows stored XSS by anyone who can post Markdown.\n\n## Details\n\n`DisallowedRawHtmlRenderer` escapes tags with this regex:\n\n```\n/<(\\/?(?:title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)[\\s\\/>])/i\n```\n\nThe trailing character class requires one character after the tag name. The block parser does not: `RegexHelper::PARTIAL_HTMLBLOCKOPEN` accepts end of line after a tag name, so `<script` alone opens an HTML block. Because a rendered `HtmlBlock` has no trailing newline, the regex has nothing to match and the `<` passes through.\n\nIn the browser the newline is still present, so the tag name terminates there and whatever follows becomes attributes.\n\nThis is the same filter that GHSA-4v6x-c7xx-hw9f fixed in 2.8.1. That fix widened the character class but still requires one character, so this case was not covered.\n\n## Reproduction\n\nRender this with `GithubFlavoredMarkdownConverter` and default settings:\n\n```\n<div>\n<script\n\n<span src=\"/evil.js\">\n```\n\nOutput:\n\n```html\n<div>\n<script\n<span src=\"/evil.js\">\n```\n\nA browser parses that as `<script src=\"/evil.js\">` with a junk `<span` attribute, and the script runs. `<iframe` with `<span onload=\"...\">` works the same way and does not need a later `</script>` in the page.\n\nControl: `<script src=\"/evil.js\"></script>` is correctly escaped to `&lt;script src=\"/evil.js\">&lt;/script>`.\n\n## Affected versions\n\n1.3.0 (when the extension was added) through the current release. The `</style` and mid-line forms are only affected as continuation lines inside an already-open HTML block.\n\n## Preconditions\n\n- `html_input` is `allow` (the default)\n- The `DisallowedRawHtml` extension is active, which the GFM extension enables automatically\n- Untrusted users can post Markdown\n\nSetting `html_input` to `escape` or `strip` fully mitigates this.\n\n## Suggested fix\n\nAllow end of string after the tag name:\n\n```php\n$regex = \\sprintf('/<(\\/?(?:%s))([\\s\\/>]|$)/i', \\implode('|', \\array_map('preg_quote', $tags)));\n\nreturn \\preg_replace($regex, '&lt;$1$2', $rendered);\n```\n\nThis escapes every bypass shape above and leaves `<div>`, `<scripts>` and `<span class=\"a\">` untouched. The existing unit test only covers tag names followed by another character, so a case for a bare tag name should be added.","format":"markdown","source":"ghsa"}],"published":"2026-09-30T15:36:33.000Z","modified":"2026-11-20T15:17:37.470Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"VulnCheck","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"}],"cwes":["CWE-78","CWE-79","CWE-80"],"affected":[{"ranges":[{"type":"semver","introduced":"1.3.0","fixed":"2.10.2","status":"affected"}],"vendor":"thephpleague","product":"commonmark","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"1.3.0","status":"affected","fixed":"2.10.2"}],"ecosystem":"Packagist","package":"league/commonmark","purl":"pkg:composer/league/commonmark","source":"ghsa"}],"references":[{"url":"https://github.com/thephpleague/commonmark/security/advisories/GHSA-97jj-33gv-5xf9","tags":["exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/league-commonmark-1.3.0-before-2.10.2-stored-xss-via-disallowedrawhtml-bypass","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/thephpleague/commonmark/commit/411afcc2a7402756d96c89af8882c724d12d47ca","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/thephpleague/commonmark","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/thephpleague/commonmark/releases/tag/2.10.2","tags":["web"],"sources":["ghsa"]}],"credits":["4n86rakam1"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-10-10T03:05:16.269Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-105829","url":"https://www.cve.org/CVERecord?id=CVE-2026-105829","licence":"CVE Terms of Use","modified":"2026-11-20T14:31:12.026Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-97jj-33gv-5xf9","url":"https://github.com/advisories/GHSA-97jj-33gv-5xf9","licence":"CC-BY-4.0","modified":"2026-10-09T02:56:07.054Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-105829","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-105829","licence":"Public domain","modified":"2026-11-20T15:17:37.470Z"}],"updatedAt":"2026-11-25T22:59:43.170Z","epss":{"score":0.0025,"percentile":0.17503,"date":"2026-12-01T12:00:22.000Z"}}