CVE-2023-23913

6.3 MEDIUM

📋 TL;DR

This DOM-based cross-site scripting vulnerability in rails-ujs allows attackers to inject malicious scripts when users paste clipboard content into contenteditable HTML elements. It affects Ruby on Rails applications using rails-ujs with contenteditable elements. Attackers could steal session cookies, redirect users, or perform actions on behalf of authenticated users.

💻 Affected Systems

Products:
  • Ruby on Rails
  • rails-ujs
Versions: All versions before rails-ujs 7.0.5 and Rails 7.0.4.2
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using contenteditable HTML elements with rails-ujs JavaScript library

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full account takeover, session hijacking, data theft, and unauthorized actions performed as authenticated users

🟠

Likely Case

Session cookie theft leading to account compromise, phishing attacks, or defacement of user-specific content

🟢

If Mitigated

Limited impact with proper Content Security Policy, input sanitization, and user awareness about pasting untrusted content

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user interaction (pasting malicious content) but no authentication. Proof-of-concept exists in public discussions.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: rails-ujs 7.0.5 or Rails 7.0.4.2

Vendor Advisory: https://discuss.rubyonrails.org/t/cve-2023-23913-dom-based-cross-site-scripting-in-rails-ujs-for-contenteditable-html-elements/82468

Restart Required: Yes

Instructions:

1. Update rails-ujs to version 7.0.5 or higher. 2. For Rails applications, update to Rails 7.0.4.2 or higher. 3. Restart your application server. 4. Clear browser caches and test functionality.

🔧 Temporary Workarounds

Disable contenteditable elements

all

Remove or disable contenteditable attribute from HTML elements in your application

Find and remove contenteditable="true" attributes from HTML templates

Implement Content Security Policy

all

Add strict CSP headers to prevent script execution from untrusted sources

Add Content-Security-Policy header with script-src 'self'

🧯 If You Can't Patch

  • Implement input sanitization for all contenteditable elements using DOMPurify or similar library
  • Educate users about risks of pasting untrusted content into editable fields

🔍 How to Verify

Check if Vulnerable:

Check if your application uses rails-ujs version < 7.0.5 and has HTML elements with contenteditable attribute

Check Version:

bundle show rails-ujs or npm list rails-ujs

Verify Fix Applied:

Verify rails-ujs version is >= 7.0.5 in package.json or gemfile.lock, and test pasting content into contenteditable elements

📡 Detection & Monitoring

Log Indicators:

  • Unusual POST requests with data-method/data-remote attributes from unexpected sources
  • JavaScript errors related to clipboard operations

Network Indicators:

  • Requests containing malicious script tags in POST data
  • Unexpected redirects after form submissions

SIEM Query:

source="web_server" AND (data-method OR data-remote) AND contains("<script>")

🔗 References

📤 Share & Export