{"id":"CVE-2025-52561","aliases":["CVE-2025-52561","JLSEC-2025-39","GHSA-3mj7-qxh9-6q4p"],"related":[],"kind":"vulnerability","state":"published","title":"HTMLSanitizer.jl Possible XSS","summary":"HTMLSanitizer.jl is a Whitelist-based HTML sanitizer. Prior to version 0.2.1, when adding the style tag to the whitelist, content inside the tag is incorrectly unescaped, and closing tags injected as content are interpreted as real HTML, enabling tag injection and JavaScript execution. This could result in possible cross-site scripting (XSS) in any HTML that is sanitized with this library. This issue has been patched in version 0.2.1. A workaround involves adding the math and svg elements to the whitelist manually.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"HTMLSanitizer.jl is a Whitelist-based HTML sanitizer. Prior to version 0.2.1, when adding the style tag to the whitelist, content inside the tag is incorrectly unescaped, and closing tags injected as content are interpreted as real HTML, enabling tag injection and JavaScript execution. This could result in possible cross-site scripting (XSS) in any HTML that is sanitized with this library. This issue has been patched in version 0.2.1. A workaround involves adding the math and svg elements to the whitelist manually.","source":"cvelist"},{"lang":"en","text":"### Description\n\nWhen adding the style tag to the whitelist, content inside the tag is incorrectly unescaped, and closing tags injected as content are interpreted as real HTML, enabling tag injection and JavaScript execution.\n\nThis behavior is similar to the sanitization bypass described in CVE-2020-4054 (Sanitize for Ruby).\n\n```\nusing HTMLSanitizer\n\nuser_input = \"<svg><style>&lt;/style>&lt;img src onerror=alert(1)>\"\n\nwhitelist = deepcopy(HTMLSanitizer.WHITELIST)\nappend!(whitelist[:elements], [\"style\"])\nresult = sanitize(user_input, whitelist=whitelist)\nprint(result) # <style></style><img src onerror=alert(1)></style>\n```\n\n### Impact\n\nPossible XSS in any HTML that is sanitized with this library.\n\n### Patches\n\nUsers should upgrade to `v0.2.1` as soon as possible. In this version, `svg` and `math` tags are removed by default.\n\n### Workarounds\n\nAdd the `math` and `svg` elements to your whitelist manually via e.g.\n\n```\nwhitelist = deepcopy(HTMLSanitizer.WHITELIST)\nappend!(whitelist[:removed_elements], [\"math\", \"svg\"])\n```\n\nand pass this modified whitelist to `sanitize`:\n\n```\nsanitize(user_input, whitelist=whitelist)\n```\n\n### References\n\n[PR for fix](https://github.com/JuliaComputing/HTMLSanitizer.jl/pull/5)\n\n### Credits\n\nThanks to  Chen T for finding and reporting this issue.","format":"markdown","source":"jlsec"},{"lang":"es","text":"HTMLSanitizer.jl es un depurador de HTML basado en listas blancas. Antes de la versión 0.2.1, al añadir la etiqueta de estilo a la lista blanca, el contenido dentro de la etiqueta se eliminaba incorrectamente del escape, y las etiquetas de cierre inyectadas como contenido se interpretaban como HTML real, lo que permitía la inyección de etiquetas y la ejecución de JavaScript. Esto podía provocar cross-site scripting (XSS) en cualquier HTML depurado con esta librería. Este problema se ha corregido en la versión 0.2.1. Una solución alternativa consiste en añadir manualmente los elementos math y SVG a la lista blanca.","source":"nvd"}],"published":"2025-06-23T21:00:13.699Z","modified":"2026-07-18T04:00:04.074Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"Julia Security Advisories","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 0.2.1","status":"affected"}],"vendor":"JuliaComputing","product":"HTMLSanitizer.jl","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.1"}],"ecosystem":"Julia","package":"HTMLSanitizer","purl":"pkg:julia/HTMLSanitizer?uuid=9a15a9f4-ddd5-46ee-89fc-c219f813dd6f","source":"jlsec"}],"references":[{"url":"https://github.com/JuliaComputing/HTMLSanitizer.jl/security/advisories/GHSA-3mj7-qxh9-6q4p","tags":["web","x-refsource-confirm"],"sources":["cvelist","jlsec","nvd"]},{"url":"https://github.com/JuliaComputing/HTMLSanitizer.jl/pull/5","tags":["web","x-refsource-misc"],"sources":["cvelist","jlsec","nvd"]},{"url":"https://github.com/JuliaComputing/HTMLSanitizer.jl/commit/0c3dc359e4a64c39cac609541945c0518feef040","tags":["web","x-refsource-misc"],"sources":["cvelist","jlsec","nvd"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-06-24T13:46:34.375Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-52561","url":"https://www.cve.org/CVERecord?id=CVE-2025-52561","licence":"CVE Terms of Use","modified":"2025-06-24T18:04:25.804Z"},{"source":"jlsec","name":"Julia Security Advisories","id":"JLSEC-2025-39","url":"https://osv.dev/vulnerability/JLSEC-2025-39","licence":"CC-BY-4.0","modified":"2026-07-18T04:00:04.074Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-52561","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-52561","licence":"Public domain","modified":"2026-06-17T09:36:40.897Z"}],"updatedAt":"2026-11-25T22:58:59.537Z","epss":{"score":0.00924,"percentile":0.6144,"date":"2026-12-01T12:00:22.000Z"}}