CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-CWV4-H3J5-W3CF

GHSA-CWV4-H3J5-W3CF: Stored and Reflected Cross-Site Scripting in rama's Directory Listing Component

Alon Barad
Alon Barad
Software Engineer

Jul 8, 2026·7 min read·14 visits

Executive Summary (TL;DR)

Unescaped directory rendering in the Rust library 'rama' (< 0.3.0-rc.1) allows arbitrary stored and reflected XSS when dynamic file index pages are enabled.

A Stored and Reflected Cross-Site Scripting (XSS) vulnerability was identified in the Rust web service library 'rama' prior to version 0.3.0-rc.1. When serving directories using DirectoryServeMode::HtmlFileList, the library improperly escapes directory names, filenames, and request path components before injecting them into dynamically generated HTML files. This allows attackers to execute malicious scripts inside user browser sessions.

Vulnerability Overview

The rama library is a modular Rust-based web service framework designed for building performant services, proxies, and web applications. Within its HTTP module, rama-http, the library provides a ServeDir service to serve static files directly from a designated directory on the filesystem. When configured with DirectoryServeMode::HtmlFileList, the service dynamically generates HTML index documents to list directory contents for client browsers.

The vulnerability lies within the file rendering logic located in rama-http/src/service/fs/serve_dir/open_file.rs. Because the directory-listing feature dynamically constructs the HTML document using direct string manipulation, it creates an attack surface vulnerable to Cross-Site Scripting (XSS). An attacker capable of injecting files, modifying filenames, or manipulating URL paths can execute arbitrary web scripts in the security context of the application's origin.

This security weakness is classified under CWE-116 (Improper Encoding or Escaping of Output). Under specific environmental conditions, such as applications that support user-driven file uploads or shared directory mounts, this issue escalates from a localized vector to a network-reachable threat vector. The impact ranges from session hijacking to administrative takeover depending on the exposed web application's permission model.

Root Cause Analysis

The fundamental root cause of GHSA-CWV4-H3J5-W3CF is the improper escaping of user-controlled inputs before rendering them inside dynamic HTML outputs. In affected versions of rama, the template construction relies on the native Rust format! macro to combine static HTML boilerplate with active data variables. These variables include physical file or directory names read from the filesystem as well as requested URI path segments directly extracted from client HTTP requests.

