Skip to content

Commit c6969a7

Browse files
authored
1 parent 4d933bc commit c6969a7

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
gem: rails-html-sanitizer
3+
cve: 2022-32209
4+
url: https://groups.google.com/g/rubyonrails-security/c/ce9PhUANQ6s
5+
title: Possible XSS vulnerability with certain configurations of Rails::Html::Sanitizer
6+
date: 2022-06-10
7+
description: |
8+
There is a possible XSS vulnerability with certain configurations of Rails::Html::Sanitizer.
9+
This vulnerability has been assigned the CVE identifier CVE-2022-32209.
10+
11+
Versions Affected: ALL
12+
Not affected: NONE
13+
Fixed Versions: v1.4.3
14+
15+
## Impact
16+
17+
A possible XSS vulnerability with certain configurations of
18+
Rails::Html::Sanitizer may allow an attacker to inject content if the
19+
application developer has overridden the sanitizer's allowed tags to allow
20+
both `select` and `style` elements.
21+
22+
Code is only impacted if allowed tags are being overridden. This may be done via application configuration:
23+
24+
```ruby
25+
# In config/application.rb
26+
config.action_view.sanitized_allowed_tags = ["select", "style"]
27+
```
28+
29+
see https://guides.rubyonrails.org/configuring.html#configuring-action-view
30+
31+
Or it may be done with a `:tags` option to the Action View helper `sanitize`:
32+
33+
```
34+
<%= sanitize @comment.body, tags: ["select", "style"] %>
35+
```
36+
37+
see https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-sanitize
38+
39+
Or it may be done with Rails::Html::SafeListSanitizer directly:
40+
41+
```ruby
42+
# class-level option
43+
Rails::Html::SafeListSanitizer.allowed_tags = ["select", "style"]
44+
```
45+
46+
or
47+
48+
```ruby
49+
# instance-level option
50+
Rails::Html::SafeListSanitizer.new.sanitize(@article.body, tags: ["select", "style"])
51+
```
52+
53+
All users overriding the allowed tags by any of the above mechanisms to include both "select" and "style" should either upgrade or use one of the workarounds immediately.
54+
55+
## Releases
56+
57+
The FIXED releases are available at the normal locations.
58+
59+
## Workarounds
60+
61+
Remove either `select` or `style` from the overridden allowed tags.
62+
63+
## Credits
64+
65+
This vulnerability was responsibly reported by [windshock](https://hackerone.com/windshock?type=user).
66+
patched_versions:
67+
- '>= 1.4.3'

0 commit comments

Comments
 (0)