Salvo is vulnerable to reflected XSS in the list_html function
Date: 2026-01
Affected: rust/salvo
Attack vector: xss
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-22256
CVE-2026-22257
CWE: CWE-79
CVSS: 8.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:L)

# Summary The function `list_html` generates an file view of a folder which includes a render of the current path, in which its inserted in the HTML without proper sanitation, leading to reflected XSS. The request path is decoded and normalized in the matching stage but is not inserted raw in the HTML view (current.path). The only constraint here is for the root path (e.g., /files in the PoC example) to have a subdirectory (e. g., common ones like styles/scripts/etc.) so that the matching returns the list HTML page instead of the Not Found page. # Details The vulnerable snippet of code is the following: [**dir.rs**](https://github.com/salvo-rs/salvo/blob/16efeba312a274739606ce76366d921768628654/crates/serve-static/src/dir.rs#L593) ```rust // ... fn list_html(... let mut ftxt = format!( r#"<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>{}</title> <style>{}</style></head><body><header><h3>Index of: {}</h3></header><hr/>"#, current.path, HTML_STYLE, header_links(&current.path) ); // ... ``` As seen here `<title>{}</title>` it is inserted unsafely. # PoC https://github.com/user-attachments/assets/92a29a67-547b-40a5-af26-f1b0dd332702 Here is the example app, note this doesn’t need an upload feature (e.g to the other reported vulnerability), only the sub-folder is required. `main.rs` ```rust use salvo::prelude::*; use salvo::serve_static::S


Mitigations:

Architectural layers (MAESTRO):