Playbook · for Engineering, Security, Leadership
AI agents and MCP servers: least privilege
Agents act with the permissions you give them. Scope identities per task, keep credentials short-lived and log every tool call.
By Mr.DLast reviewed 3 min read
Agents do what their access allows
An AI agent plans, calls tools and acts on the result. Whatever goal you give it, it will try the paths it can reach, and an injected instruction can change the goal. OWASP lists this as excessive agency (LLM06): too much functionality, too many permissions, too much autonomy. The fix is the oldest rule in security, applied to a new kind of user.
1. One identity per agent
- Give every agent, and every MCP server it uses, its own workload identity: an IAM role, a service account, a scoped token. Never run agents with a developer's personal credentials or an admin key.
- Name identities so a log line tells you which agent did what.
- Keep credentials short-lived and issued at run time from a secrets manager or role assumption, not stored in config files or environment variables of images.
2. Scope permissions per task
Start from nothing and add what the task needs.
- Read-only by default. Separate tools for reading and writing, with write tools reviewed harder.
- Restrict resources, not just actions: one bucket, one project, one repository.
- For coding agents, keep production credentials out of the workspace entirely.
- Review agent permissions like any other privileged access, on a schedule.
3. Choose MCP servers like dependencies
An MCP server is code that runs with your agent's access. Several MCP servers and agent frameworks have had remote code execution flaws in 2026, and malicious packages posing as MCP servers have appeared in public registries.
- Install MCP servers only from publishers you trust, pin versions and review updates.
- Prefer servers that run with their own minimal credentials over ones that inherit yours.
- Do not let an agent add or configure MCP servers on its own.
- Keep a list of approved servers and what each can reach.
4. Contain the runtime
- Run agents in isolated environments: a container or VM per run, no access to the host.
- Require IMDSv2 with a hop limit of 1 on cloud instances, so workloads cannot read instance credentials from the metadata service.
- Apply an egress allowlist: the model endpoint and the APIs the task needs. Block everything else, including internal networks the agent has no reason to scan.
- Set budgets and rate limits per agent, so a loop cannot run for hours.
5. Keep a human on the irreversible steps
Require explicit approval before payments, deletes, deploys, permission changes, or sending data outside the company. Show the approver the real parameters, not the agent's summary of them.
6. Log every step and be able to stop it
- Log each tool call with its inputs, outputs and the identity used, in CloudTrail and your application logs.
- Alert on denied calls, new destinations and unusual volume.
- Give a named person the authority and the button to stop a run, and rehearse it.
7. Put it in writing
Add autonomous agents to your acceptable use policy: which systems they may act on, which outside targets they may test (only with written permission), and who is accountable for what an agent does. In November 2026 an engineer's testing agents probed a rival's internal systems; the apology came from the CEO.
What WardBee checks
On AWS, WardBee checks the controls that contain an agent's blast radius: IMDSv2, administrative and privilege-escalation IAM policies, full Bedrock access, Bedrock agent roles and guardrails, long-term Bedrock API keys, CloudTrail and GuardDuty. Results map to ISO 27001 and SOC 2 controls for access management and logging.
What WardBee checks for this playbook
- EC2 instance requires IMDSv2 or has the instance metadata service disabled
ec2_instance_imdsv2_enabled - Customer managed IAM policy does not allow actions that can lead to privilege escalation
iam_policy_allows_privilege_escalation - Inline IAM policy does not allow '*:*' administrative privileges
iam_inline_policy_no_administrative_privileges - IAM role does not have AmazonBedrockFullAccess managed policy attached
bedrock_full_access_policy_attached - Amazon Bedrock agent execution role follows least privilege
bedrock_agent_role_least_privilege - Amazon Bedrock agent uses a guardrail to protect agent sessions
bedrock_agent_guardrail_enabled - Amazon Bedrock long-term API key has expired
bedrock_api_key_no_long_term_credentials - Region has at least one CloudTrail trail logging
cloudtrail_multi_region_enabled
Runs on each AWS sync while a framework it maps to, such as ISO 27001, is enabled. Run it on your account
Related standards: OWASP Top 10 for LLM Applications · ISO/IEC 42001


