Possible XSS Vulnerability in Action Controller
A cross-site scripting flaw existed in Action Controller's translation helpers when a key ending in '_html' was used with a default value containing untrusted user input. An attacker could inject script that runs in a victim's browser if the resulting string was rendered in a view.
- Triaged in 2 days
- Fixed in 3 months
- Paid in 33 days
- Disclosed after 4 months
Summary by the program
Possible XSS Vulnerability in Action Controller
There is a possible XSS vulnerability when using the translation helpers (translate, t, etc) in Action Controller. This vulnerability has been assigned the CVE identifier CVE-2024-26143.
Versions Affected: >= 7.0.0. Not affected: < 7.0.0 Fixed Versions: 7.1.3.1, 7.0.8.1
Impact Applications using translation methods like translate, or t on a controller, with a key ending in “_html”, a :default key which contains untrusted user input, and the resulting string is used in a view, may be susceptible to an XSS vulnerability.
All users running an affected release should either upgrade or use one of the workarounds immediately.
Credits Thanks to ooooooo_q for the patch and fix!
Full Security Advisory: https://discuss.rubyonrails.org/t/possible-xss-vulnerability-in-action-controller/84947
The report
I made a report and patch at https://hackerone.com/reports/2303609
https://discuss.rubyonrails.org/t/possible-xss-vulnerability-in-action-controller/84947
There is a possible XSS vulnerability when using the translation helpers (translate, t, etc) in Action Controller. This vulnerability has been assigned the CVE identifier CVE-2024-26143.
Impact
Applications using translation methods like translate, or t on a controller, with a key ending in “_html”, a :default key which contains untrusted user input, and the resulting string is used in a view, may be susceptible to an XSS vulnerability.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the translation helper marked strings as HTML-safe when a key ended in '_html', even when the default value came from untrusted user input.
Impact
An attacker could run script in a victim's browser if the application passed untrusted input as the default for an '_html' translation key and rendered the result.
What the attacker needed
Rails >= 7.0.0; App uses translate/t with _html key; Default value contains untrusted input; Result rendered in a view
The fix
The vulnerability was fixed in versions [redacted] and [redacted]; users should upgrade or apply the workarounds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A helper that builds translated text could treat user-supplied text as safe HTML, so malicious content could be shown and executed. Fixed versions are listed.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.