# CVE-2024-53988: Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0

> Attackers can inject malicious scripts via specific HTML tags in Rails applications using the rails-html-sanitizer library with non-default configurations.

- **Severity:** Low 2.3 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Dec 2024
- **Updated:** 3 Dec 2024
- **Also known as:** GHSA-cfjx-w229-hgx5, UBUNTU-CVE-2024-53988

## What is CVE-2024-53988?

CVE-2024-53988 is a low-severity cross-site scripting vulnerability in rails-html-sanitizer, published on 2 Dec 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

rails-html-sanitizer is responsible for sanitizing HTML fragments in Rails applications. There is a possible XSS vulnerability with certain configurations of Rails::HTML::Sanitizer 1.6.0 when used with Rails >= 7.1.0. A possible XSS vulnerability with certain configurations of Rails::HTML::Sanitizer may allow an attacker to inject content if HTML5 sanitization is enabled and the application developer has overridden the sanitizer's allowed tags where the "math", "mtext", "table", and "style" elements are allowed and either either "mglyph" or "malignmark" are allowed. This vulnerability is fixed in 1.6.1.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2024-53988?

2 open source packages ship an affected version, including rails-html-sanitizer. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `rails-html-sanitizer` | RubyGems | From 1.6.0 | 1.6.1 |
| `rails-html-sanitizer` | RubyGems | From 1.6.0 | 1.6.1 |

Products: Rubyonrails Rails Html Sanitizers.

## How do I fix CVE-2024-53988?

Upgrade rails-html-sanitizer to 1.6.1 or later.

## Is CVE-2024-53988 being exploited?

There is no known exploitation of CVE-2024-53988 in the wild and no public exploit code.

## Other vulnerabilities in rails-html-sanitizer

- [CVE-2024-53985](https://insights.sbomify.com/CVE-2024-53985/): Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0 (low 2.3)
- [CVE-2024-53986](https://insights.sbomify.com/CVE-2024-53986/): Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0 (low 2.3)
- [CVE-2024-53987](https://insights.sbomify.com/CVE-2024-53987/): Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0 (low 2.3)
- [CVE-2024-53989](https://insights.sbomify.com/CVE-2024-53989/): Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0 (low 2.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-53988 and fix it if it is affected.

What it is: CVE-2024-53988 is a low-severity cross-site scripting vulnerability in rails-html-sanitizer, published on 2 Dec 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-53988 in the wild and no public exploit code.

Affected packages and fixed versions:
- rails-html-sanitizer (RubyGems): affected from 1.6.0; fixed in 1.6.1
- rails-html-sanitizer (RubyGems): affected from 1.6.0; fixed in 1.6.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-53988/ (Markdown: https://insights.sbomify.com/CVE-2024-53988/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-53988
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-53988
- OSV: https://osv.dev/vulnerability/CVE-2024-53988

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-53988/
Summaries are generated and may contain mistakes; the official description above is the record.