The directory listing service processes the local filesystem contents by reading DirEntry structures. The name of each entry, exposed via entry.name, is interpolated directly into both the text of the link and the href attribute of the generated anchor tag. Because the library fails to sanitize or escape HTML entities (such as <, >, ", ', and &), the browser interprets characters inside the filename as structure-defining HTML markup rather than plain text.

Similarly, request URI paths are sliced and formatted directly into the <title> and <h1> tags of the index page to display breadcrumbs and header titles. An attacker who crafts a specific HTTP request path containing script tags can exploit the application's reflection of that path back into the HTML stream. Consequently, the flaw presents two distinct injection vectors: a stored vector utilizing manipulated filesystem names, and a reflected vector utilizing crafted HTTP request paths.

Code Analysis

To understand the mechanics of the vulnerability, we analyze the vulnerable file row rendering code in rama-http/src/service/fs/serve_dir/open_file.rs before the fix. The generation of each table row representing a filesystem entry was performed using the following string interpolation block:

// VULNERABLE CODE PATH
rows.push(format!(
    "<tr><td>{5} <a href=\"{1}{2}{0}\">{0}</a></td><td>{3}</td><td>{4}</td></tr>",
    entry.name,
    uri.path().trim_end_matches('/'),
    if uri.path().trim_start_matches('/').is_empty() {
        ""
    } else {
        "/"
    },
    modified_str,
    hs,
    emoji,
));

In this block, entry.name corresponds to {0}. It is placed directly inside the double-quoted href string and also as the inner HTML anchor text. If entry.name contains a double quote ("), it breaks out of the href attribute context. The attacker can then inject event handlers such as onerror or onload directly into the anchor element.

Furthermore, the breadcrumbs navigation construction demonstrates the same structural vulnerability:

// VULNERABLE BREADCRUMBS PATH
nav_parts.push(format!("<a href=\"{current_path}\">{part}</a>"));

To remediate this, the patch implemented in commit 89ddff578fd78bbebec99482d7030f28c07757a3 refactors the HTML construction. It extracts all generation logic to a secure module (open_file_html.rs) and replaces format! with structured rendering macros:

// SECURE CODE PATH (From Commit 89ddff5)
let mut link = base_link.clone();
link.path_mut().push_segment(entry.name.as_str());
let href = link.to_string();
 
tr!(
    td!(emoji, " ", a!(href = href, entry.name)),
    td!(modified),
    td!(size),
)

The use of push_segment ensures that URI-unsafe characters in the filename are percent-encoded within the href attribute. Additionally, the macro-based layout engine automatically escapes raw HTML characters in entry.name using the internal escape_and_write implementation, neutralizing any embedded payload tags.

Exploitation

Exploitation of the stored variant requires that an attacker have the ability to write files or directories to the directory served by ServeDir. This is typical in environments hosting user-upload directories, file share attachments, or shared container volumes. An attacker initiates the exploit by creating a file with a specifically crafted name that contains HTML and JavaScript payload components.

# Creating a directory structure containing the payload on the filesystem
mkdir -p /var/www/uploads/rama-xss-test
cd /var/www/uploads/rama-xss-test
touch '"><img src=x onerror=alert(document.domain)>.txt'

When an authenticated victim or administrator navigates to the corresponding path mapping on the web service, the rama directory listing engine reads /var/www/uploads/rama-xss-test. It dynamically renders the directory listing page. The backend generates raw HTML output and transmits it to the victim's browser. Because the href attribute is prematurely closed by the double quote character in the filename, the browser interprets the subsequent payload as an active HTML element and triggers script execution.

Impact Assessment

The operational impact of this vulnerability depends on the configuration of the web application and the permissions assigned to the executing origin. Because the script executes in the client's browser under the origin of the web application, it gains full access to the Document Object Model (DOM). In a typical configuration, this permits the extraction of sensitive authorization tokens stored in localStorage or sessionStorage as well as non-HttpOnly session cookies.

Additionally, the script can perform silent actions on behalf of the active user. If an administrator visits the directory listing page, the malicious script can interact with the application's administrative APIs to alter application configurations, create rogue accounts, or exfiltrate sensitive backend database credentials. In enterprise environments with shared file repositories, a single low-privileged user uploading a malicious file name could compromise the accounts of all other repository users.

While the official CVSS score is rated Low (3.7) due to local complexity vectors in restricted systems, the operational vector in public-facing applications presents a higher risk profile. If an application exposes a directory listing mapping to user-supplied contents, the threat model escalates to an unauthenticated, network-accessible cross-site scripting path. In such deployments, the risk is closer to Medium (6.5) because it demands no prior local terminal access to write payload files.

Remediation

The primary remediation path is the immediate upgrade of the rama dependency to version 0.3.0-rc.1 or higher. The update replaces raw formatting logic with secure HTML macro-level abstractions and ensures all filenames undergo proper encoding. The Cargo dependency entry must be updated to reference the patched version:

[dependencies]
rama = "0.3.0-rc.1"

If upgrading is not immediately viable, the vulnerability can be mitigated by disabling the HTML directory listing mode in the service configurations. By default, ServeDir should be configured to return a 404 Not Found error or a generic 403 Forbidden page instead of generating interactive HTML. This is achieved by setting the directory serve mode explicitly:

use rama_http::service::fs::{ServeDir, DirectoryServeMode};
 
let service = ServeDir::new("static-directory")
    // Disable dynamic HTML directory listing output
    .with_directory_serve_mode(DirectoryServeMode::NotFound);

Additionally, organizations should audit directories exposed by ServeDir to ensure they do not accept unvalidated user uploads. If user uploads are necessary, strict filename sanitization must be enforced at the application boundary to reject filenames containing control characters.

Official Patches

plabayoPatch Fix Commit

Fix Analysis (1)

Technical Appendix

CVSS Score
3.7/ 10
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N

Affected Systems

ramarama-http

Affected Versions Detail

Product
Affected Versions
Fixed Version
rama
plabayo
< 0.3.0-rc.10.3.0-rc.1
AttributeDetail
CWE IDCWE-116
Attack VectorLocal (with network implications depending on architecture)
CVSS v3.1 Score3.7 (Advisory Official) / 6.5 (Reporter Suggested)
ImpactStored & Reflected Cross-Site Scripting (XSS)
Exploit StatusProof-of-Concept
KEV StatusNot Listed
Componentrama-http/src/service/fs/serve_dir/open_file.rs

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-116
Improper Encoding or Escaping of Output

The software receives input from an upstream source but fails to properly escape or encode special characters before including the input in a dynamically generated HTML document.

Vulnerability Timeline

Security patch committed to repository
2026-05-31
GHSA Advisory published
2026-07-07

References & Sources

  • [1]GitHub Security Advisory GHSA-CWV4-H3J5-W3CF
  • [2]Repository Security Advisory
  • [3]Fix Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•38 minutes ago•CVE-2026-61539
10.0

CVE-2026-61539: Remote Code Execution via Llama3 Tool Parser Eval Injection in Xinference

CVE-2026-61539 is a critical remote code execution vulnerability in Xinference, an inference API framework for open-source LLMs. In version 2.5.0 and earlier, model-generated outputs representing Llama3 tool calls are passed directly to Python's built-in eval() function inside the parser components. By manipulating conversational input or injecting instructions, an attacker can influence the LLM to output a Python expression containing malicious system commands, resulting in unauthenticated remote code execution on the host. This vulnerability has been resolved in Xinference version 2.7.0.

Alon Barad
Alon Barad
2 views•6 min read
•about 2 hours ago•CVE-2026-77354
8.7

CVE-2026-77354: Uncontrolled Resource Consumption (OOM) via Sparse Array Indexes in kin-openapi

An uncontrolled resource consumption vulnerability (CWE-400/CWE-789) exists within the kin-openapi Go library prior to version 0.142.0. The vulnerability occurs during the processing of highly sparse array indexes inside query parameters defined in deepObject style. An unauthenticated remote attacker can exploit this flaw to cause an immediate Out-of-Memory (OOM) crash of the target application.

Amit Schendel
Amit Schendel
1 views•8 min read
•about 3 hours ago•CVE-2026-77413
9.3

CVE-2026-77413: Remote Code Execution via Prototype Chain Bypass in JSONata Evaluator

A critical prototype pollution and sandbox escape vulnerability was discovered in the JSONata query and transformation library before versions 1.8.8 and 2.2.0. By providing a malicious JSONata expression that bypasses ownership checks on object properties, remote attackers can execute arbitrary code in the context of the host Node.js application.

Alon Barad
Alon Barad
2 views•6 min read
•about 4 hours ago•CVE-2026-63135
8.2

CVE-2026-63135: Stored Cross-Site Scripting (XSS) via Referer Header in YOURLS

CVE-2026-63135 is a critical stored Cross-Site Scripting (XSS) vulnerability affecting YOURLS (Your Own URL Shortener) versions 1.5.1 up to (but not including) 1.10.4. Unauthenticated remote attackers can inject malicious JavaScript arrays by crafting an HTTP Referer header sent to a short URL redirect. This value is saved in the database logs and executed without context-aware escaping when an administrative user views the corresponding statistics visualization page.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 5 hours ago•CVE-2026-68508
7.8

CVE-2026-68508: Arbitrary Code Execution via Unsafe Dynamic Instantiation in Hydra Core

CVE-2026-68508 is a high-severity arbitrary code execution vulnerability in facebookresearch/hydra (hydra-core) prior to version 1.3.4. The vulnerability exists within the dynamic instantiation system hydra.utils.instantiate(), which resolves and executes arbitrary Python callables from configuration files. An attacker capable of submitting untrusted configurations can achieve arbitrary code execution in the context of the consuming process.

Alon Barad
Alon Barad
5 views•7 min read
•about 6 hours ago•CVE-2026-77415
9.3

CVE-2026-77415: Sandbox Escape and Arbitrary Code Execution in JSONata Engine

A critical sandbox escape vulnerability in JSONata versions prior to 1.8.8 and 2.2.1 allows unauthenticated remote attackers to execute arbitrary code on the host machine. By submitting crafted JSONata expressions, an attacker can manipulate internal AST structures, bypass object clone helpers, spoof native function flags, and escape the evaluation environment to execute system commands through the Node.js runtime.

Alon Barad
Alon Barad
10 views•6 min read