CVE-2026-25500
Received Received - Intake
Cross-Site Scripting in Rack::Directory via Malicious Filenames

Publication date: 2026-02-18

Last updated on: 2026-02-19

Assigner: GitHub, Inc.

Description
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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-02-18
Last Modified
2026-02-19
Generated
2026-05-07
AI Q&A
2026-02-18
EPSS Evaluated
2026-05-05
NVD
Affected Vendors & Products
Showing 3 associated CPEs
Vendor Product Version / Range
rack rack to 2.2.22 (exc)
rack rack From 3.0.0 (inc) to 3.1.20 (exc)
rack rack From 3.2.0 (inc) to 3.2.5 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-79 The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': "CVE-2026-25500 is a cross-site scripting (XSS) vulnerability in the Rack::Directory component of the Rack Ruby webserver interface. Rack::Directory generates HTML directory listings where each file is rendered as a clickable link using an anchor tag with the file's basename directly inserted into the href attribute."}, {'type': 'paragraph', 'content': "If a file on disk has a basename starting with the javascript: URI scheme (for example, javascript:alert(1)), the generated HTML includes an anchor tag like <a href='javascript:alert(1)'>javascript:alert(1)</a>. Because the basename is inserted without validation or normalization, browsers interpret this as executable JavaScript."}, {'type': 'paragraph', 'content': 'When a user clicks such a link, arbitrary JavaScript runs in the context of the hosting application, resulting in a client-side XSS vulnerability. This allows an attacker who can create or upload files with malicious names starting with javascript: to inject executable scripts into directory listings.'}] [1]


How can this vulnerability impact me? :

This vulnerability can lead to the execution of arbitrary JavaScript in the browser of anyone viewing the directory listing generated by Rack::Directory. An attacker who can create or upload files with malicious names can exploit this to run scripts that may steal user data, hijack user sessions, or perform actions on behalf of the user.

The impact is considered moderate with a CVSS score of 5.4. It requires user interaction (clicking the malicious link) and low privileges to exploit, but it can compromise confidentiality and integrity of user data in the affected application context.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': 'This vulnerability can be detected by checking if your Rack::Directory-generated HTML directory listings contain anchor tags with href attributes that start with the javascript: URI scheme. Such links indicate the presence of files whose basenames start with javascript:, which can lead to cross-site scripting (XSS) when clicked.'}, {'type': 'paragraph', 'content': 'To detect this on your system, you can inspect the directory listing HTML output for suspicious href values. For example, you can use command-line tools like curl or wget to fetch the directory listing and grep to search for javascript: links.'}, {'type': 'list_item', 'content': 'curl -s http://yourserver/directory/ | grep -i \'href="javascript:\''}, {'type': 'list_item', 'content': 'wget -qO- http://yourserver/directory/ | grep -i \'href="javascript:\''}, {'type': 'paragraph', 'content': "Additionally, you can scan your file system for files with basenames starting with 'javascript:' which could be exploited:"}, {'type': 'list_item', 'content': "find /path/to/served/directory -type f -name 'javascript:*'"}] [1]


What immediate steps should I take to mitigate this vulnerability?

Immediate mitigation steps include updating your Rack library to one of the patched versions: 2.2.22, 3.1.20, or 3.2.5, which fix the vulnerability by prefixing directory listing links with a relative path indicator to prevent execution of javascript: URIs.

If updating is not immediately possible, consider the following mitigations:

  • Avoid exposing user-controlled directories via Rack::Directory to prevent attackers from uploading malicious filenames.
  • Apply strict Content Security Policies (CSP) to limit or block client-side script execution from untrusted sources.
  • Sanitize or restrict uploaded filenames to disallow dangerous URI schemes such as javascript:.

Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart