{"id":"CVE-2026-126206","aliases":["CVE-2026-126206","GHSA-jcff-cj73-4w4f"],"related":[],"kind":"vulnerability","state":"published","title":"Loofah allowed_uri? treats data:text&sol;html as safe text/plain","summary":"Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. In 2.25.2, Loofah::HTML5::Scrub.allowed_uri? treats a data URI mediatype containing the HTML5 named solidus reference &sol; as malformed and falls back to the allowed text/plain, while a browser decodes the reference and interprets the same value as text/html. An application that validates a user-controlled URL with this helper and renders the approved value in href or another browser-interpreted URI attribute can allow cross-site scripting. Rails::HTML::Sanitizer.allowed_uri? re-exports the affected helper. Loofah's default sanitize() path is not affected because Nokogiri decodes the entity before URI validation. This issue is fixed in version 2.25.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. In 2.25.2, Loofah::HTML5::Scrub.allowed_uri? treats a data URI mediatype containing the HTML5 named solidus reference &sol; as malformed and falls back to the allowed text/plain, while a browser decodes the reference and interprets the same value as text/html. An application that validates a user-controlled URL with this helper and renders the approved value in href or another browser-interpreted URI attribute can allow cross-site scripting. Rails::HTML::Sanitizer.allowed_uri? re-exports the affected helper. Loofah's default sanitize() path is not affected because Nokogiri decodes the entity before URI validation. This issue is fixed in version 2.25.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`Loofah::HTML5::Scrub.allowed_uri?` returns `true` for a `data:` URI whose mediatype is written with the HTML5 named character reference `&sol;` in place of the solidus. Loofah reads that mediatype as malformed and falls back to the allowed `text/plain`, while a browser decodes the reference and reads the same URI as `text/html`.\n\n## Details\n\n`allowed_uri?` decodes HTML entities with `CGI.unescapeHTML`, which handles numeric character references but not HTML5 named character references. `&sol;` therefore survives normalization, so the mediatype carries no `/`, fails the MIME grammar, and falls back to the allowed `text/plain` under the WHATWG rule for a malformed mediatype.\n\n`&colon;`, `&sol;`, `&Tab;` and `&NewLine;` are the only named character references in the HTML5 table that decode to characters that change how a URI parses (U+003A, U+002F, U+0009 and U+000A; there is no named reference for U+000D), so this closes the set.\n\nLoofah's default `sanitize()` path is **not** affected, because Nokogiri decodes the entity during parsing before Loofah evaluates the URI. This issue affects only callers of the public `allowed_uri?` string-level helper that pass it HTML-encoded strings.\n\n## Impact\n\nApplications that validate a user-controlled URL with `Loofah::HTML5::Scrub.allowed_uri?` and then render the approved value into an `href` or another browser-interpreted URI attribute may be vulnerable to cross-site scripting. `Rails::HTML::Sanitizer.allowed_uri?` re-exports the same helper.\n\n## Mitigation\n\nUpgrade to Loofah >= 2.25.3.\n\n## Credit\n\nResponsibly reported by GitHub user @ngpestelos.","format":"markdown","source":"ghsa"}],"published":"2026-11-12T20:51:36.537Z","modified":"2026-11-13T23:17:15.420Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79","CWE-184"],"affected":[{"ranges":[{"version":"= 2.25.2","status":"affected"}],"vendor":"flavorjones","product":"loofah","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.25.2","status":"affected","fixed":"2.25.3"}],"ecosystem":"RubyGems","package":"loofah","purl":"pkg:gem/loofah","source":"ghsa"}],"references":[{"url":"https://github.com/flavorjones/loofah/security/advisories/GHSA-jcff-cj73-4w4f","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/flavorjones/loofah/pull/324","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/flavorjones/loofah/commit/ad92002966053309f83b550861e2ef04bc714744","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/flavorjones/loofah/releases/tag/v2.25.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/flavorjones/loofah","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-jcff-cj73-4w4f.yml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-11-13T16:33:59.076Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-126206","url":"https://www.cve.org/CVERecord?id=CVE-2026-126206","licence":"CVE Terms of Use","modified":"2026-11-13T22:32:32.734Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jcff-cj73-4w4f","url":"https://github.com/advisories/GHSA-jcff-cj73-4w4f","licence":"CC-BY-4.0","modified":"2026-11-12T21:00:03.782Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-126206","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-126206","licence":"Public domain","modified":"2026-11-13T23:17:15.420Z"}],"updatedAt":"2026-11-25T22:59:50.564Z","epss":{"score":0.00436,"percentile":0.39643,"date":"2026-12-01T12:00:22.000Z"}}