Loofah Gem Vulnerability: Potential XSS via Split JavaScript URIs
An early warning has been issued regarding a potential cross-site scripting (XSS) vulnerability in the Loofah gem's allowed_uri? method, which reportedly fails to detect javascript: URIs split by named whitespace character references. Developers using Loofah are advised to avoid using the allowed_uri? method with user-controlled input until a patch is released.
What happened
The Loofah gem, a popular Ruby library for HTML sanitization, appears to have a vulnerability in its allowed_uri? method. This method is under investigation for not properly detecting javascript: URIs that are split using named whitespace character references, which could potentially lead to cross-site scripting (XSS) attacks. The vulnerability is reported to affect multiple versions of the Loofah gem, as detailed in the GitHub Security Advisory GHSA-8WHX-365G-H9VV.
Developers utilizing the Loofah gem in their projects should review their usage of the allowed_uri? method, particularly when handling user-controlled input. It is recommended to temporarily avoid using this method until a patch is available. The specific versions affected and the fixed versions are listed in the advisory, but due to the complexity of the versioning, it is advised to consult the primary sources for the most accurate and up-to-date information.
This incident highlights the importance of regularly reviewing and updating dependencies in software projects. It is crucial for developers to stay informed about security advisories and apply patches promptly to mitigate potential risks. For the latest information and updates on this vulnerability, please refer to the GitHub Security Advisory linked above.
How 0Day mitigates this
loofah is anywhere in your dependency tree, the engineers who own the affected repositories get a push alert the moment it is flagged — no manual audit to remember to run.Read how this differs from waiting on a scanner to catch a known advisory, or see the exact, read-only access 0Day needs to do this for an organization.