# CVE-2023-23913: rails-ujs vulnerable to DOM Based Cross-site Scripting contenteditable HTML Elements

> Attackers can execute arbitrary JavaScript via DOM-based XSS when users paste malicious HTML into contenteditable elements using rails-ujs.

- **Severity:** Medium 6.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **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:** 9 Jan 2025
- **Updated:** 9 Jan 2025
- **Also known as:** DEBIAN-CVE-2023-23913, GHSA-xp5h-f8jf-rc8q, OESA-2024-1774, OESA-2024-1775, OESA-2024-1776, SUSE-SU-2023:3813-1, UBUNTU-CVE-2023-23913

## What is CVE-2023-23913?

CVE-2023-23913 is a medium-severity cross-site scripting vulnerability in rails-ujs, published on 9 Jan 2025. 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

There is a potential DOM based cross-site scripting issue in rails-ujs which leverages the Clipboard API to target HTML elements that are assigned the contenteditable attribute. This has the potential to occur when pasting malicious HTML content from the clipboard that includes a data-method, data-remote or data-disable-with attribute.

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

## Which versions are affected by CVE-2023-23913?

4 open source packages ship an affected version, including actionview.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `actionview` | RubyGems | From 5.1.0 | 6.1.7.3 |
| `actionview` | RubyGems | From 5.1.0 | 6.1.7.3 |
| `actionview` | RubyGems | From 7.0.0 | 7.0.4.3 |
| `actionview` | RubyGems | From 7.0.0 | 7.0.4.3 |
| `rubygem-actionview-5_1` | SUSE:Linux Enterprise High Availability Extension 15 SP1 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | SUSE:Linux Enterprise High Availability Extension 15 SP2 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | SUSE:Linux Enterprise High Availability Extension 15 SP3 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | SUSE:Linux Enterprise High Availability Extension 15 SP4 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | SUSE:Linux Enterprise High Availability Extension 15 SP5 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | openSUSE:Leap 15.4 | All versions | 5.1.4-150000.3.9.1 |
| `rubygem-actionview-5_1` | openSUSE:Leap 15.5 | All versions | 5.1.4-150000.3.9.1 |

## How do I fix CVE-2023-23913?

Upgrade actionview to a fixed version for your release line: 6.1.7.3 or 7.0.4.3.

## Is CVE-2023-23913 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-23913 and fix it if it is affected.

What it is: CVE-2023-23913 is a medium-severity cross-site scripting vulnerability in rails-ujs, published on 9 Jan 2025. 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-2023-23913 in the wild and no public exploit code.

Affected packages and fixed versions:
- actionview (RubyGems): affected from 5.1.0; fixed in 6.1.7.3
- actionview (RubyGems): affected from 5.1.0; fixed in 6.1.7.3
- actionview (RubyGems): affected from 7.0.0; fixed in 7.0.4.3
- actionview (RubyGems): affected from 7.0.0; fixed in 7.0.4.3

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-2023-23913/ (Markdown: https://insights.sbomify.com/CVE-2023-23913/index.md)
```

## Sources

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

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