Ruby/loofah/2.25.1


Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri.

Loofah also includes some HTML sanitizers based on html5lib's safelist, which are a specific application of the general transformation functionality.

https://rubygems.org/gems/loofah
MIT

3 Security Vulnerabilities

Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons

Published date: 2026-07-15
Links:

Summary

Loofah::HTML5::Scrub.alloweduri? does not correctly reject javascript: or vbscript: URIs when the scheme is split by a numeric character reference that has no trailing semicolon. A browser decodes such references and resolves the URL to an executable javascript: scheme, while alloweduri? reports it safe.

This is a bypass of the fix for GHSA-46fp-8f5p-pf2m, which handled numeric character references with a trailing ; ( , , ) but did not cover the forms without semicolons.

Impact

Callers that validate a user-controlled URL with Loofah::HTML5::Scrub.alloweduri? and then render the approved value into an href or other browser-interpreted URI attribute may be vulnerable to cross-site scripting (XSS). This includes applications that call alloweduri? directly, as well as higher-level features built on top of it, such as Action Text 8.2's markdown link validation.

Credit

Responsibly reported by GitHub user @MoonFuji.

Affected versions: ["2.25.0", "2.25.1"]
Secure versions: [2.25.2]
Recommendation: Update to version 2.25.2.

Loofah `allowed_uri?` does not detect `javascript:` URIs split by named whitespace character references

Published date: 2026-07-15
CVE: 2026-73491
Links:

Summary

Loofah::HTML5::Scrub.allowed_uri? does not correctly reject javascript: URIs when the scheme is split or prefixed by the HTML5 named character references (tab) or (line feed).

This is a bypass of the fix for GHSA-46fp-8f5p-pf2m, which handled the equivalent numeric character references ( , , ) but did not cover the named forms.

Affected versions: ["2.25.0", "2.25.1"]
Secure versions: [2.25.2]
Recommendation: Update to version 2.25.2.

SVG `href` attribute bypasses local-reference restriction in Loofah

Published date: 2026-07-15
CVE: 2026-73490
CVSS V3: 4.7
Links:

Summary

Loofah's HTML5 sanitizer restricted only the xlink:href attribute on certain SVG elements to local, same-document references. Browsers also accept a plain href attribute as an alternative to the deprecated xlink:href per the SVG 2 spec, but Loofah did not apply the same restriction to it, allowing those elements to reference arbitrary external documents.

Impact

SVG can load and render external SVG content by reference. If the referenced external SVG is same-origin and contains scripts or other dangerous content, it could execute in the context of the sanitized document. can load external images, which can be used for tracking. Modern browsers restrict cross-origin fetches, which limits but does not eliminate the risk.

Applications that sanitize user-supplied SVG (directly, or as part of HTML) with Loofah's default allowlist are affected.

Credit

Found by the maintainer, Mike Dalessio, during a security audit.

Affected versions: ["1.2.1", "2.3.1", "2.3.0", "2.1.0.rc1", "0.4.4", "2.0.0", "0.4.1", "2.1.0", "1.1.0", "2.2.3", "2.0.3", "2.0.1", "1.0.0", "2.2.1", "2.6.0", "2.0.2", "0.4.6", "0.3.0", "2.4.0", "0.4.7", "0.2.1", "2.5.0", "2.7.0", "0.4.3", "0.3.1", "0.4.5", "1.0.0.beta.1", "0.4.0", "0.2.2", "2.2.0", "2.1.0.rc2", "2.2.2", "2.1.1", "0.2.0", "0.4.2", "1.2.0", "2.8.0", "2.9.0", "2.9.1", "2.10.0", "2.11.0", "2.12.0", "2.13.0", "2.14.0", "2.15.0", "2.16.0", "2.17.0", "2.18.0", "2.19.0", "2.19.1", "2.21.0.rc1", "2.20.0", "2.21.1", "2.21.0", "2.21.2", "2.21.3", "2.21.4", "2.22.0", "2.23.0", "2.23.1", "2.24.0", "2.24.1", "2.25.0", "2.25.1"]
Secure versions: [2.25.2]
Recommendation: Update to version 2.25.2.

