{"id":"CVE-2026-25500","aliases":["CVE-2026-25500","GHSA-whrj-4476-wvmp"],"related":[],"kind":"vulnerability","state":"published","title":"Rack's Stored XSS in Rack::Directory via javascript: filenames rendered into anchor href","summary":"Rack is a modular Ruby web server interface. Prior to versions 2.2.22, 3.1.20, and 3.2.5, `Rack::Directory` generates an HTML directory index where each file entry is rendered as a clickable link. If a file exists on disk whose basename starts with the `javascript:` scheme (e.g. `javascript:alert(1)`), the generated index contains an anchor whose `href` is exactly `javascript:alert(1)`. Clicking the entry executes JavaScript in the browser (demonstrated with `alert(1)`). Versions 2.2.22, 3.1.20, and 3.2.5 fix the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Rack is a modular Ruby web server interface. Prior to versions 2.2.22, 3.1.20, and 3.2.5, `Rack::Directory` generates an HTML directory index where each file entry is rendered as a clickable link. If a file exists on disk whose basename starts with the `javascript:` scheme (e.g. `javascript:alert(1)`), the generated index contains an anchor whose `href` is exactly `javascript:alert(1)`. Clicking the entry executes JavaScript in the browser (demonstrated with `alert(1)`). Versions 2.2.22, 3.1.20, and 3.2.5 fix the issue.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`Rack::Directory` generates an HTML directory index where each file entry is rendered as a clickable link. If a file exists on disk whose basename begins with the `javascript:` scheme (e.g. `javascript:alert(1)`), the generated index includes an anchor whose `href` attribute is exactly `javascript:alert(1)`. Clicking this entry executes arbitrary JavaScript in the context of the hosting application.\n\nThis results in a client-side XSS condition in directory listings generated by `Rack::Directory`.\n\n## Details\n\n`Rack::Directory` renders directory entries using an HTML row template similar to:\n\n```html\n<a href='%s'>%s</a>\n```\n\nThe `%s` placeholder is populated directly with the file’s basename. If the basename begins with `javascript:`, the resulting HTML contains an executable JavaScript URL:\n\n```html\n<a href='javascript:alert(1)'>javascript:alert(1)</a>\n```\n\nBecause the value is inserted directly into the `href` attribute without scheme validation or normalization, browsers interpret it as a JavaScript URI. When a user clicks the link, the JavaScript executes in the origin of the Rack application.\n\n## Impact\n\nIf `Rack::Directory` is used to expose filesystem contents over HTTP, an attacker who can create or upload files within that directory may introduce a malicious filename beginning with `javascript:`.\n\nWhen a user visits the directory listing and clicks the entry, arbitrary JavaScript executes in the application's origin. Exploitation requires user interaction (clicking the malicious entry).\n\n## Mitigation\n\n* Update to a patched version of Rack in which `Rack::Directory` prefixes generated anchors with a relative path indicator (e.g. `./filename`).\n* Avoid exposing user-controlled directories via `Rack::Directory`.\n* Apply a strict Content Security Policy (CSP) to reduce impact of potential client-side execution issues.\n* Where feasible, restrict or sanitize uploaded filenames to disallow dangerous URI scheme prefixes.\n\nHackerOne profile:\nhttps://hackerone.com/thesmartshadow\n\nGitHub account owner:\nAli Firas (@thesmartshadow)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Rack es una interfaz modular para servidores web Ruby. Antes de las versiones 2.2.22, 3.1.20 y 3.2.5, `Rack::Directory` generaba un índice de directorio HTML en el que cada entrada de archivo se representaba como un enlace en el que se podía hacer clic. Si existe un archivo en el disco cuyo nombre base comienza con el esquema `javascript:` (por ejemplo, `javascript:alert(1)`), el índice generado contiene un ancla cuyo `href` es exactamente `javascript:alert(1)`. Al hacer clic en la entrada, se ejecuta JavaScript en el navegador (demostrado con `alert(1)`). Las versiones 2.2.22, 3.1.20 y 3.2.5 corrigen el problema.","source":"nvd"}],"published":"2026-02-17T18:46:35.000Z","modified":"2026-09-10T03:50:36.160Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/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:L/UI:R/S:C/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:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 2.2.22","status":"affected"},{"version":">= 3.0.0.beta1, < 3.1.20","status":"affected"},{"version":">= 3.2.0, < 3.2.5","status":"affected"}],"vendor":"rack","product":"rack","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.2.22"}],"ecosystem":"RubyGems","package":"rack","purl":"pkg:gem/rack","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0.beta1","status":"affected","fixed":"3.1.20"}],"ecosystem":"RubyGems","package":"rack","purl":"pkg:gem/rack","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"3.2.0","status":"affected","fixed":"3.2.5"}],"ecosystem":"RubyGems","package":"rack","purl":"pkg:gem/rack","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.2.22"},{"status":"affected","introduced":"3.0.0","fixed":"3.1.20"},{"status":"affected","introduced":"3.2.0","fixed":"3.2.5"}],"vendor":"rack","product":"rack","cpe":"cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:*","source":"nvd"}],"references":[{"url":"https://github.com/rack/rack/security/advisories/GHSA-whrj-4476-wvmp","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rack/rack/commit/f2f225f297b99fbee3d9f51255d41f601fc40aff","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25500","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rack/rack","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rack/CVE-2026-25500.yml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-02-18T19:42:04.480Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25500","url":"https://www.cve.org/CVERecord?id=CVE-2026-25500","licence":"CVE Terms of Use","modified":"2026-02-18T19:42:35.101Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-whrj-4476-wvmp","url":"https://github.com/advisories/GHSA-whrj-4476-wvmp","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:36.160Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25500","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25500","licence":"Public domain","modified":"2026-06-17T10:24:44.857Z"}],"updatedAt":"2026-11-25T22:59:14.014Z","epss":{"score":0.00275,"percentile":0.21354,"date":"2026-12-01T12:00:22.000Z"}}