File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 11# Sanitize History
22
3+ ## 6.0.2 (2023-07-06)
4+
5+ ### Bug Fixes
6+
7+ * CVE-2023 -36823: Fixed an HTML+CSS sanitization bypass that could allow XSS
8+ (cross-site scripting). This issue affects Sanitize versions 3.0.0 through
9+ 6.0.1.
10+
11+ When using Sanitize's relaxed config or a custom config that allows ` <style> `
12+ elements and one or more CSS at-rules, carefully crafted input could be used
13+ to sneak arbitrary HTML through Sanitize.
14+
15+ See the following security advisory for additional details:
16+ [ GHSA-f5ww -cq3m-q3g7] ( https://github.com/rgrove/sanitize/security/advisories/GHSA-f5ww-cq3m-q3g7 )
17+
18+ Thanks to @cure53 for finding this issue.
19+
320## 6.0.1 (2023-01-27)
421
522### Bug Fixes
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ def call(env)
4848 if css . strip . empty?
4949 node . unlink
5050 else
51+ css . gsub! ( '</' , '<\/' )
5152 node . children . unlink
5253 node << Nokogiri ::XML ::Text . new ( css , node . document )
5354 end
Original file line number Diff line number Diff line change 1- # encoding: utf-8
2-
31class Sanitize
4- VERSION = '6.0.1 '
2+ VERSION = '6.0.2 '
53end
Original file line number Diff line number Diff line change 3939 it 'should not allow behaviors' do
4040 _ ( @s . properties ( %[behavior: url(xss.htc);] ) ) . must_equal ''
4141 end
42+
43+ describe 'sanitization bypass via CSS at-rule in HTML <style> element' do
44+ before do
45+ @s = Sanitize . new ( Sanitize ::Config ::RELAXED )
46+ end
47+
48+ it 'is not possible to prematurely end a <style> element' do
49+ assert_equal (
50+ %[<style>@media<\\ /style><iframe srcdoc='<script>alert(document.domain)<\\ /script>'>{}</style>] ,
51+ @s . fragment ( %[<style>@media</sty/**/le><iframe srcdoc='<script>alert(document.domain)</script>'></style>] )
52+ )
53+ end
54+ end
4255end
You can’t perform that action at this time.
0 commit comments