Skip to content

Commit a851d26

Browse files
jasnowRubySec CI
authored and
RubySec CI
committed
Updated advisory posts against rubysec/ruby-advisory-db@ff710b9
1 parent 15398d4 commit a851d26

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2024-28199 (phlex): Cross-site Scripting (XSS) possible with maliciously
4+
formed HTML attribute names and values in Phlex'
5+
comments: false
6+
categories:
7+
- phlex
8+
advisory:
9+
gem: phlex
10+
cve: 2024-28199
11+
ghsa: 242p-4v39-2v8g
12+
url: https://github.com/phlex-ruby/phlex/security/advisories/GHSA-242p-4v39-2v8g
13+
title: Cross-site Scripting (XSS) possible with maliciously formed HTML attribute
14+
names and values in Phlex
15+
date: 2024-03-12
16+
description: |
17+
There is a potential cross-site scripting (XSS) vulnerability that
18+
can be exploited via maliciously crafted user data. This was due
19+
to improper case-sensitivity in the code that was meant to prevent
20+
these attacks.
21+
22+
### Impact
23+
24+
If you render an `<a>` tag with an `href` attribute set to a
25+
user-provided link, that link could potentially execute JavaScript
26+
when clicked by another user.
27+
28+
```ruby
29+
a(href: user_profile) { "Profile" }
30+
```
31+
32+
If you splat user-provided attributes when rendering any HTML or
33+
SVG tag, malicious event attributes could be included in the output,
34+
executing JavaScript when the events are triggered by another user.
35+
36+
```ruby
37+
h1(**JSON.parse(user_attributes))
38+
```
39+
40+
### Patches
41+
42+
Patches are [available on RubyGems](https://rubygems.org/gems/phlex)
43+
for all `1.x` minor versions. The patched versions are:
44+
45+
- [1.9.1](https://rubygems.org/gems/phlex/versions/1.9.1)
46+
- [1.8.2](https://rubygems.org/gems/phlex/versions/1.8.2)
47+
- [1.7.1](https://rubygems.org/gems/phlex/versions/1.7.1)
48+
- [1.6.2](https://rubygems.org/gems/phlex/versions/1.6.2)
49+
- [1.5.2](https://rubygems.org/gems/phlex/versions/1.5.2)
50+
- [1.4.1](https://rubygems.org/gems/phlex/versions/1.4.1)
51+
- [1.3.3](https://rubygems.org/gems/phlex/versions/1.3.3)
52+
- [1.2.2](https://rubygems.org/gems/phlex/versions/1.2.2)
53+
- [1.1.1](https://rubygems.org/gems/phlex/versions/1.1.1)
54+
- [1.0.1](https://rubygems.org/gems/phlex/versions/1.0.1)
55+
56+
If you are on `main`, it has been patched since
57+
[`aa50c60`](https://github.com/phlex-ruby/phlex/commit/aa50c604cdee1d0ce7ef068a4c66cbd5d43f96a1)
58+
59+
### Workarounds
60+
61+
Configuring a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)
62+
that does not allow [`unsafe-inline`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy#unsafe-inline)
63+
would effectively prevent this vulnerability from being exploited.
64+
65+
### References
66+
67+
In addition to upgrading to a patched version of Phlex, we strongly
68+
recommend configuring a Content Security Policy header that does not
69+
allow `unsafe-inline`. Here’s how you can configure a Content Security
70+
Policy header in Rails.
71+
https://guides.rubyonrails.org/security.html#content-security-policy-header
72+
cvss_v3: 7.1
73+
patched_versions:
74+
- "~> 1.0.1"
75+
- "~> 1.1.1"
76+
- "~> 1.2.2"
77+
- "~> 1.3.3"
78+
- "~> 1.4.1"
79+
- "~> 1.5.2"
80+
- "~> 1.6.2"
81+
- "~> 1.7.1"
82+
- "~> 1.8.2"
83+
- ">= 1.9.1"
84+
related:
85+
url:
86+
- https://nvd.nist.gov/vuln/detail/CVE-2024-28199
87+
- https://github.com/phlex-ruby/phlex/security/advisories/GHSA-242p-4v39-2v8g
88+
- https://github.com/phlex-ruby/phlex/commit/aa50c604cdee1d0ce7ef068a4c66cbd5d43f96a1
89+
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
90+
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy#unsafe-inline
91+
- https://github.com/advisories/GHSA-242p-4v39-2v8g
92+
---

0 commit comments

Comments
 (0)