//Azure DevOps - Security Testing Guide (Ado-STG)/"Artificial Intelligence" (AI)
| ID: | AdoSTG-AI-03 |
Potential MCP-enabled task found with untrusted input and token access; this potentially means that the MCP connection can be abused to gain remote code execution or exfiltrate sensitive information.
MCP servers in Azure DevOps mainly serve to retrieve and analyze data from ADO projects.
In their documentation Microsoft [001] describes this as a two-step process:
The general risk here is that MCP servers or exposed tokens can be abused by attackers to compromise accounts.
MCP servers can usually be identified by the word "MCP" in the pipeline YAML file.
For example, to have an MCP client, the official MCP documentation [002] has the following example for implementation.
1import asyncio 2import sys 3 4from mcp import Client, StdioServerParameters 5from mcp.client.stdio import stdio_client 6from mcp_types import TextContent 7 8from anthropic import Anthropic 9from dotenv import load_dotenv 10 11load_dotenv() # load environment variables from .env 12 13MODEL = "claude-opus-5" 14anthropic = Anthropic()
Likewise, the Microsoft documentation [003] also contains "mcp":
1{ 2 "servers": { 3 "ado-remote-mcp": { 4 "url": "https://mcp.dev.azure.com/{organization}", 5 "type": "http", 6 "headers": { 7 "X-MCP-Toolsets": "repos,wiki,wit" 8 } 9 } 10 }, 11 "inputs": [] 12}
Simply grepping for the word "mcp" should have very few false positives and help identify where MCP clients are in use.
Once an MCP-enabled pipeline has been found, we can check for token access. The easiest way to achieve this is to look for known dangerous tokens:
1SYSTEM_ACCESSTOKEN, 2System.AccessToken, 3AZURE_DEVOPS_EXT_PAT
Lastly, we can check for untrusted input being passed to the MCP server from the pipeline.
The following list contains user-controlled ADO contexts:
1"Build.SourceVersionMessage", # Commit message (user-controlled) 2"Build.SourceBranchName", # Short branch name (user-controlled via PR) 3"Build.SourceBranch", # Full branch ref e.g. refs/heads/feature/foo 4"Build.RequestedFor", # Display name of person who triggered build 5"Build.RequestedForEmail", # Email of person who triggered build 6"System.PullRequest.SourceBranch", # PR source branch name 7"System.PullRequest.TargetBranch", # PR target branch name
Disable MCP functionality in AI tasks or ensure pipeline tokens are not provided. If MCP is necessary, restrict to trusted inputs only.