Vertex AI "Double Agents" — Over-Privileged AI Agent Identities (March 2026)
On 31 March 2026, Palo Alto Networks' Unit 42 published research titled "Double Agents: Exposing Security Blind Spots in GCP Vertex AI" by researcher Ofir Shaty. It showed that an AI agent built with Google's Agent Development Kit (ADK) and deployed to Vertex AI Agent Engine ran under a Google-managed service identity whose default permissions reached far beyond what the agent needed. Any code inside the agent could ask the instance metadata server for that identity's access token. With it, the researchers read every Cloud Storage bucket in the customer's project, and reached restricted, Google-owned Artifact Registry repositories that hold the container images behind the Vertex AI Reasoning Engine.
This page is different from most of the War Room. Nothing here is known to have been exploited in the wild. Unit 42 did the work in "a controlled environment" through responsible disclosure, and makes no claim of real-world abuse. No CVE was issued. It is here because it is the clearest public example of the failure mode that will define AI-agent incidents: an agent is code that does what its inputs tell it to, and it runs with whatever identity the platform hands it. If that identity is broad, a poisoned tool, a malicious dependency, or a successful prompt injection turns a chatbot into a credential-harvesting pivot point.
TL;DR
- What: Agents deployed on Vertex AI Agent Engine ran by default as a per-project service agent,
service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com. Unit 42 found its default grants included project-wide Cloud Storage read (storage.buckets.get/list,storage.objects.get/list). - How: Code running inside the agent could get that identity's OAuth token from the metadata server, which needs no authentication from inside the workload. Unit 42 then used the token outside the agent.
- Reach: All buckets in the consumer project. Restricted Google-owned Artifact Registry repos (
reasoning-engine,llm-extension/reasoning-engine-py310:prod). Listing of tenant-project buckets containingDockerfile.zip,code.pklandrequirements.txt. Default OAuth scopes broad enough to name Gmail, Calendar and Drive, but blocked by missing IAM grants. - Not shown: No Workspace data access. No modification of Google's production images, which Google says is blocked by "strong, non-overridable controls". No exploitation in the wild.
- Fix: Google updated its documentation and recommends Bring Your Own Service Account (BYOSA), meaning each agent runs as a dedicated, least-privilege account. Google's newer agent identity option goes further, with a per-agent SPIFFE principal whose tokens are bound to the runtime by mTLS so they cannot be replayed elsewhere.
- Lesson: Treat every agent as untrusted code. Give it its own identity, the narrowest roles, a perimeter around the data, and egress controls. Assume its token will leak.
The Alert
There was no pager and no breach notification. The "alert" was a research blog post and the same-day coverage by The Hacker News. For security teams running agents on Vertex AI, the useful question was not "were we hit?" but "what can our agents' identities reach today?"
Shaty put the risk this way, as quoted by The Hacker News: a misconfigured or compromised agent can become a "'double agent' that appears to serve its intended purpose, while secretly exfiltrating sensitive data." Elsewhere in the coverage: "Granting agents broad permissions by default violates the principle of least privilege."
Why this matters even without a breach
An AI agent takes instructions from untrusted input such as user prompts, retrieved documents, web pages and tool output. It also often runs third-party code: tools, dependencies, and serialized agent packages. Any one of those can make the agent run code its author did not intend. Once that happens, the agent's blast radius is exactly the blast radius of its identity. Unit 42 showed that, by default, that identity on Agent Engine could read the whole project's object storage.
Impact
Because this was a research disclosure, "impact" here means demonstrated reach, not confirmed victims.
| Area | What Unit 42 reported | Status |
|---|---|---|
| Consumer project (customer's) | "Unrestricted read access to all Google Cloud Storage Buckets data within the consumer project" | Demonstrated |
| Producer project (Google-managed) | Access to restricted Artifact Registry repos under cloud-aiplatform-private, including reasoning-engine and llm-extension/reasoning-engine-py310:prod. Images "form the core of the Vertex AI Reasoning Engine" | Demonstrated (read/pull) |
| Tenant project (Google-managed, per Agent Engine instance) | Could list buckets holding Dockerfile.zip, code.pkl, requirements.txt. The Dockerfile referenced internal buckets such as reasoning-engine-restricted, but access to that one was denied | Partial |
| Google Workspace | Default OAuth scopes were "far too permissive" and in principle covered Gmail, Calendar, Drive. But "the necessary IAM permissions for Workspace are not granted" by default | Not shown, out of scope |
| Supply-chain tampering of Google images | Google confirmed "strong, non-overridable controls" stop the service agent from altering production images | Blocked by design |
code.pkl deserialization → RCE | Flagged as a possible path. Testing it "was not in the scope of our investigation" | Not tested |
| In-the-wild exploitation | None claimed | None known |
Disputed or unclear details
- Who can trigger it. Unit 42 describes an attacker who controls or poisons the code of a deployed agent. A later Cloud Security Alliance research note summarises the wider family of Vertex AI issues as "users with read-only roles can pull service agent credentials". That framing comes from XM Cyber's separate Ray-on-Vertex finding, not Unit 42's Agent Engine work. Do not treat a Viewer role as enough to exploit this issue without checking the primary sources.
- Disclosure dates. Unit 42's post says the findings were shared through "responsible disclosure" and that the team "collaborated" with Google, but gives no dates for reporting or remediation.
- Whether the default grants changed. Unit 42 says Google revised documentation and changed the ADK deployment workflow, so "the original code may no longer work". It does not say the default role was narrowed. As of this review, Google's Manage agent access page still lists the default role as
roles/aiplatform.reasoningEngineServiceAgentand does not list its permissions inline. Check the current role contents in your own project instead of trusting this page.
Timeline
Only dates with a public source are listed. The gap between "reported to Google" and "published" is not public.
timeline
title Vertex AI service-agent research, 2024 to 2026
November 2024 : Unit 42 ModeLeak - custom training job steals service agent token
January 2026 : XM Cyber - Ray on Vertex AI and Agent Engine token paths
: Google - working as intended per CSA
Date not public : Unit 42 reports Double Agents to Google
31 March 2026 : Unit 42 publishes Double Agents
: The Hacker News coverage
1 April 2026 : Cloud Security Alliance research note
Later in 2026 : Docs now under Gemini Enterprise Agent Platform with BYOSA and agent identity
| Date | Event | Source |
|---|---|---|
| November 2024 | Unit 42 publishes ModeLeak: a single aiplatform.customJobs.create permission lets a malicious custom training job steal the Custom Code Service Agent token and exfiltrate fine-tuned model adapters. Google patched those specific bugs, "but the architectural pattern remains" | CSA note |
| January 2026 | XM Cyber discloses two more Vertex AI paths that harvest service-agent tokens through the metadata server: Ray on Vertex AI (Viewer → head-node shell) and Agent Engine (malicious tool in an updated reasoning engine). Google called both "working as intended" | CSA note |
| Not public | Unit 42 reports Double Agents findings to Google | Unit 42 (no date given) |
| 2026-03-31 | Unit 42 publishes "Double Agents: Exposing Security Blind Spots in GCP Vertex AI" | Unit 42 |
| 2026-03-31 | The Hacker News reports the research | The Hacker News |
| 2026-04-01 | Cloud Security Alliance publishes "Vertex AI Service Agents as Lateral Movement Vehicles" with detection and mitigation guidance | CSA note |
| By 2026-11 | Google's Agent Engine docs, now under the Gemini Enterprise Agent Platform name, describe custom service accounts and a per-agent agent identity with mTLS-bound tokens | Manage agent access, Agent identity |
Root Cause
Three projects, one identity
A deployed Agent Engine agent touches three kinds of GCP project:
- Consumer project: yours. Your buckets, BigQuery, secrets, and the agent resource itself live here.
- Tenant project: Google-managed, one per Agent Engine instance. It holds the packaged agent (
code.pkl), itsrequirements.txtand a buildDockerfile. - Producer project: Google-managed, hosting the Vertex AI service and its private container images.
The agent runs under the AI Platform Reasoning Engine Service Agent, a Per-Project, Per-Product Service Agent (P4SA) named service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com, which holds roles/aiplatform.reasoningEngineServiceAgent (Google docs). Google's docs state the key fact plainly: "Deployed agents have access to all resources that their service account has permission to access."
flowchart TB
subgraph Consumer["Consumer project (yours)"]
B1["Cloud Storage buckets"]
AGR["Agent Engine resource"]
end
subgraph Tenant["Tenant project (Google-managed, per instance)"]
RT["Agent runtime container"]
TB["Buckets: Dockerfile.zip, code.pkl, requirements.txt"]
end
subgraph Producer["Producer project (Google-managed)"]
AR["Artifact Registry: cloud-aiplatform-private"]
end
MD["Metadata server (metadata.google.internal)"]
P4SA["P4SA: gcp-sa-aiplatform-re"]
AGR --> RT
RT -->|"token request, no auth needed in-workload"| MD
MD -->|"OAuth token for"| P4SA
P4SA -->|"default: storage.objects.get/list"| B1
P4SA -->|"list buckets"| TB
P4SA -->|"pull restricted images"| AR
style P4SA fill:#ff6b6b,color:#fff
style B1 fill:#cc5500,color:#fff
style AR fill:#cc5500,color:#fff
Link 1: one shared identity per project, with broad defaults
The P4SA is per project, not per agent. Every agent deployed in the project that does not override it runs as the same principal. Any role added to "make agent A work" is silently granted to agents B through Z. Unit 42 found that this shared principal had, by default:
storage.buckets.get,storage.buckets.liststorage.objects.get,storage.objects.list- AI Platform endpoint permissions, shown in a figure but not listed individually
That is read access to every object in every bucket in the project, granted to a workload that typically needs to read a model endpoint and maybe one bucket.
Link 2: the metadata server hands the token to any code in the workload
On GCP, workloads get credentials from the instance metadata server at metadata.google.internal. This is by design: client libraries call it to get short-lived OAuth tokens, so you never ship keys. The CSA note points out the consequence: any code running in the environment can query metadata.google.internal/computeMetadata/v1/instance/ "without authentication" and receive the token. The only "authentication" is being inside the workload.
Unit 42's agent included a tool that, when invoked, read the metadata service and returned the service agent's credentials, the hosting project, the agent's identity and the machine's OAuth scopes. In a real attack that tool would not be written by the agent's owner. It could arrive as:
- a malicious or compromised dependency in
requirements.txt(see LiteLLM for exactly this vector in 2026); - a shared or pre-built agent pulled from a marketplace or repo, which Unit 42 explicitly calls a supply-chain risk;
- an over-capable tool such as a code-execution or HTTP-fetch tool steered by prompt injection to request an internal URL. This is the classic SSRF shape.
This page deliberately does not show how to request the token. It is standard cloud behaviour, documented by Google, and the defensive point is simply that in-workload code can always obtain the workload's token. Your control is what that token can do and where it can be used.
Link 3: the token works from anywhere
A standard OAuth access token from the metadata server is a bearer token. Unit 42 used the stolen credentials to "pivot out of the agent's execution context". Nothing tied the token to the runtime it was minted for. This is the gap Google's newer agent identity closes: tokens are certificate-bound through a Google-managed Context-Aware Access policy, making stolen credentials "un-replayable". Using one outside its runtime returns "Context-Aware Access requirements are not met" (401) (Google docs).
Link 4: cross-boundary reach into Google's side
The same identity could also list buckets in the tenant project and pull images from restricted producer-side Artifact Registry repositories that ordinary customer identities are denied. Unit 42 notes the enumeration "revealed the existence of numerous other restricted images we were not previously aware of" and argues this gives attackers "a blueprint to find further vulnerabilities". Google says the service agent cannot alter production images, so this was read-only exposure of internal code and infrastructure details, not a cross-tenant poisoning path.
Link 5: pickle as the agent package format
The agent is shipped as code.pkl, a serialized Python pickle. Python's own documentation warns that unpickling untrusted data can execute arbitrary code. Unit 42 flagged it as a potential RCE path but did not test it. The CSA note adds that anyone with write access to such artifacts could plant persistent backdoors. This is an integrity failure waiting for a write primitive, not a demonstrated exploit.
The whole chain
flowchart LR
A["Untrusted input or code<br/>(dependency, shared agent, injected prompt)"] --> B["Code runs inside<br/>agent runtime"]
B --> C["Reads workload token<br/>from metadata server"]
C --> D["Bearer token usable<br/>outside the runtime"]
D --> E["Default P4SA roles:<br/>read ALL project buckets"]
D --> F["Pull restricted<br/>producer images"]
D --> G["List tenant buckets<br/>(code.pkl, Dockerfile)"]
E --> H["Data exfiltration"]
F --> I["Map of internal<br/>supply chain"]
style A fill:#cc5500,color:#fff
style D fill:#ff6b6b,color:#fff
style E fill:#ff6b6b,color:#fff
style H fill:#ff6b6b,color:#fff
Each link is defensible on its own. Metadata-server credentials are better than static keys. A per-project service agent is simpler to operate than per-agent identities. Pickle is a convenient way to ship a Python object. The failure is the composition: untrusted code plus an ambient, broad, replayable identity. Unit 42 makes the same point when it says to account for risks that emerge from how components interact "even when each one works as designed".
This was the third time
Vertex AI service-agent token theft was not new in 2026. The CSA note places Double Agents in a sequence:
| Research | Entry point | Token stolen | Reach |
|---|---|---|---|
| ModeLeak (Unit 42, Nov 2024) | aiplatform.customJobs.create | Custom Code Service Agent | All project buckets and BigQuery tables; then a pivot to GKE and model adapter exfiltration |
| XM Cyber (Jan 2026), Ray | Vertex AI Viewer → "Head Node Interactive Shell" | Custom Code Service Agent with devstorage.full_control scope | Storage, BigQuery, Pub/Sub |
| XM Cyber (Jan 2026), Agent Engine | Update reasoning engine with a malicious tool | Reasoning Engine Service Agent | Project resources |
| Double Agents (Unit 42, Mar 2026) | Code in a deployed ADK agent | Reasoning Engine Service Agent (P4SA) | All project buckets; producer images; tenant buckets |
The CSA's conclusion is the one to remember: broad default grants convert "any compromise or misuse of the AI workload execution environment into a project-wide privilege escalation incident".
Detection
This is the hard part. The CSA note warns that stolen-credential activity is "structurally identical" to legitimate platform operations, and most SIEMs have no rules for it. Here is what you can actually observe.
1. Metadata-server reads are not in Cloud Audit Logs
Reads from metadata.google.internal happen inside the workload. They do not appear as Cloud Audit Log entries. On a managed runtime like Agent Engine you do not control the host, so host-level monitoring is not available. Your options are:
- instrument the agent itself: wrap or forbid tools that make arbitrary HTTP requests, and log any request whose host is
metadata.google.internalor169.254.169.254; - watch for the token being used, which is logged (below).
# Defensive guard for agent tools that fetch URLs.
# Refuse link-local / metadata destinations before the request is made.
import ipaddress
import socket
from urllib.parse import urlparse
BLOCKED_HOSTS = {"metadata.google.internal", "metadata", "metadata.goog"}
def is_forbidden_url(url: str) -> bool:
host = (urlparse(url).hostname or "").lower().rstrip(".")
if host in BLOCKED_HOSTS:
return True
try:
infos = socket.getaddrinfo(host, None)
except socket.gaierror:
return True # unresolvable: refuse rather than guess
for info in infos:
ip = ipaddress.ip_address(info[4][0])
if ip.is_link_local or ip.is_loopback or ip.is_private:
return True # 169.254.169.254 is link-local
return False
def safe_fetch_tool(url: str) -> str:
if is_forbidden_url(url):
# Log as a security event, not a normal tool error.
raise PermissionError(f"blocked internal destination: {url}")
... # perform the request with timeouts and a response size cap
if __name__ == "__main__":
assert is_forbidden_url("http://metadata.google.internal/computeMetadata/v1/")
assert is_forbidden_url("http://169.254.169.254/")
assert is_forbidden_url("http://127.0.0.1:8080/")
A guard is not a boundary
This blocks a prompt-injected fetch tool. It does not stop malicious code in a dependency, which can call the metadata server directly. Treat in-agent guards as defence in depth. The real boundary is the identity's permissions and a token that cannot be replayed.
2. Alert on service-agent data access in audit logs
Cloud Storage object reads are Data Access audit logs, which are off by default for most services. Turn on DATA_READ for storage.googleapis.com at least for projects that host agents. Without it, the bucket reads in this attack leave no trace.
# Fragment of the project IAM policy enabling Data Access logs for GCS
# (apply with: gcloud projects set-iam-policy PROJECT_ID policy.yaml after merging)
auditConfigs:
- service: storage.googleapis.com
auditLogConfigs:
- logType: DATA_READ
- logType: DATA_WRITE
- service: artifactregistry.googleapis.com
auditLogConfigs:
- logType: DATA_READ
Then baseline what your agent identities normally touch and alert on anything else. In the Logs Explorer query language:
-- Any listing or read of Cloud Storage by an Agent Engine / Vertex service agent
protoPayload.authenticationInfo.principalEmail=~"gcp-sa-aiplatform(-re)?\.iam\.gserviceaccount\.com$"
protoPayload.serviceName="storage.googleapis.com"
protoPayload.methodName=("storage.buckets.list" OR "storage.objects.list" OR "storage.objects.get")
-- Enumeration of Artifact Registry by an agent identity (CSA lists this as a key signal)
protoPayload.authenticationInfo.principalEmail=~"gcp-sa-aiplatform"
protoPayload.serviceName="artifactregistry.googleapis.com"
protoPayload.methodName=~"ListRepositories|ListPackages|ListDockerImages"
Useful refinements:
storage.buckets.listby an agent identity is rare in healthy agents. Most agents know their bucket name. Listing every bucket is reconnaissance.- Check
requestMetadata.callerIpandcallerSuppliedUserAgent. A token used from an IP or user agent that is not Google's runtime is the replay signal. Exact runtime egress ranges are not documented in the sources above, so baseline them from your own logs. - Look for volume spikes: an agent that normally reads 10 objects an hour reading 10,000.
# Pull the last day of storage access by Vertex service agents for review
gcloud logging read '
protoPayload.authenticationInfo.principalEmail=~"gcp-sa-aiplatform"
AND protoPayload.serviceName="storage.googleapis.com"
' --project=PROJECT_ID --freshness=1d \
--format='table(timestamp, protoPayload.methodName, protoPayload.resourceName, protoPayload.requestMetadata.callerIp)'
3. Find what your agent identities can reach before an attacker does
# Every role held by any Vertex / Agent Engine service agent in a project.
# Google-provided grants only show in the Console with "Include Google-provided role grants".
gcloud projects get-iam-policy PROJECT_ID \
--flatten="bindings[].members" \
--filter="bindings.members:gcp-sa-aiplatform" \
--format="table(bindings.role, bindings.members)"
# What a given role actually contains
gcloud iam roles describe roles/aiplatform.reasoningEngineServiceAgent \
--format="value(includedPermissions)" | tr ';' '\n' | grep -E '^storage\.|^artifactregistry\.|^bigquery\.'
# Which resources a principal can access across the org (Policy Analyzer)
gcloud asset analyze-iam-policy \
--organization=ORG_ID \
--identity="serviceAccount:service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com"
# Unused permissions on service accounts (IAM Recommender)
gcloud recommender insights list --project=PROJECT_ID --location=global \
--insight-type=google.iam.policy.Insight
The CSA recommends auditing every gcp-sa-aiplatform*.iam.gserviceaccount.com principal and flagging any with devstorage.full_control, BigQuery admin or Pub/Sub admin.
Response and Remediation
What Google did
From Unit 42's post and Google's current documentation:
- Documentation. Google revised its Vertex AI access-control docs "to explicitly document how Vertex AI uses resources, accounts and agents."
- Deployment workflow. The ADK deployment process changed, so Unit 42's original proof-of-concept code may no longer work. The details of the change are not public.
- BYOSA guidance. Google recommends replacing the default service agent with a dedicated custom service account holding only what the agent needs.
- Image integrity. Google confirmed controls that stop the service agent from altering production images.
- Agent identity. Agent Engine now offers a per-agent principal (SPIFFE-based, with Google-managed x509 certificates) whose tokens are bound to the runtime. When to adopt it, and whether it was a response to this research, is not stated in the sources. It is listed here as the current strongest control.
What you should do if you run agents on Agent Engine
flowchart TD
S["Inventory agents and<br/>the identity each runs as"] --> Q{"Running as default<br/>gcp-sa-aiplatform-re?"}
Q -->|"Yes"| M["Move to agent identity<br/>or dedicated BYOSA"]
Q -->|"No"| R["Review custom SA roles<br/>vs. what the agent needs"]
M --> R
R --> P["Remove broad roles from<br/>the shared service agent"]
P --> L["Enable DATA_READ audit logs,<br/>add alert queries"]
L --> V["Put AI projects in a<br/>VPC-SC perimeter"]
V --> H["Hunt: past bucket list/get<br/>by agent identities"]
H -->|"Unexplained access"| IR["Treat as incident:<br/>rotate data, review agent code"]
H -->|"Clean"| D["Done. Re-check on every deploy"]
Hunting note: look back over your Data Access logs, if you had them on, for storage.buckets.list or unusual storage.objects.get by agent identities, and for Artifact Registry listing. If Data Access logs were off, you cannot prove a negative. Treat agents that ran third-party code or shared agent packages as higher risk, and review their dependencies.
What Would Have Prevented It
None of these controls are exotic. They are the same least-privilege controls you would use for any workload. Agents just make the need urgent, because their code path is partly decided by untrusted input.
1. Give every agent its own identity (agent identity)
The strongest option in Google's current docs is agent identity: one principal per agent, tied to the agent's lifecycle, with tokens that cannot be replayed off the runtime (docs).
# Deploy with a per-agent identity (Python SDK, v1beta1 API).
import vertexai
from vertexai import types
client = vertexai.Client(
project="my-project",
location="us-central1",
http_options=dict(api_version="v1beta1"),
)
remote_app = client.agent_engines.create(
agent=my_agent,
config={
"identity_type": types.IdentityType.AGENT_IDENTITY,
"requirements": ["google-cloud-aiplatform[agent_engines,adk]==<pinned>"],
"staging_bucket": "gs://my-agent-staging",
},
)
print(f"Effective Identity: {remote_app.api_resource.spec.effective_identity}")
# ADK CLI: write the config next to the agent before `adk deploy`
echo '{ "identity_type": "AGENT_IDENTITY" }' > .agent_engine_config.json
# Terraform (google-beta provider), inside the agent resource's spec block
spec {
identity_type = "AGENT_IDENTITY"
# ...
}
Things Google's docs call out:
- Don't grant
roles/aiplatform.userat project level to agents. It would let an agent "modify or delete other agents in the project." - Every redeploy creates a new principal. Old grants don't carry over, which causes "silent runtime access loss" in CI/CD. Read
spec.effectiveIdentityafter deploy and re-apply bindings, or bind baseline roles to a project-scopedprincipalSet. - Don't disable token binding. The opt-out (
GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES: False) is "strongly discouraged". Binding is the control that would have stopped the off-runtime replay in this research.
2. Or: Bring Your Own Service Account, scoped to one bucket
If agent identity doesn't fit your setup, use a dedicated service account per agent, or per class of agent. Grant at the resource, not the project.
# One agent, one service account, one bucket, read-only.
resource "google_service_account" "support_agent" {
account_id = "agent-support-bot"
display_name = "Support bot agent runtime"
}
resource "google_storage_bucket_iam_member" "support_agent_kb_read" {
bucket = google_storage_bucket.support_kb.name
role = "roles/storage.objectViewer" # objects in THIS bucket only
member = "serviceAccount:${google_service_account.support_agent.email}"
}
# Model access only. Prefer a custom role with the exact predict/query
# permissions over roles/aiplatform.user, which is broad.
resource "google_project_iam_member" "support_agent_predict" {
project = var.project_id
role = google_project_iam_custom_role.agent_model_invoker.id
member = "serviceAccount:${google_service_account.support_agent.email}"
}
# Deployers may act as this SA. Nobody else.
resource "google_service_account_iam_member" "ci_can_deploy_as_agent" {
service_account_id = google_service_account.support_agent.name
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${var.ci_deployer_sa}"
}
# Module-level SDK: pass the runtime identity explicitly.
from vertexai import agent_engines
remote_app = agent_engines.create(
agent_engine=my_agent,
requirements=["google-cloud-aiplatform[agent_engines,adk]==<pinned>"],
service_account="agent-support-bot@my-project.iam.gserviceaccount.com",
)
service_account is a documented parameter of vertexai.agent_engines.create() (SDK reference). If omitted, the default reasoning engine service agent is used, which is exactly the situation this research targeted.
3. Strip what you added to the shared service agent
Many tutorials grant extra roles directly to gcp-sa-aiplatform-re to get an agent working. Because that principal is shared by every default-identity agent in the project, each such grant widens all of them.
# Remove a role someone added to the shared service agent "to make it work"
gcloud projects remove-iam-policy-binding PROJECT_ID \
--member="serviceAccount:service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"
Do not remove the Google-provided roles/aiplatform.reasoningEngineServiceAgent binding blindly. The platform relies on it. Move agents off the default identity first, then trim what you added.
4. Put AI projects behind VPC Service Controls
A perimeter does not stop an over-privileged token from reading data inside the perimeter. It does stop that data, or the token, from being used across the perimeter boundary, such as copying objects to an attacker's project or calling APIs from outside. Agent Runtime supports VPC-SC (docs). Google notes you may need an ingress rule for the Agent Runtime service agent.
gcloud access-context-manager perimeters create ai_agents_perimeter \
--policy=ACCESS_POLICY_ID \
--title="AI agents" \
--resources=projects/AGENT_PROJECT_NUMBER,projects/DATA_PROJECT_NUMBER \
--restricted-services=aiplatform.googleapis.com,storage.googleapis.com,artifactregistry.googleapis.com,bigquery.googleapis.com,secretmanager.googleapis.com
Run it in dry-run mode first (gcloud access-context-manager perimeters dry-run create ...) and read the violation logs before you enforce. A perimeter that breaks your agents on day one gets deleted on day two.
5. Keep agents and sensitive data in different projects
The default identity reached "all buckets in the project". The project is the blast-radius unit. Don't host agents in the same project as your data lake, backups or Terraform state. A dedicated ai-agents-prod project with only the buckets those agents need turns "read all buckets" into "read the three buckets that were already meant for the agent".
6. Control agent egress
Agent Engine supports a Private Service Connect interface to route agent traffic into your VPC "and manage internet access" (docs). Once traffic flows through your VPC, apply a default-deny egress policy with an allowlist of the APIs and hosts the agent really needs.
# Default-deny egress for the subnet agents attach to, then allow only what is needed.
gcloud compute firewall-rules create agents-deny-all-egress \
--network=agents-vpc --direction=EGRESS --action=DENY \
--rules=all --destination-ranges=0.0.0.0/0 --priority=65000
gcloud compute firewall-rules create agents-allow-google-apis \
--network=agents-vpc --direction=EGRESS --action=ALLOW \
--rules=tcp:443 --destination-ranges=199.36.153.4/30 --priority=1000
# 199.36.153.4/30 is restricted.googleapis.com (VPC-SC-compatible Google APIs VIP)
Egress control limits where exfiltrated data can go. It doesn't stop the token being sent to Google APIs, which is why identity scoping (1–3) and token binding come first.
7. Treat agent packages and tools as supply chain
- Pin and hash dependencies in the agent's
requirementsand build in CI from a lockfile. A poisoned dependency is the most likely way untrusted code ends up inside your agent. - Never deploy a shared or pre-built agent you haven't reviewed. Unit 42 calls this out directly.
- Don't load pickles you didn't produce. Scan agent artifacts in the pipeline, and keep write access to staging buckets as tight as deploy permissions.
- Restrict who can deploy or update agents. The CSA recommends treating
aiplatform.reasoningEngines.update,aiplatform.customJobs.createandaiplatform.persistentResources.listwith the same scrutiny as IAM admin roles. Updating an agent is code execution as its identity.
# IAM deny policy: no principal except the deploy pipeline may create/update/delete agents.
resource "google_iam_deny_policy" "agent_mutation_guard" {
provider = google-beta
parent = urlencode("cloudresourcemanager.googleapis.com/projects/${var.project_id}")
name = "deny-agent-mutation"
display_name = "Only CI may change deployed agents"
rules {
deny_rule {
denied_principals = ["principalSet://goog/public:all"]
exception_principals = ["principal://iam.googleapis.com/projects/-/serviceAccounts/${var.ci_deployer_sa}"]
denied_permissions = [
"aiplatform.googleapis.com/reasoningEngines.create",
"aiplatform.googleapis.com/reasoningEngines.update",
"aiplatform.googleapis.com/reasoningEngines.delete",
]
}
}
}
Check permission names before applying
IAM deny policies use the service.googleapis.com/resource.verb form and support only some permissions. Confirm each is supported for deny in Google's "Permissions supported in deny policies" list before relying on this policy.
8. Narrow OAuth scopes where you can
Unit 42 called the default Agent Engine scopes "wide, non-editable" and "a structural security weakness", because they named Gmail, Calendar and Drive. IAM was the boundary that held. You can't edit those default scopes, which is one more reason to move off the default identity. Where you do control scopes, for example on Compute or GKE nodes running agent frameworks, prefer cloud-platform plus tight IAM, or narrow scopes like devstorage.read_only as the CSA suggests. Never grant Workspace domain-wide delegation to an agent identity unless that is the agent's entire job.
Lessons for System Design
1. An agent's identity is its blast radius
With a normal service, you reason about what the code does. With an agent, the code path depends on what the model decides, given inputs you don't control. So reason about what the identity can do, not what the agent is meant to do. Design the identity for the worst plausible behaviour of the agent, not the happy path.
2. Shared ambient credentials don't survive multi-agent systems
A per-project service agent works for one agent. At ten agents it's a pool of shared privilege where every grant leaks sideways. The move from project-level service agents to per-agent principals mirrors earlier moves: shared DB users → per-service users, node IAM roles → Workload Identity per pod. Expect the same move for every agent platform.
3. Bearer tokens from metadata servers need a second factor: where they're used
Metadata-server credentials beat static keys, but they're still bearer tokens. Any code in the workload can read them, and by default they can be used anywhere. Binding tokens to the runtime (mTLS, Context-Aware Access, VPC-SC) turns "stolen token" from a breach into a logged, failed request. This is the same idea as continuous verification in zero trust.
4. "Working as intended" is not "safe by default"
Google called XM Cyber's January findings "working as intended", per the CSA note. That may be technically true: the metadata server is meant to hand tokens to workloads. But when the intended behaviour composed with broad defaults lets a read-only user or a poisoned dependency read a whole project, the default is the bug. Platform teams should judge defaults by what the worst workload on them can do.
5. Managed means shared responsibility, not someone else's responsibility
The tenant and producer projects belonged to Google, and Google holds the controls there. The consumer-project reach, meaning your buckets, was governed by an identity you could replace and roles you could audit. Cloud incidents keep showing the same split. The provider secures the platform. You secure what your identities can touch. See Cloud Misconfigurations.
6. Logs you didn't turn on can't clear you
Data Access audit logs for Cloud Storage are off by default. In this scenario they are the only record of the exfiltration. Decide ahead of time which data-plane logs you need for an AI workload, the same way you decide backups. See Audit Logging and A09: Logging and Monitoring Failures.
7. Research disclosures are free incident drills
No one was breached here, which makes it the cheapest possible time to run the exercise: "if this agent were malicious tomorrow, what would it read, and would we see it?" Teams that ran that drill in April 2026 came away with an identity inventory, a perimeter and alert queries, and paid nothing for them.
What Would You Do?
Scenario 1: You run five ADK agents on Agent Engine in your main analytics project, all on the default identity. Your data lake buckets are in the same project. After reading the Unit 42 post, what do you change first: (A) enable Data Access logs, (B) move agents to agent identity or BYOSA, or (C) put the project in a VPC-SC perimeter?
(B) first, then (A) the same day, then (C). (B) shrinks what any compromised agent can reach, which removes the risk rather than recording it. (A) is quick and gives you visibility, both for hunting what already happened and for detecting what happens next. Do it right after, or alongside, (B). (C) is valuable but needs a dry-run period to avoid breaking production, and it doesn't stop reads inside the perimeter. Longer term, move the agents into their own project away from the data lake.
Scenario 2: A team wants to give its agent a generic "fetch any URL" tool so it can read documentation sites. What guardrails do you require?
At minimum: a URL guard that refuses link-local, loopback and private destinations, including metadata.google.internal and 169.254.169.254; timeouts and response-size caps; logging of every fetched host; and an identity with no project-wide data access. Better: an allowlist of domains, plus egress routed through your VPC with default-deny firewall rules. Assume prompt injection will steer the tool at some point, and make sure the worst outcome is a blocked request in a log.
Scenario 3: Your Data Access logs show the agent identity called storage.buckets.list twice last month from an IP you don't recognise. The agent's code never lists buckets. What now?
Treat it as an incident. Listing buckets is reconnaissance, and an unfamiliar caller IP suggests the token was used off-runtime. Pull every audit entry for that principal across Storage, BigQuery, Artifact Registry and Secret Manager for the period. Move the agent to a new, narrowly scoped identity immediately. Review the agent's dependencies and recent updates (who ran reasoningEngines.update?). Assess whether any objects read contained secrets or personal data, which may trigger notification duties.
Key Lessons
Key Lessons
- An agent runs untrusted instructions, so its identity must assume compromise. Default to a per-agent identity with resource-level grants.
- Per-project service agents are shared privilege. Every role added for one agent applies to all default-identity agents in that project.
- Metadata-server tokens are bearer tokens. Any code in the workload can read them. Bind them to the runtime (agent identity, VPC-SC) so a stolen token is useless.
- The project is the blast-radius unit. Keep agents away from projects that hold data they don't need.
- Turn on Data Access logs for the data your agents can reach. They are off by default and were the only trace this attack path would leave.
- This was the third public Vertex AI service-agent token finding in about 18 months. Watch the pattern, not just the patch.
Quiz
Quiz
Q1: What identity did an Agent Engine agent run as by default, and why did that matter?
The AI Platform Reasoning Engine Service Agent, service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com, a per-project service agent. It is shared by every default-identity agent in the project, and Unit 42 found it had project-wide Cloud Storage read permissions by default.
Q2: Why couldn't Google simply "block the metadata server" for agents? The metadata server is how workloads get credentials without static keys. Client libraries in the agent depend on it. The fix is to limit what the token can do (least-privilege identity) and where it can be used (runtime-bound tokens, VPC-SC), not to remove credential delivery.
Q3: Which Unit 42 claims were demonstrated, and which were not?
Demonstrated: reading all consumer-project buckets, pulling restricted producer-side images, listing tenant-project buckets. Not demonstrated: Workspace data access (blocked by missing IAM grants), altering Google's images (blocked by Google's controls), RCE through code.pkl (out of scope). No exploitation in the wild was claimed.
Q4: How does agent identity defeat the off-runtime use of a stolen token? Tokens are bound to a Google-managed x509 certificate through a Context-Aware Access policy enforcing mTLS. Presented from anywhere other than the agent's runtime, the request fails with "Context-Aware Access requirements are not met" (401).
Q5: Why are Data Access audit logs critical here, and what is their default state?
Bucket reads by the stolen identity are only recorded in Data Access logs (DATA_READ), which are off by default for Cloud Storage. Without them there is no record of what was read.
Related Pages
- LiteLLM Supply Chain Attack (March 2026): a compromised dependency harvesting cloud credentials, the most likely way untrusted code gets into an agent
- Axios Supply Chain Attack (March 2026): the same pattern on npm
- GCP IAM: service accounts, roles and policy inheritance
- GKE: Workload Identity, the per-workload identity model this research argues for
- Cloud Misconfigurations: over-privileged identities as a misconfiguration class
- OWASP A10: SSRF: the classic path to metadata-server tokens
- OWASP A08: Software and Data Integrity Failures: unsafe deserialization such as pickle
- OWASP A01: Broken Access Control
- AI Agents and AI Guardrails: how agents choose and call tools
- MCP Protocol: tool access for agents and its trust boundaries
- Zero Trust and Continuous Verification
- Audit Logging
- Cloud Pentesting
One-Liner Summary
An AI agent on Vertex AI ran by default as a shared, project-wide identity whose bearer token any code inside it could read, so one poisoned agent could read every bucket in the project. The fix is the oldest rule in cloud security, applied to agents: one identity per workload, least privilege, and tokens that only work where they were issued.
Sources
- Unit 42 (Palo Alto Networks), Ofir Shaty, "Double Agents: Exposing Security Blind Spots in GCP Vertex AI", 31 March 2026. Primary source for the attack path, demonstrated reach, Google's response and recommendations.
- The Hacker News, Ravie Lakshmanan, "Vertex AI Vulnerability Exposes Google Cloud Data and Private Artifacts", 31 March 2026.
- Cloud Security Alliance AI Safety Initiative, "Vertex AI Service Agents as Lateral Movement Vehicles", 1 April 2026. Context on ModeLeak and XM Cyber's January 2026 findings, detection signals and mitigations.
- Google Cloud documentation, "Manage agent access": default service agent name and role, custom service accounts, VPC-SC note.
- Google Cloud documentation, "Use IAM agent identity": per-agent principals, mTLS token binding, configuration keys, role guidance.
- Google Cloud documentation, "Set up the environment" (Agent Engine): feature support (VPC-SC, CMEK), Private Service Connect interface.
- Google Cloud Python reference,
vertexai.agent_engines:service_accountparameter ofcreate(). - Python documentation,
pickle— security warning: "It is possible to construct malicious pickle data which will execute arbitrary code during unpickling."