/

CVE-2026-61462

Severity:

HIGH RISK

(8.6)

Path Traversal (CWE-73) in mcp-gitlab Job Routing Logic

CVE-2026-61462

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-73

Impact:

Unauthorized Access to GitLab API Resources

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

mcp-gitlab contains a path traversal flaw in build/index.js where the job_id parameter is concatenated into GitLab API paths without sufficient normalization or validation.

By supplying crafted job_id values, an attacker can escape the intended path prefix and redirect the operator's authenticated GitLab API requests to arbitrary endpoints.

Affected context

This vulnerability occurs in environments where mcp-gitlab is used to interact with GitLab CI jobs via the build/index.js component.

The issue manifests when job_id values received from user input or external triggers are directly incorporated into GitLab API request paths.

In deployments where the operator's personal access token is used to authenticate these requests, any path traversal in job_id can redefine the target API resource the tool accesses.

Exploit preconditions

  • Attack surface: HTTP or RPC interface that accepts job_id values for mcp-gitlab operations.
  • Required access: Ability to submit or influence job_id parameters (e.g., through a CLI, API, or task configuration).
  • Trigger point: Construction of GitLab API URLs using the job_id parameter in build/index.js.
  • Why exploitation is possible: The code treats job_id as a trusted path segment, lacks normalization and prefix enforcement, allowing sequences like ../../../user to escape the intended resource path and reach arbitrary GitLab API endpoints under the operator's access token.

Why this happens

The underlying bug stems from improper control over a resource name used to construct paths, as described by CWE-73: External Control of File Name or Path.

The build logic concatenates job_id directly into an API path without validating that it remains within an expected namespace or resource hierarchy.

This pattern allows attackers to influence which GitLab API endpoint is ultimately called, leveraging traversal-style segments to redirect authenticated requests to arbitrary resources.

Conceptually, it is an over-trust in externally supplied identifiers for path construction, rather than deriving allowed targets from a constrained, server-side mapping.

Potential impact

  • Attackers may access arbitrary GitLab API resources within the scope of the operator's personal access token.
  • Attackers could read project metadata, user information, or job details they would not normally be authorized to view.
  • Attackers may trigger actions on other API endpoints (e.g., pipelines or jobs) if the token has sufficient permissions.
  • The tool's operator may unknowingly perform sensitive operations against unintended GitLab resources.

General mitigation guidance

Effective mitigation focuses on constraining how external identifiers influence API paths and enforcing strict validation on resource selectors.

Common defensive patterns include:

  • Treat job_id and similar parameters as opaque identifiers and resolve them via server-side lookups rather than direct path concatenation.
  • Implement allowlists or pattern-based validation so that job_id can only match expected formats (e.g., numeric IDs) and cannot contain traversal sequences or path separators.
  • Normalize and canonicalize constructed paths before use, rejecting any value that escapes the intended prefix or resource namespace.
  • Reduce the scope of personal access tokens used by automation tools, aligning token permissions strictly with minimum necessary operations.
  • Separate configuration defining the base GitLab API paths from user-controlled inputs, and never allow users to override base URLs or prefixes.

How teams detect issues like this

Organizations can detect similar path-control issues by:

  • Using static analysis rules that flag direct concatenation of user-controlled values into URL or path strings, especially where traversal patterns may be possible.
  • Reviewing code for API clients that build endpoints from parameters like job_id, pipeline_id, or project path without validation or normalization.
  • Enforcing coding policies that require centrally managed helper functions for building API paths, making it easier to audit and constrain behavior.
  • Deploying runtime logging to capture unexpected API endpoint accesses initiated by tools like mcp-gitlab and alert on unusual resource patterns.
  • Applying automated security review tools that focus on CWE-73 and related path manipulation patterns in CI/CD automation code.

Sources

SourceLink
github.comgithub.com/zereight/gitlab-mcp
github.comgithub.com/zereight/gitlab-mcp/commit/e2a81a047ab8750fa5bfa1763b5d85e5616f3994
github.comgithub.com/zereight/gitlab-mcp/issues/587
vulncheck.comvulncheck.com/advisories/mcp-gitlab-path-traversal-via-job-id-parameter

Frequently asked

questions

Exploitability depends on who can control the job_id parameter. If untrusted users can supply or influence job_id values, they can redirect authenticated GitLab API calls to resources of their choosing, limited by the operator's token permissions.

An attacker must be able to submit job_id values through whatever interface mcp-gitlab exposes—such as a command-line flag, configuration file, or upstream service. They do not need direct access to the GitLab API itself, only the ability to drive the mcp-gitlab integration.

The safest pattern is to stop using raw job_id values for path construction and instead resolve job identifiers through a controlled mapping or lookup. Additionally, enforce strict validation on permitted job_id formats and use centralized helpers to build GitLab API URLs.

Adopt development guidelines that prohibit direct concatenation of user-controlled data into paths or URLs, pair them with static analysis checks for CWE-73 patterns, and ensure that all automation tools operate with least-privilege tokens and well-defined resource-level access constraints.

Find out what's already
exploitable in your codebase.