{"id":"CVE-2024-27285","aliases":["CVE-2024-27285","GHSA-8mq4-9jjh-9xrc"],"related":[],"kind":"vulnerability","state":"published","title":"YARD's default template vulnerable to Cross-site Scripting in generated frames.html","summary":"YARD is a Ruby Documentation tool. The \"frames.html\" file within the Yard Doc's generated documentation is vulnerable to Cross-Site Scripting (XSS) attacks due to inadequate sanitization of user input within the JavaScript segment of the \"frames.erb\" template file.  This vulnerability is fixed in 0.9.36.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"YARD is a Ruby Documentation tool. The \"frames.html\" file within the Yard Doc's generated documentation is vulnerable to Cross-Site Scripting (XSS) attacks due to inadequate sanitization of user input within the JavaScript segment of the \"frames.erb\" template file.  This vulnerability is fixed in 0.9.36.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe \"frames.html\" file within the Yard Doc's generated documentation is vulnerable to Cross-Site Scripting (XSS) attacks due to inadequate sanitization of user input within the JavaScript segment of the \"frames.erb\" template file.\n\n### Details\nThe vulnerability stems from mishandling user-controlled data retrieved from the URL hash in the embedded JavaScript code within the \"frames.erb\" template file. Specifically, the script lacks proper sanitization of the hash data before utilizing it to establish the top-level window's location. This oversight permits an attacker to inject malicious JavaScript payloads through carefully crafted URLs.\n\nSnippet from \"frames.erb\":\n(v0.9.34)\n```erb\n<script type=\"text/javascript\">\n  var match = unescape(window.location.hash).match(/^#!(.+)/);\n  var name = match ? match[1] : '<%= url_for_main %>';\n  name = name.replace(/^(\\w+):\\/\\//, '').replace(/^\\/\\//, '');\n  window.top.location = name;\n</script>\n```\n\n(v0.9.35)\n```erb\n<script type=\"text/javascript\">\n  var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);\n  var name = match ? match[1] : '<%= url_for_main %>';\n  name = name.replace(/^((\\w*):)?[\\/\\\\]*/gm, '').trim();\n  window.top.location.replace(name)\n</script>\n```\n\n### PoC (Proof of Concept)\nTo exploit this vulnerability:\n1. Gain access to the generated Yard Doc.\n2. Locate and access the \"frames.html\" file.\n3. Construct a URL containing the malicious payload in the hash segment, for instance: `#!javascript:xss` for v0.9.34, and `#:javascript:xss` for v0.9.35\n\n### Impact\nThis XSS vulnerability presents a substantial threat by enabling an attacker to execute arbitrary JavaScript code within the user's session context. Potential ramifications include session hijacking, theft of sensitive data, unauthorized access to user accounts, and defacement of websites. Any user visiting the compromised page is susceptible to exploitation. It is critical to promptly address this vulnerability to mitigate potential harm to users and preserve the application's integrity.","format":"markdown","source":"ghsa"},{"lang":"es","text":"YARD es una herramienta de documentación de Ruby. El archivo \"frames.html\" dentro de la documentación generada por Yard Doc es vulnerable a ataques de Cross-Site Scripting (XSS) debido a una desinfección inadecuada de la entrada del usuario dentro del segmento JavaScript del archivo de plantilla \"frames.erb\". Esta vulnerabilidad se solucionó en 0.9.35.","source":"nvd"}],"published":"2024-02-28T18:57:19.000Z","modified":"2026-09-10T03:50:05.473Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 0.9.36","status":"affected"}],"vendor":"lsegal","product":"yard","source":"cvelist"},{"ranges":[{"version":"0.9.36","status":"affected"}],"vendor":"yardoc","product":"yard","cpe":"cpe:2.3:a:yardoc:yard:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.9.36"}],"ecosystem":"RubyGems","package":"yard","purl":"pkg:gem/yard","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.9.36"}],"vendor":"yardoc","product":"yard","cpe":"cpe:2.3:a:yardoc:yard:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"38"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"10.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/lsegal/yard/security/advisories/GHSA-8mq4-9jjh-9xrc","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/lsegal/yard/pull/1538","tags":["issue-tracking","patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/lsegal/yard/commit/1fcb2d8b316caf8779cfdcf910715e9ab583f0aa","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/lsegal/yard/commit/2069e2bf08293bda2fcc78f7d0698af6354054be","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/yard/CVE-2024-27285.yml","tags":["exploit","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/03/msg00006.html","tags":["mailing-list","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MR3Z2E2UIZZ7YOR7R645EVSBGWMB2RGA/","tags":["mailing-list","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-27285","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/advisories/GHSA-8mq4-9jjh-9xrc","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/lsegal/yard","tags":["package"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MR3Z2E2UIZZ7YOR7R645EVSBGWMB2RGA","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-02-29T20:48:49.252Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-27285","url":"https://www.cve.org/CVERecord?id=CVE-2024-27285","licence":"CVE Terms of Use","modified":"2025-02-13T17:46:21.796Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8mq4-9jjh-9xrc","url":"https://github.com/advisories/GHSA-8mq4-9jjh-9xrc","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:05.473Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-27285","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-27285","licence":"Public domain","modified":"2026-06-17T07:19:34.510Z"}],"updatedAt":"2026-11-25T22:58:37.115Z","epss":{"score":0.01138,"percentile":0.6635,"date":"2026-11-30T12:00:22.000Z"}}