Skip to content

Commit 024eb5f

Browse files
jasnowRubySec CI
authored andcommitted
Updated advisory posts against rubysec/ruby-advisory-db@26ec365
1 parent 4f0cda0 commit 024eb5f

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2024-27285 (yard): YARD''s default template vulnerable to Cross-site Scripting
4+
in generated frames.html'
5+
comments: false
6+
categories:
7+
- yard
8+
advisory:
9+
gem: yard
10+
cve: 2024-27285
11+
ghsa: 8mq4-9jjh-9xrc
12+
url: https://github.com/advisories/GHSA-8mq4-9jjh-9xrc
13+
title: YARD's default template vulnerable to Cross-site Scripting in generated frames.html
14+
date: 2024-02-28
15+
description: |2
16+
17+
### Summary
18+
19+
The "frames.html" file within the Yard Doc's generated documentation
20+
is vulnerable to Cross-Site Scripting (XSS) attacks due to inadequate
21+
sanitization of user input within the JavaScript segment of the
22+
"frames.erb" template file.
23+
24+
### Details
25+
26+
The vulnerability stems from mishandling user-controlled data retrieved
27+
from the URL hash in the embedded JavaScript code within the "frames.erb"
28+
template file. Specifically, the script lacks proper sanitization of
29+
the hash data before utilizing it to establish the top-level window's
30+
location. This oversight permits an attacker to inject malicious
31+
JavaScript payloads through carefully crafted URLs.
32+
33+
Snippet from "frames.erb":
34+
```erb
35+
<script type="text/javascript">
36+
var match = unescape(window.location.hash).match(/^#!(.+)/);
37+
var name = match ? match[1] : '<= url_for_main >';
38+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
39+
window.top.location = name;
40+
</script>
41+
```
42+
43+
### PoC (Proof of Concept)
44+
45+
To exploit this vulnerability:
46+
1. Gain access to the generated Yard Doc.
47+
2. Locate and access the "frames.html" file.
48+
3. Construct a URL containing the malicious payload in the hash
49+
segment, for instance: `#!javascript:xss`
50+
51+
### Impact
52+
53+
This XSS vulnerability presents a substantial threat by enabling
54+
an attacker to execute arbitrary JavaScript code within the user's
55+
session context. Potential ramifications include session hijacking,
56+
theft of sensitive data, unauthorized access to user accounts, and
57+
defacement of websites. Any user visiting the compromised page is
58+
susceptible to exploitation. It is critical to promptly address
59+
this vulnerability to mitigate potential harm to users and preserve
60+
the application's integrity.
61+
cvss_v3: 5.4
62+
patched_versions:
63+
- ">= 0.9.35"
64+
related:
65+
url:
66+
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-27285
67+
- https://github.com/lsegal/yard/releases/tag/v0.9.35
68+
- https://github.com/lsegal/yard/security/advisories/GHSA-8mq4-9jjh-9xrc
69+
- https://github.com/lsegal/yard/commit/2069e2bf08293bda2fcc78f7d0698af6354054be
70+
- https://github.com/advisories/GHSA-8mq4-9jjh-9xrc
71+
---

0 commit comments

Comments
 (0)