This module reflects MCP security standards as of February 5, 2026, aligned with MCP Specification 2025-11-25. Always refer to the current MCP Specification and security best practices documentation for the latest guidance.
Learning Objectives
By the end of this module, you will be able to:- Identify MCP-specific threats including prompt injection, tool poisoning, session hijacking, confused deputy problems, token passthrough vulnerabilities, and supply chain risks
- Apply security controls including robust authentication, least privilege access, secure token management, and supply chain verification
- Leverage Microsoft Prompt Shields, Azure Content Safety, and GitHub Advanced Security for MCP workload protection
- Recognize the importance of tool metadata validation and monitoring for dynamic changes
- Combine foundational security practices with MCP-specific controls for comprehensive protection
Mandatory Security Requirements
Before exploring specific threats, you need to know the non-negotiable requirements from the MCP specification: Research from the Microsoft Digital Defense Report shows that 98% of reported breaches would be prevented by robust security hygiene. The most effective strategy combines foundational security practices with MCP-specific controls.OWASP MCP Top 10
The OWASP MCP Azure Security Guide defines the ten most critical security risks for MCP implementations:| Risk | Description | Primary Azure Mitigation |
|---|---|---|
| MCP01 | Token Mismanagement & Secret Exposure | Azure Key Vault, Managed Identity |
| MCP02 | Privilege Escalation via Scope Creep | RBAC, Conditional Access |
| MCP03 | Tool Poisoning | Tool validation, integrity verification |
| MCP04 | Supply Chain Attacks | GitHub Advanced Security, dependency scanning |
| MCP05 | Command Injection & Execution | Input validation, sandboxing |
| MCP06 | Prompt Injection via Contextual Payloads | Azure AI Content Safety, Prompt Shields |
| MCP07 | Insufficient Authentication & Authorization | Azure Entra ID, OAuth 2.1 with PKCE |
| MCP08 | Lack of Audit & Telemetry | Azure Monitor, Application Insights |
| MCP09 | Shadow MCP Servers | API Center governance, network isolation |
| MCP10 | Context Injection & Over-Sharing | Data classification, minimal exposure |
AI-Specific Security Threats
MCP systems face attack vectors that traditional security measures cannot fully address:Indirect Prompt Injection
Indirect Prompt Injection
Indirect Prompt Injection (also called Cross-Domain Prompt Injection) is one of the most critical vulnerabilities in MCP-enabled AI systems. Attackers embed malicious instructions within external content — documents, web pages, emails, or data sources — that AI systems subsequently process as legitimate commands.Attack scenarios:
- Document-based: Malicious instructions hidden in processed documents that trigger unintended AI actions
- Web content: Compromised web pages containing embedded prompts that manipulate AI behavior when scraped
- Email-based: Malicious prompts in emails that cause AI assistants to leak information or perform unauthorized actions
- Data source contamination: Compromised databases or APIs serving tainted content to AI systems
- Deploy Microsoft AI Prompt Shields for advanced detection and filtering
- Use delimiter and datamarking systems to distinguish trusted instructions from external content
- Implement spotlighting techniques to help models maintain proper instruction hierarchy
- Validate and sanitize all external content before it enters the model’s context
Tool Poisoning Attacks
Tool Poisoning Attacks
Tool Poisoning targets the metadata that defines MCP tools, exploiting how LLMs interpret tool descriptions to make execution decisions.Attack mechanisms:
- Metadata manipulation: Attackers inject malicious instructions into tool descriptions or parameter definitions
- Invisible instructions: Hidden prompts in tool metadata that the AI model processes but human users cannot see
- Dynamic tool modification (“Rug Pulls”): Tools approved by users are later modified to perform malicious actions
- Parameter injection: Malicious content embedded in tool parameter schemas that influence model behavior
- Implement cryptographic hashing and integrity verification of tool definitions
- Monitor for unexpected changes with real-time alerting
- Require explicit user approval for any tool modifications
- Maintain version history with rollback capabilities
Session Hijacking
Session Hijacking
Session hijacking in stateful MCP implementations lets unauthorized parties obtain and abuse legitimate session identifiers to impersonate clients.Attack scenarios:
- Session hijack prompt injection: Attackers with stolen session IDs inject malicious events into servers sharing session state
- Direct impersonation: Stolen session IDs enable direct MCP server calls that bypass authentication
- Compromised resumable streams: Attackers terminate requests prematurely, causing legitimate clients to resume with malicious content
- Use cryptographically secure, non-deterministic session IDs (minimum 128 bits of entropy)
- Bind session IDs to user-specific information:
<user_id>:<session_id> - Implement proper expiration, rotation, and invalidation
- Enforce HTTPS for all session communication
- Verify ALL inbound requests — never rely on sessions for authentication
Confused Deputy Problem
Confused Deputy Problem
The confused deputy problem occurs when MCP servers act as authentication proxies between clients and third-party services, creating opportunities for authorization bypass.Attack mechanics:
- Cookie-based consent bypass: Previous user authentication creates consent cookies that attackers exploit through malicious authorization requests with crafted redirect URIs
- Authorization code theft: Existing consent cookies cause authorization servers to skip consent screens, redirecting codes to attacker-controlled endpoints
- Unauthorized API access: Stolen authorization codes enable token exchange and user impersonation
- MCP proxy servers using static client IDs MUST obtain user consent for each dynamically registered client
- Implement OAuth 2.1 with PKCE (Proof Key for Code Exchange) for all authorization requests
- Apply strict validation of redirect URIs and client identifiers
Token Passthrough Vulnerabilities
Token Passthrough Vulnerabilities
Token passthrough is an explicit anti-pattern where MCP servers accept client tokens without proper validation and forward them to downstream APIs.Why it’s prohibited: The MCP specification explicitly forbids this pattern because it:
- Bypasses critical rate limiting, validation, and monitoring controls
- Makes client identification impossible, corrupting audit trails
- Enables malicious actors to use servers as proxies for data exfiltration
- Violates downstream services’ trust assumptions about token origins
- Allows compromised tokens to enable lateral movement across multiple services
- Never accept tokens not explicitly issued for your MCP server
- Always validate token audience claims match the MCP server’s identity
- Implement short-lived access tokens with secure rotation
- Store tokens in Azure Key Vault or equivalent secure credential stores
Microsoft Security Solutions
AI Prompt Shields
Microsoft AI Prompt Shields provide comprehensive defense against both direct and indirect prompt injection attacks:Advanced Detection
Machine learning algorithms and NLP techniques detect malicious instructions in external content. Real-time analysis of documents, web pages, emails, and data sources for embedded threats.
Spotlighting
Distinguishes between trusted system instructions and potentially compromised external inputs. Text transformation methods isolate malicious content while maintaining legitimate context.
Delimiter Systems
Explicit boundary definition between trusted system messages and external input text. Special markers highlight boundaries between trusted and untrusted data sources.
Continuous Intelligence
Microsoft continuously monitors emerging attack patterns and updates defenses. Regular security model updates maintain effectiveness against evolving threats.
Azure Content Safety
Azure Content Safety provides additional detection for jailbreak attempts, harmful content, and security policy violations — unified security controls across AI application components.Authentication and Authorization
External Identity Provider Integration
The MCP specification (2025-11-25) now allows MCP servers to delegate authentication to external identity providers rather than implementing custom authentication. This is a significant security improvement: Benefits of delegating to Microsoft Entra ID:- Eliminates custom authentication implementation risks
- Inherits enterprise-grade security with MFA and Conditional Access
- Centralizes user lifecycle management and compliance auditing
- Provides risk-based adaptive authentication
Access Control Implementation
Apply Principle of Least Privilege
Grant MCP servers only the minimum permissions required for their intended functionality. Conduct regular permission reviews to prevent privilege creep.
Implement Role-Based Access Control
Define fine-grained role assignments scoped tightly to specific resources and actions. Avoid broad permissions that unnecessarily expand the attack surface.
Monitor Continuously
Implement ongoing access auditing and monitor permission usage patterns for anomalies. Promptly remediate excessive or unused privileges.
Supply Chain Security
MCP implementations must treat all AI ecosystem components — models, embeddings, context providers, external APIs — with the same security rigor as traditional software dependencies. AI-specific supply chain elements to verify:- Foundation Models — pre-trained models requiring provenance verification
- Embedding Services — external vectorization and semantic search services
- Context Providers — data sources, knowledge bases, and document repositories
- Third-party APIs — external AI services, ML pipelines, and data processing endpoints
- Model Artifacts — weights, configurations, and fine-tuned model variants
- Secret scanning — automated detection of credentials and API keys in repositories
- Dependency scanning — vulnerability assessment for open-source dependencies
- CodeQL analysis — static code analysis for security vulnerabilities
- Supply chain insights — visibility into dependency health and security status
Foundational Security Best Practices
- Secure Development
- Infrastructure Hardening
- Zero Trust Architecture
- Monitoring and Detection
- Protect against OWASP Top 10 web application vulnerabilities
- Implement controls for OWASP Top 10 for LLMs
- Use dedicated vaults (Azure Key Vault) for tokens, API keys, and sensitive configuration
- Implement end-to-end encryption across all application components
- Rigorously validate all user inputs, API parameters, and data sources
Microsoft Enterprise Security Ecosystem
Microsoft Defender for Cloud
Comprehensive cloud security posture management for MCP workloads.
Azure Sentinel
Cloud-native SIEM and SOAR capabilities for advanced threat detection.
Microsoft Entra ID
Enterprise identity and access management with conditional access policies.
Azure Key Vault
Centralized secrets management with hardware security module (HSM) backing.
Hands-On Security Training
For practical, hands-on security implementation experience, complete the MCP Security Summit Workshop (Sherpa):| Camp | Focus | OWASP Risks Covered |
|---|---|---|
| Base Camp | MCP fundamentals & authentication vulnerabilities | MCP01, MCP07 |
| Camp 1: Identity | OAuth 2.1, Azure Managed Identity, Key Vault | MCP01, MCP02, MCP07 |
| Camp 2: Gateway | API Management, Private Endpoints, governance | MCP02, MCP07, MCP09 |
| Camp 3: I/O Security | Prompt injection, PII protection, content safety | MCP03, MCP05, MCP06 |
| Camp 4: Monitoring | Log Analytics, dashboards, threat detection | MCP08 |
| The Summit | Red Team / Blue Team integration test | All |
Key Security Takeaways
- Layered security: Combine foundational practices (secure coding, least privilege, supply chain verification, continuous monitoring) with AI-specific controls
- AI-specific threat landscape: MCP systems face unique risks that require specialized mitigations beyond traditional software security
- Authentication excellence: Use external identity providers (Microsoft Entra ID), enforce proper token validation, and never accept tokens not explicitly issued for your MCP server
- AI attack prevention: Deploy Microsoft Prompt Shields and Azure Content Safety for injection and poisoning defenses
- Session security: Use cryptographically secure session IDs bound to user identities; never use sessions for authentication
- OAuth security: Prevent confused deputy attacks through explicit user consent, PKCE, and strict redirect URI validation
- Token principles: Avoid passthrough anti-patterns, validate audience claims, and maintain clear trust boundaries
- Supply chain: Treat all AI ecosystem components with the same security rigor as traditional software dependencies
- Continuous evolution: Stay current with rapidly evolving MCP specifications and maintain adaptive security postures
Resources
MCP Security Best Practices
Official MCP security best practices documentation.
OWASP MCP Azure Security Guide
Comprehensive OWASP MCP Top 10 with Azure implementation guidance.
MCP Authorization Specification
The official MCP authorization specification.
OAuth 2.0 Security Best Practices (RFC 9700)
Current OAuth security best practices standard.
OWASP Top 10 for LLMs
Security risks specific to large language model applications.
Microsoft Prompt Shields
Documentation for deploying AI Prompt Shields.