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-V2X6-WWFW-R2RQ

GHSA-v2x6-wwfw-r2rq: Path Traversal and Parameter Injection in Agentgateway

Alon Barad
Alon Barad
Software Engineer

Mar 5, 2026·5 min read·29 visits

Executive Summary (TL;DR)

Agentgateway failed to properly sanitize or encode user inputs when proxying requests from AI agents to upstream APIs. This allows attackers to perform path traversal (`../`), inject query parameters, and manipulate HTTP headers. Fixed in commit 9a52875.

A critical input validation vulnerability exists in Agentgateway, a proxy for AI agents and Model Context Protocol (MCP) servers. The flaw occurs within the component responsible for translating MCP `tools/call` requests into upstream OpenAPI HTTP requests. Due to a lack of sanitization and URL encoding, attackers can manipulate the structure of the upstream request. This allows for path traversal attacks to access unauthorized endpoints, query parameter injection to alter application logic, and header injection to spoof identity or bypass security controls. The vulnerability affects all versions prior to the patch released on January 28, 2026.

Vulnerability Overview

Agentgateway serves as an intermediary layer—a "next-generation agentic proxy"—that facilitates communication between AI agents and services implementing the Model Context Protocol (MCP). A core function of this proxy is transforming abstract tool calls generated by an AI model into concrete HTTP requests defined by an OpenAPI specification. This conversion process requires inserting dynamic parameters provided by the agent (or an attacker controlling the agent's context) into URL paths, query strings, and HTTP headers.

The vulnerability lies in the implementation of this conversion logic. Instead of treating user input as untrusted data requiring strict encoding, the system performed naive string substitution and concatenation. This architectural oversight meant that special characters with semantic meaning in HTTP—such as forward slashes (/), question marks (?), and ampersands (&)—were preserved rather than encoded. Consequently, an attacker could break out of the intended data context and modify the control structure of the HTTP request itself.

Root Cause Analysis

The root cause is a classic injection flaw resulting from the unsafe construction of URIs and HTTP headers. The analysis of crates/agentgateway/src/mcp/upstream/openapi/mod.rs reveals three distinct vectors stemming from the same underlying negligence:

1. Path Parameter Injection via String Replacement The application used a simple string replacement method path.replace(&format!("{{{key}}}"), s_val) to inject parameters into URL templates. If a template defined a path as /api/v1/users/{id}, and the input for id was ../admin, the resulting string became /api/v1/users/../admin. Most web servers and proxies normalize this path to /api/v1/admin, granting the attacker access to a completely different endpoint than intended.

2. Query Parameter Injection Query parameters were appended to the URL string without percent-encoding. If the code simply concatenated key=value, an attacker providing a value of data&admin=true would transform the query string into key=data&admin=true. This effectively injects a new parameter (admin) that the upstream server might interpret to grant privileged access.

3. Header Injection (CRLF) The proxy allowed arbitrary header values to be passed through to the upstream request. Without validation or sanitization, this could facilitate HTTP Response Splitting or allow the injection of restricted headers like Host, X-Forwarded-For, or Authorization, enabling IP spoofing or session hijacking.

Code Analysis

The patch introduces strict encoding and allows-listing to neutralize the injection vectors. Below is a conceptual comparison of the vulnerable logic versus the hardened implementation.

Vulnerable Implementation (Conceptual):

// DANGEROUS: Naive replacement allows path traversal
let mut url = openapi_path.clone();
for (key, value) in params {
    // If value is "../", it alters the directory structure
    url = url.replace(&format!("{{{key}}}"), value);
}
 
// DANGEROUS: No encoding allows query injection
if let Some(query) = query_params {
    url.push_str("?");
    url.push_str(&format!("{}={}", key, value)); 
}

Patched Implementation (Commit 9a52875):

use percent_encoding::{utf8_percent_encode, CONTROLS};
 
// FIXED: Use regex to safely identify parameters
// FIXED: Apply percent-encoding to neutralize special chars
let safe_value = utf8_percent_encode(value, PATH_SEGMENT_SAFE).to_string();
 
// The replacer now ensures that "../" becomes "%2E%2E%2F"
// which is treated as a literal string, not a directory traversal
let url = PathParamReplacer::new(&openapi_path).replace(params);
 
// FIXED: Header Allow-listing
// Only headers explicitly defined in the OpenAPI schema are forwarded.
// Sensitive headers (Host, Content-Length) are filtered out.

The fix fundamentally changes the trust model: inputs are now guilty until proven innocent (encoded/validated) rather than trusted by default.

Exploitation Scenarios

Attackers can exploit this vulnerability if they can influence the parameters passed to the MCP tool call. This is common in agentic workflows where the agent processes untrusted user prompts.

Scenario 1: Path Traversal

  • Target: An endpoint /api/files/{filename} intended to read user documents.
  • Attack: The attacker supplies ../../etc/passwd as the filename.
  • Result: The proxy generates GET /api/files/../../etc/passwd. The upstream server resolves this to GET /etc/passwd, returning sensitive system files.

Scenario 2: Privilege Escalation via Query Injection

  • Target: An endpoint /api/update_profile?uid={user_id}.
  • Attack: The attacker supplies 123&role=admin as the user_id.
  • Result: The proxy generates GET /api/update_profile?uid=123&role=admin. If the backend trusts the role parameter, the user is silently promoted to an administrator.

Scenario 3: Header Manipulation

  • Target: An API that relies on the X-User-ID header for authentication, which the proxy is supposed to set securely.
  • Attack: The attacker injects a custom header via a tool parameter that maps to a header field.
  • Result: The attacker masquerades as a different user ID, bypassing authentication checks on the upstream service.

Impact Assessment

Confidentiality (High): The most immediate risk is unauthorized access to sensitive data via path traversal. Attackers could read configuration files, credentials, or data belonging to other users on the upstream system.

Integrity (High): Query parameter injection allows attackers to manipulate the logic of the upstream application. This could lead to unauthorized state changes, such as modifying user permissions, triggering administrative actions, or corrupting data.

Availability (Low): While the vulnerability primarily targets data access and logic manipulation, malformed requests caused by injection could potentially trigger unhandled exceptions in the upstream service, leading to minor availability issues, though this is not the primary impact vector.

Risk Rating: Based on the ability to bypass access controls and modify request logic remotely, this vulnerability is rated High. It effectively breaks the isolation between the AI agent and the protected backend API.

Official Patches

GitHub AdvisoryOfficial GitHub Security Advisory
AgentgatewayFix Commit

Fix Analysis (1)

Technical Appendix

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

Affected Systems

Agentgateway (Rust Crate)AI Agent implementations using Agentgateway for MCP support

Affected Versions Detail

Product
Affected Versions
Fixed Version
agentgateway
agentgateway
< 2026-01-28 (Commit 9a52875)Commit 9a52875
AttributeDetail
Vulnerability TypeImproper Input Validation
CWE IDCWE-20 / CWE-74
Attack VectorNetwork (Remote)
CVSS Estimate8.1 (High)
ImpactPath Traversal, Parameter Injection
PlatformRust

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059Command and Scripting Interpreter
Execution
CWE-74
Injection

Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Vulnerability Timeline

Fix commit merged
2026-01-28
Advisory published
2026-01-28

References & Sources

  • [1]GHSA-v2x6-wwfw-r2rq Advisory
  • [2]Agentgateway Repository

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

•7 minutes ago•CVE-2026-56170
7.5

CVE-2026-56170: Remote Denial of Service via Resource Exhaustion in ASP.NET Core

CVE-2026-56170 is a high-severity Remote Denial of Service (DoS) vulnerability in Microsoft's ASP.NET Core framework. The vulnerability spans three separate resource-management vectors within the ASP.NET Core ecosystem, including SignalR Stateful Reconnect allocations, JSON Patch Type Confusion leading to stack exhaustion, and Kestrel HTTP/2 synchronization issues. An unauthenticated remote attacker can exploit these issues to cause process-terminating exceptions, rendering applications unavailable.

Amit Schendel
Amit Schendel
0 views•7 min read
•about 1 hour ago•GHSA-8WHX-365G-H9VV
2.3

GHSA-8whx-365g-h9vv: HTML5 Named Whitespace Bypass in Loofah allowed_uri? Validation

The Loofah Ruby gem version 2.25.0 and 2.25.1 contains an incomplete validation vulnerability in its public string-level utility Loofah::HTML5::Scrub.allowed_uri?. This helper fails to detect 'javascript:' URIs that are split by HTML5 named whitespace character references such as &Tab; and &NewLine;. Applications manually invoking this utility to validate links are vulnerable to stored Cross-Site Scripting (XSS), as browsers parse and remove these entities during rendering.

Alon Barad
Alon Barad
3 views•7 min read
•about 2 hours ago•CVE-2026-50525
7.5

CVE-2026-50525: Denial of Service Vulnerability in Microsoft .NET XML Cryptography Stack

CVE-2026-50525 is a high-severity Denial of Service (DoS) vulnerability in the Microsoft .NET XML Cryptography stack. The vulnerability resides in the `System.Security.Cryptography.Xml` library, specifically within the `EncryptedXml` processing engine. Unauthenticated remote attackers can exploit this flaw by sending specifically crafted XML documents containing nested or recursive structures, or utilizing resource-intensive transforms. Processing such payloads leads to infinite CPU loops, stack exhaustion, or memory starvation, resulting in application termination.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 3 hours ago•CVE-2026-50659
6.5

CVE-2026-50659: SMTP Command and Header Injection in .NET System.Net.Mail

An improper encoding and escaping vulnerability in the .NET SMTP client component allows network-based attackers to perform SMTP command smuggling and email spoofing by injecting control characters into email fields.

Alon Barad
Alon Barad
4 views•8 min read
•about 4 hours ago•CVE-2026-50651
7.5

CVE-2026-50651: Denial of Service via Uncontrolled Resource Allocation in .NET System.Net.Http

CVE-2026-50651 is a high-severity Denial of Service vulnerability in Microsoft .NET runtimes, SDKs, and Visual Studio installations. It stems from a weakness in System.Net.Http (CWE-770), where the HTTP/2 connection handling state machine fails to throttle server-initiated protocol streams and control frames. An attacker-controlled server can exploit this by returning highly fragmented or infinite control and continuation frame sequences. This forces the client to allocate memory indefinitely on the managed heap, eventually provoking an unhandled Out-of-Memory (OOM) exception and application crash.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 5 hours ago•CVE-2026-59197
8.2

CVE-2026-59197: Heap Out-of-Bounds Write and Division-by-Zero in Pillow libImaging

A heap out-of-bounds write vulnerability exists in Pillow prior to version 12.3.0 due to an integer overflow during image expansion calculations. The subsequent patch introduced a division-by-zero regression causing denial of service.

Alon Barad
Alon Barad
5 views•3 min read