XSS Vulnerability in Action View tag helpers
Published 27 Apr 2022 · Updated 16 Feb 2024
Is your project on an affected actionview?
Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <5.2.7.1
- Fixed in
- 5.2.7.1
bundle update --conservative actionview # Gemfile: '>= 5.2.7.1'- Affected
- >=6.0.0 <6.0.4.8
- Fixed in
- 6.0.4.8
bundle update --conservative actionview # Gemfile: '>= 6.0.4.8'- Affected
- >=6.1.0 <6.1.5.1
- Fixed in
- 6.1.5.1
bundle update --conservative actionview # Gemfile: '>= 6.1.5.1'- Affected
- >=7.0.0 <7.0.2.4
- Fixed in
- 7.0.2.4
bundle update --conservative actionview # Gemfile: '>= 7.0.2.4'Details
There is a possible XSS vulnerability in Action View tag helpers. Passing untrusted input as hash keys can lead to a possible XSS vulnerability. This vulnerability has been assigned the CVE identifier CVE-2022-27777.
Versions Affected: ALL Not affected: NONE Fixed Versions: 7.0.2.4, 6.1.5.1, 6.0.4.8, 5.2.7.1
Impact
If untrusted data is passed as the hash key for tag attributes, there is a possibility that the untrusted data may not be properly escaped which can lead to an XSS vulnerability.
Impacted code will look something like this:
check_box_tag('thename', 'thevalue', false, aria: { malicious_input => 'thevalueofaria' })Where the "malicious_input" variable contains untrusted data.
All users running an affected release should either upgrade or use one of the workarounds immediately.
Releases
The FIXED releases are available at the normal locations.
Workarounds
Escape the untrusted data before using it as a key for tag helper methods.
Is GHSA-ch3h-j2vf-95pv in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected actionview, and gives you the command that fixes it.
More advisories for actionview
- MediumCVE-2026-126078Action View: Possible XSS vulnerability in highlight helper · 12 Nov 2026
- MediumCVE-2026-126070Action View: Possible XSS vulnerability in strip_tags · 12 Nov 2026
- MediumCVE-2026-126079Action View: Possible XSS vulnerability in text helpers · 12 Nov 2026
- MediumCVE-2026-126069Action View: Possible XSS vulnerability in tag helpers · 12 Nov 2026
- LowCVE-2026-33168Rails has a possible XSS vulnerability in its Action View tag helpers · 23 Mar 2026
- MediumCVE-2023-23913rails-ujs vulnerable to DOM Based Cross-site Scripting contenteditable HTML Elements · 9 Jun 2023
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2022-27777
- Linkgithub.com/rails/rails/commit/649516ce0feb699ae06a8c5e81df75d460cc9a85
- Linkdiscuss.rubyonrails.org/t/cve-2022-27777-possible-xss-vulnerability-in-action-view-tag-helpers/80534
- Packagegithub.com/rails/rails
- Linkgithub.com/rubysec/ruby-advisory-db/blob/master/gems/actionview/CVE-2022-27777.yml
- Linkgroups.google.com/g/ruby-security-ann/c/9wJPEDv-iRw
- Linklists.debian.org/debian-lts-announce/2022/09/msg00002.html
- Linkrubyonrails.org/2022/4/26/Rails-7-0-2-4-6-1-5-1-6-0-4-8-and-5-2-7-1-have-been-released
- Linkwww.debian.org/security/2023/dsa-5372
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.