GHSA-cwv4-h3j5-w3cf: Rama Cross-Site Scripting Vulnerability
LOWGHSA-cwv4-h3j5-w3cf is a LOW (CVSS 3.7) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Rama libraries in the crates.io ecosystem. The issue involves rama has stored xss in servedir html directory listing via unescaped file names and uri path. Remediation is available by upgrading affected packages to version 0.3.0-rc.1.
GHSA-cwv4-h3j5-w3cf at a Glance
Security Impact
CVSS: 3.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N).
How to Fix GHSA-cwv4-h3j5-w3cf
To remediate this vulnerability, upgrade all affected Rama dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade rama to 0.3.0-rc.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for rama
How to Check if You Are Affected
To determine whether your application is affected by GHSA-cwv4-h3j5-w3cf, inspect your project dependencies for Rama:
inspect dependencies for rama
Analyze the terminal output to locate any version of Rama in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.0-rc.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Rama, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-cwv4-h3j5-w3cf Affected Rama Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
rama
|
crates.io |
< 0.3.0-rc.1
|
0.3.0-rc.1
|
References
Frequently Asked Questions
What is GHSA-cwv4-h3j5-w3cf?
Which Rama versions are affected?
What version fixes GHSA-cwv4-h3j5-w3cf?
Is rama affected?
What is the CVSS score of GHSA-cwv4-h3j5-w3cf?
What CWE is associated with GHSA-cwv4-h3j5-w3cf?
How can I check crates.io dependencies for GHSA-cwv4-h3j5-w3cf?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cwv4-h3j5-w3cf",
"modified" : "2026-07-07T23:41:12Z",
"published" : "2026-07-07T23:41:12Z",
"aliases" : [ ],
"summary" : "rama has Stored XSS in ServeDir HTML directory listing via unescaped file names and URI path",
"details" : "Resolved: https://github.com/plabayo/rama/commit/89ddff578fd78bbebec99482d7030f28c07757a3\n\n## Summary\n\n`plabayo/rama` contains a stored/reflected cross-site scripting issue in the `ServeDir` HTML directory listing feature.\n\nWhen `ServeDir` is configured with `DirectoryServeMode::HtmlFileList`, file names and URI path components are inserted directly into generated HTML without HTML escaping. If an attacker can create or influence a file or directory name inside a served directory, they may inject HTML or JavaScript into the directory listing page.\n\nThis can execute script in the browser of any user who visits the affected directory listing.\n\n## Affected Repository\n\n`plabayo/rama`\n\n## Affected Component\n\n`rama-http/src/service/fs/serve_dir/open_file.rs`\n\n## Root Cause\n\nThe HTML directory listing is constructed using string formatting and inserts untrusted values directly into HTML.\n\nThe directory listing row includes the file or directory name in both the link text and the `href` attribute:\n\n rows.push(format!(\n \"<tr><td>{5} <a href=\\\"{1}{2}{0}\\\">{0}</a></td><td>{3}</td><td>{4}</td></tr>\",\n entry.name,\n uri.path().trim_end_matches('/'),\n ...\n ));\n\nThe navigation breadcrumb also inserts URI path parts into generated HTML:\n\n nav_parts.push(format!(\"<a href=\\\"{current_path}\\\">{part}</a>\"));\n\nThe page title and heading also include the current URI path:\n\n <title>Directory listing for .{0}</title>\n <h1>Directory listing for .{0}</h1>\n\nThese values are not HTML-escaped before being embedded into the generated page.\n\n## Security Impact\n\nIf an application uses `ServeDir` with `DirectoryServeMode::HtmlFileList`, an attacker who can create or influence file names inside the served directory can inject HTML or JavaScript into the generated directory listing.\n\nPossible impact includes:\n\n- Script execution in the browser of users viewing the directory listing\n- Session or token theft if the application uses cookies or browser-accessible credentials\n- UI redressing or phishing inside the application origin\n- Unauthorized actions within the same origin if the victim is authenticated\n- Security boundary impact if the directory listing is served under a trusted application domain\n\nThe attack requires the directory listing feature to be enabled and the attacker to control or influence at least one file or directory name in the served path.\n\n## Proof of Concept\n\nThis proof of concept uses a benign payload.\n\nCreate a directory with a file name containing HTML:\n\n mkdir rama-xss-test\n cd rama-xss-test\n touch '\"><img src=x onerror=alert(document.domain)>.txt'\n\nServe this directory with Rama using `ServeDir` and `DirectoryServeMode::HtmlFileList`.\n\nExample intended configuration:\n\n ServeDir::new(\"rama-xss-test\")\n .with_directory_serve_mode(DirectoryServeMode::HtmlFileList)\n\nThen visit the directory listing in a browser.\n\nExpected behavior:\n\nThe file name should be displayed as text. Special characters such as `<`, `>`, `\"`, and `'` should be HTML-escaped.\n\nActual behavior:\n\nThe file name is inserted directly into the generated HTML. The browser interprets the injected HTML and executes the benign JavaScript payload.\n\n## Expected Behavior\n\nAll file names, directory names, URI path parts, and other untrusted values should be escaped before being inserted into HTML.\n\nFor example:\n\n- `<` should become `<`\n- `>` should become `>`\n- `\"` should become `"`\n- `'` should become `'`\n- `&` should become `&`\n\nUntrusted values used inside HTML attributes should be escaped using an attribute-safe escaping function.\n\n## Actual Behavior\n\nThe directory listing is generated with `format!()` and inserts file names and path values directly into HTML without escaping.\n\n## Suggested Fix\n\nEscape all untrusted values before inserting them into the generated HTML.\n\nRecommended changes:\n\n1. HTML-escape `entry.name` before using it as link text.\n2. Attribute-escape values used inside `href`.\n3. HTML-escape URI path components used in breadcrumbs.\n4. HTML-escape the current path used in the page title and heading.\n5. Add regression tests with file names containing HTML metacharacters.\n\nExample test payloads:\n\n \"><img src=x onerror=alert(1)>.txt\n <script>alert(1)</script>.txt\n a&b.txt\n quote\"test.txt\n single'test.txt\n\nThe secure output should render these as text only and should not create executable HTML or JavaScript.\n\n## Suggested Severity\n\nMedium.\n\nSuggested CVSS:\n\n`CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`\n\nRationale:\n\n- The vulnerability is remotely reachable when an application exposes `ServeDir` directory listings.\n- Exploitation requires the attacker to create or influence a file or directory name in the served directory.\n- User interaction is required because a victim must view the affected directory listing.\n- The impact is browser-side script execution in the application origin.\n- Scope may change if the listing is served under a trusted authenticated application origin.\n\n## Additional Notes\n\nThis report is limited to the HTML directory listing generated by `ServeDir` when `DirectoryServeMode::HtmlFileList` is enabled.\n\nThis report is not claiming remote code execution on the server. The issue is browser-side cross-site scripting caused by unescaped file names and path values in generated HTML.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "rama"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.3.0-rc.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/plabayo/rama/security/advisories/GHSA-cwv4-h3j5-w3cf"
}, {
"type" : "WEB",
"url" : "https://github.com/plabayo/rama/commit/89ddff578fd78bbebec99482d7030f28c07757a3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/plabayo/rama"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-07T23:41:12Z",
"nvd_published_at" : null
}
}