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.
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.
localStorage.
console/components/object/preview-modal.vue, the application identifies a PDF file based on its extension or metadata and renders it using an <code><iframe></code>.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.<img width="6006" height="3096" alt="CleanShot 2026-02-01 at 18 36 54@2x" src="https://github.com/user-attachments/assets/f2f5dae6-1e19-4133-9a69-f7d8ec604dad" />
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.
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.*.data.rustfs.io) that is different from the console domain. This leverages the Same-Origin Policy (SOP) to isolate user-uploaded content.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.{
"nvd_published_at": "2026-02-25T03:16:07Z",
"severity": "CRITICAL",
"github_reviewed_at": "2026-02-25T23:00:18Z",
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true
}