65 Other Versions

Version License Security Released
2.25.2 MIT 2026-07-15 - 19:57 2 months
2.25.1 MIT 3 2026-03-17 - 17:35 6 months
2.25.0 MIT 5 2025-12-15 - 21:18 9 months
2.24.1 MIT 1 2025-05-12 - 12:32 over 1 year
2.24.0 MIT 1 2025-01-01 - 03:05 over 1 year
2.23.1 MIT 1 2024-10-25 - 12:43 almost 2 years
2.23.0 MIT 1 2024-10-24 - 12:59 almost 2 years
2.22.0 MIT 1 2023-11-13 - 21:41 almost 3 years
2.21.4 MIT 1 2023-10-10 - 17:55 almost 3 years
2.21.3 MIT 1 2023-05-15 - 21:10 over 3 years
2.21.2 MIT 1 2023-05-11 - 15:39 over 3 years
2.21.1 MIT 1 2023-05-10 - 14:39 over 3 years
2.21.0 MIT 1 2023-05-10 - 13:50 over 3 years
2.21.0.rc1 MIT 1 2023-04-03 - 02:21 over 3 years
2.20.0 MIT 1 2023-04-01 - 17:07 over 3 years
2.19.1 MIT 1 2022-12-13 - 13:22 almost 4 years
2.19.0 MIT 7 2022-09-14 - 13:38 about 4 years
2.18.0 MIT 7 2022-05-11 - 18:42 over 4 years
2.17.0 MIT 7 2022-04-28 - 13:35 over 4 years
2.16.0 MIT 7 2022-04-01 - 18:27 over 4 years
2.15.0 MIT 7 2022-03-14 - 17:09 over 4 years
2.14.0 MIT 7 2022-02-11 - 19:10 over 4 years
2.13.0 MIT 7 2021-12-10 - 05:21 almost 5 years
2.12.0 MIT 7 2021-08-11 - 17:30 about 5 years
2.11.0 MIT 7 2021-07-31 - 21:31 about 5 years
2.10.0 MIT 7 2021-06-06 - 17:01 over 5 years
2.9.1 MIT 7 2021-04-07 - 15:23 over 5 years
2.9.0 MIT 7 2021-01-14 - 21:36 over 5 years
2.8.0 MIT 7 2020-11-25 - 21:16 almost 6 years
2.7.0 MIT 7 2020-08-26 - 19:33 about 6 years
2.6.0 MIT 7 2020-06-16 - 21:22 over 6 years
2.5.0 MIT 7 2020-04-05 - 20:51 over 6 years
2.4.0 MIT 7 2019-11-25 - 18:45 almost 7 years
2.3.1 MIT 7 2019-10-22 - 13:14 almost 7 years
2.3.0 MIT 9 2019-09-28 - 17:37 almost 7 years
2.2.3 MIT 9 2018-10-30 - 13:01 almost 8 years
2.2.2 MIT 11 2018-03-22 - 15:10 over 8 years
2.2.1 MIT 11 2018-03-19 - 20:32 over 8 years
2.2.0 MIT 13 2018-02-11 - 22:23 over 8 years
2.1.1 MIT 11 2017-09-25 - 01:11 almost 9 years
2.1.0 MIT 11 2017-09-24 - 20:48 almost 9 years
2.1.0.rc2 MIT 9 2016-01-11 - 18:31 over 10 years
2.1.0.rc1 MIT 9 2015-08-17 - 23:21 about 11 years
2.0.3 MIT 9 2015-08-17 - 18:13 about 11 years
2.0.2 MIT 9 2015-05-05 - 19:59 over 11 years
2.0.1 MIT 9 2014-08-21 - 21:28 about 12 years
2.0.0 MIT 9 2014-05-09 - 22:51 over 12 years
1.2.1 UNKNOWN 9 2012-04-14 - 19:08 over 14 years
1.2.0 UNKNOWN 9 2011-08-08 - 16:54 about 15 years
1.1.0 UNKNOWN 9 2011-08-08 - 05:30 about 15 years