Skip to content

Rust has Critical Stored XSS in Preview Modal, leading to Administrative Account Takeover

Critical severity GitHub Reviewed Published Feb 24, 2026 in rustfs/rustfs • Updated Feb 25, 2026

Package

cargo rustfs (Rust)

Affected versions

< 1.0.0-alpha.83

Patched versions

1.0.0-alpha.83

Description

Summary

A Stored Cross-Site Scripting (XSS) vulnerability in the RustFS Console allows an attacker to execute arbitrary JavaScript in the context of the management console. By bypassing the PDF preview logic, an attacker can steal administrator credentials from localStorage, leading to full account takeover and system compromise.

Details

The vulnerability exists due to improper validation of the response content type during the file preview process and a lack of origin separation between the S3 object delivery and the management console.

  1. Origin of Credentials: The RustFS Console stores highly sensitive S3 credentials (AccessKey, SecretKey, SessionToken) in the browser's localStorage.
    • File: console/composables/useAuth.ts
    • Evidence: Lines 14 and 18-25 show that credentials are held in useLocalStorage('auth.credentials', {}) and useLocalStorage('auth.permanent', undefined).
  2. Insecure Preview Implementation: In console/components/object/preview-modal.vue, the application identifies a PDF file based on its extension or metadata and renders it using an <iframe>.
  3. Same-Origin Vulnerability: RustFS typically hosts the management console and the S3 API on the same origin (e.g., the same IP and port).
  4. Bypass Attack: An attacker can upload a file named xss.pdf but set its Content-Type metadata to text/html. Because the iframe is hosted on the same origin as the console, the executed script has unrestricted access to the parent window's localStorage.

PoC

CleanShot 2026-02-01 at 18 36 54@2x

This PoC demonstrates how to steal a victim's administrative credentials by tricking them into previewing a malicious file.

1. Create the malicious payload (xss.html):

<script>
  alert('XSS Success!\nLocalStorage Data: ' + JSON.stringify(window.parent.localStorage));
</script>

2. Setup the environment and upload the payload:

# 1. Create a target bucket
mc mb rustfs/my-bucket

# 2. Upload the HTML file as a PDF with HTML content type
mc cp xss.html rustfs/my-bucket/xss.pdf --attr "Content-Type=text/html"

3. Trigger the vulnerability:

  1. Login to the RustFS Console as an administrator.
  2. Navigate to my-bucket.
  3. Click the "Preview" button for the xss.pdf file.
  4. The JavaScript executes, demonstrating access to the administrative session data.

Impact

  • Character: Stored Cross-Site Scripting (XSS).
  • Target: System Administrators using the Console.
  • Result: Full Account Takeover (ATO). An attacker gains the victim's AccessKeyId, SecretAccessKey, and SessionToken. This allows the attacker to perform any administrative action, including deleting data, creating backdoors, or downloading the entire filesystem via the S3 API.

Proposed Mitigation

  1. Origin Separation: Implement a dedicated domain for data delivery (e.g., *.data.rustfs.io) that is different from the console domain. This leverages the Same-Origin Policy (SOP) to isolate user-uploaded content.
  2. Security Headers: Implement strict security headers in the backend:
    • Content-Security-Policy (CSP): Disallow inline scripts and restrict script execution.
    • X-Content-Type-Options: nosniff: Prevent browsers from sniffing and executing content that differs from the declared type.

References

@overtrue overtrue published to rustfs/rustfs Feb 24, 2026
Published by the National Vulnerability Database Feb 25, 2026
Published to the GitHub Advisory Database Feb 25, 2026
Reviewed Feb 25, 2026
Last updated Feb 25, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(9th percentile)

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

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. Learn more on MITRE.

CVE ID

CVE-2026-27822

GHSA ID

GHSA-v9fg-3cr2-277j

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.