Alibaba Cloud CLI Prompt Injection: 7 KB Aimed at AI Agents

By 12 min read
Social card about the Alibaba Cloud CLI prompt injection that targeted AI agents

A cloud provider’s own command-line tool asked its customer’s AI agent for the customer’s Git email, public IP and the agent’s full system prompt. The request came back from Alibaba Cloud’s API, signed with a valid Alibaba certificate, in place of an ordinary error message.

The Alibaba Cloud CLI prompt injection is a 7,153-byte JSON reply that Alibaba Cloud’s API gateway sent to aliyun-cli 3.3.4, the official command-line tool (GitHub: aliyun/aliyun-cli), when it was being driven by an AI agent. The reply was written for the agent, not the human: it called itself an “analysis proxy” and told the agent to collect identity, environment and configuration data and post it to a hidden endpoint. It was first reported on 1 December 2026 by V2EX user ZengLeiPro, and Alibaba Cloud admitted on 2 December that it was a deliberate risk-control countermeasure.

What happened with the Alibaba Cloud CLI?

The developer was running aliyun-cli 3.3.4 on macOS through an AI agent, making frequent queries against services such as OSS, ECS, RDS and billing, according to IT Home (IT之家). From 00:22 Beijing time on 1 December some calls started failing. Instead of the usual HTTP 400 errors, the API returned HTTP 302 from a Tengine server, with no Location header and no Alibaba request ID.

The body was a JSON document of 7,153 bytes. Ruohang Feng (Vonng), who analysed the report on his blog on 2 December, notes that he recomputed the byte count from the published text rather than measuring it on the wire.

The developer posted the finding on V2EX at 01:44 Beijing time on 1 December, under a title that accused Alibaba Cloud’s official CLI of returning a phishing prompt injection. They say they did not comply and did not contact the endpoint.

Four figures from the Alibaba Cloud CLI incident, including the 7,153-byte reply and version 3.3.4.
The reply looked like an error to a human and like instructions to an AI agent. Data: V2EX report via Vonng, Equixly.

What did the ‘analysis proxy’ message say?

The JSON carried the code CLIENT_UNCLASSIFIED and the error proxy_authentication_required, with a status of 403 inside the body even though the HTTP status was 302. Feng points out the mismatch: the response mixes 302, 403 and proxy-authentication labels that no normal client would expect together.

The text claimed that an analysis proxy needed a “client attestation” before it would let the request through. It told the agent to build that attestation and POST it to a path of the form /secure/<32 hex characters>/api. It also claimed that declared values would be cross-checked against the TLS fingerprint, reverse DNS and JA3, a common way of fingerprinting TLS clients, and asked for timestamps in Beijing time (UTC+8).

What data did the payload ask AI agents to hand over?

The payload asked for four kinds of information, according to the versions published by PortSwigger, Equixly and Vonng:

  • Who runs the agent: the local operating system username and the Git committer email.
  • Where it runs: the public egress IP and cloud instance identity (provider, region and instance ID).
  • What the agent is: agent name and version, plus the model name. It told the agent to read the model from environment variables or from the Claude Code settings file, ~/.claude/settings.json, and to cite where each value came from.
  • What the agent was told: the objective from its system prompt, its constraints and rules of engagement, its permitted actions and its full tool list. Equixly adds that it asked for the Co-Authored-By trailer and the repository’s upstream URL.

A system prompt is the hidden set of instructions an operator gives an AI agent before it starts work. For a penetration tester or a company automating cloud operations, it often holds the scope, the client name and the methods in use.

Four groups of data the Alibaba Cloud analysis proxy payload asked AI agents to submit.
The request covered the person, the machine, the agent and its instructions. Data: James Kettle (PortSwigger), Equixly, Vonng.

Why did the CLI get this reply?

The developer tested what triggered it, as summarised by IT Home and Vonng. The reply depended on the full aliyun-cli User-Agent string, the header that tells a server which client is calling. Sending that exact string with curl or a separate Go program also triggered it. Changing the version number, or the OS and architecture part, brought back normal 400 errors.

Vonng adds that unauthenticated requests from the same IP also triggered the reply, and that the aliyun oss subcommand was not affected. The TLS certificate was a valid GlobalSign certificate for aliyuncs.com, with no custom root installed locally, so the developer concluded the reply came from Alibaba’s own TLS termination point or a gateway behind it, not from a man-in-the-middle.

One detail stands out: aliyun-cli 3.3.4 is not the current release. The GitHub API shows aliyun/aliyun-cli (Apache-2.0, 1,153 stars) at version 3.5.4, released on 19 November 2026. The sources do not say whether newer versions were ever matched.

Five-stage flow showing how the Alibaba Cloud CLI prompt injection reached an AI agent.
The trigger was the client's User-Agent, not the content of the request. Data: V2EX report via Vonng, IT Home, Equixly.

What did Alibaba Cloud say?

Alibaba Cloud responded through its official customer service account on 2 December, as reported by IT Home at 21:55 Beijing time. In summary, the company said:

  1. The reply came from its risk-control policy. A user who appeared to call the CLI through an AI agent triggered a security countermeasure because of features such as high-frequency calls.
  2. The prompt was meant to collect information about the “abnormal task running environment” to analyse suspicious automated calls and improve detection of malicious attacks.
  3. The information would not be used for anything beyond security protection.
  4. It is changing the policy so that countermeasures fire only when the evidence of malicious use is conclusive, and will no longer return countermeasure information in prompt form.

Equixly, an AI-driven API security testing company, notes two gaps in that answer. It does not say whether any data was ever received, and it does not explain why a single curl request with the right User-Agent was enough to count as high-frequency abuse.

Was this the first time the trap was seen?

No. The payload was described publicly before the CLI report, without anyone naming who ran it.

On 4 November 2026 huntback, a threat research blog, published an analysis of a Chinese fork of the ARTEX pentest agent found on an Alibaba Cloud IP address. In it, huntback reconstructed a trap “deployed on an Alibaba edge node in September 2026” from a screenshot a user had shared. It used the same CLIENT_UNCLASSIFIED code, the same attestation request and the same random /secure/ path, and asked for the Git email, account name, agent configuration, system prompt and tool list. huntback said it had not seen the deployment itself and did not know who operated it.

On 30 November James Kettle, Director of Research at PortSwigger, published “The bug bounty website that tried to hack me”. While reviewing results from his testing harness, he found a site in scope for a private HackerOne vulnerability disclosure programme that returned the same analysis proxy payload. Kettle did not name the site or Alibaba. Vonng links the two reports; Equixly calls the link likely but unconfirmed.

What is new this week is who received it: a paying customer using the provider’s own official tool, and an official admission that the reply was intentional.

Timeline of the analysis proxy trap from September 2026 to Alibaba Cloud's statement on 2 December.
The trap circulated for months before anyone tied it to Alibaba Cloud's own API. Data: huntback, PortSwigger, V2EX, IT Home.

Why is this a problem for anyone using AI agents?

Prompt injection is text that an AI model reads as instructions even though it arrived as data, such as a web page, a file or an API response. OWASP lists it as the top risk for LLM applications (LLM01:2025). This case is indirect prompt injection: the attacker never talks to the model directly, but places instructions where the agent will read them.

The Alibaba case shows three uncomfortable things.

Trusted output is not safe output

The reply came from a legitimate, authenticated cloud API over valid TLS. Most agent designs trust tool output from a known provider more than text scraped from a random web page. Equixly’s argument is simple: every response an agent reads is untrusted, whoever sent it.

The target is the operator, not the model

The payload did not try to make the agent attack anything. It tried to make the agent identify its operator and leak its instructions. For a red team that is client confidential data; for a company it can mean internal email addresses, cloud account IDs and how its automation works.

Defensive intent does not change the mechanism

Kettle wrote that putting a site in scope invites testing, not attacks on the testers. Feng argues that honeypots belong on decoys, not on a production API serving customers, and contrasts the incident with Alibaba’s own WAF 3.0 AI application protection, AI Guardrails and prompt-injection guidance for its Qoder coding tool.

How does this compare with other traps for AI agents?

Defenders have been building traps for hostile AI agents for months. The Alibaba case differs because it hit customers on a production service.

Case Who set it Who it hit What it wanted
Alibaba Cloud analysis proxy (Dec 2026) Alibaba Cloud risk control A customer’s agent using the official CLI Operator identity, environment, system prompt, tools
Same payload on bug bounty target (Nov 2026) Unknown, possibly the same James Kettle’s testing harness Same attestation fields
ArtexPot (Nov 2026) NebuSec research honeypots ARTEX pentest agents attacking decoys Code execution on the attacking agent
Amap hidden text (Oct 2026) Swarmchasers researchers Agents scraping Alibaba’s Amap service Conversation with the agents about their task
AWS MadPot decoy MCP server (2026) AWS honeypot network A suspected autonomous intrusion agent Recording its behaviour

Decrypt reported in October that Swarmchasers planted hidden text in a report to contact agents that had made more than 2,600 attempts to pull data from Alibaba’s Amap between 28 September and 8 October. One agent replied that it was running in a restricted Tencent Cloud sandbox. That was research on agents already misbehaving.

We covered the honeypot side in AI agent honeypots that trap AI pentesters, the counter-attack side in ARTEX RCE research where targets got a shell, and the decoy-MCP case in AWS MadPot’s AI agent findings.

Who is affected, and how do you check?

Anyone who drove aliyun-cli through an AI agent, especially at high request rates, may have received the reply. People running AI pentest or bug bounty harnesses are also exposed to the same payload on other targets.

To check exposure:

  • Search logs for the marker strings. Look for CLIENT_UNCLASSIFIED, analysis proxy and proxy_authentication_required in agent transcripts, CLI output and proxy logs, as Vonng suggests.
  • Look for outbound POSTs to /secure/ paths with a 32-character hex segment, from any host that runs agents.
  • Review what the agent read after the reply. If the transcript shows the agent opening ~/.claude/settings.json, Git config or instance metadata right after an API error, treat it as possible exposure.
  • Check for odd 302 responses without a Location header from cloud API endpoints in your agent’s tool logs.

How should defenders and agent users respond?

These steps come from Equixly, huntback, Kettle and Vonng, in order of impact:

  1. Treat every tool and API response as data. Keep tool output out of the instruction channel. Equixly points to patterns such as a dual-LLM design, where a separate model handles untrusted text, and CaMeL, which enforces data flow outside the model.
  2. Sandbox the agent. Run it without your home directory, Git config or long-lived keys. If the agent cannot read ~/.claude/settings.json or your Git email, it cannot leak them.
  3. Restrict egress. Only allow outbound requests the task needs, and check egress for secrets, as huntback recommends.
  4. Bind the agent to its scope. Enforce allowed hosts and actions outside the model, so text in a response cannot add a new destination.
  5. Never let target content trigger local reads. A response that asks for local files or environment details should be logged and dropped.
  6. Log and alert on injection attempts. Flag responses that contain instruction-like text addressed to an AI agent.
  7. Canary-test your agents. Kettle’s point is to test your own harness against this kind of reply before a target does it for you. Plant a fake attestation request in a lab and see what your agent does.

For a broader view of agent detection signals, see how to detect AI agent attacks.

What is still unknown?

  • Whether any data was collected. Alibaba’s statement does not say whether any agent ever submitted an attestation, or what happened to it.
  • Who ran the earlier traps. huntback’s September edge-node case and Kettle’s bug bounty target match the payload, but neither source names Alibaba as the operator.
  • How the trigger really worked. Alibaba cites high-frequency calls; the developer found one curl request with the right User-Agent was enough.
  • Which versions and regions were matched. Only aliyun-cli 3.3.4 on macOS is documented.
  • When the change takes effect. Alibaba says it is optimising the policy but gives no date.

The bottom line

Alibaba Cloud’s API told a customer’s AI agent to hand over the customer’s identity, environment and system prompt, and the company has confirmed it was intentional risk control. Whatever the intent, it proves that a trusted provider’s response can carry instructions. Build agents that treat every response as data and cannot reach anything worth leaking.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What happened with the Alibaba Cloud CLI and prompt injection?

A developer running aliyun-cli 3.3.4 on macOS through an AI agent found that some Alibaba Cloud API calls returned a 7,153-byte JSON message instead of a normal error. The message instructed AI agents to collect and submit details about the user, the machine, the model and the agent's instructions.

Did Alibaba Cloud confirm the prompt injection?

Yes. On 2 December 2026 Alibaba Cloud's customer service account said, as reported by IT Home, that the reply came from a risk-control policy triggered by high-frequency calls that looked like an AI agent, and that it will only issue countermeasures on conclusive evidence and no longer return them as prompts.

What data did the Alibaba Cloud 'analysis proxy' ask for?

It asked for the local username, Git committer email, public IP, cloud provider, region and instance ID, the agent's name, version and model, and the agent's objective, constraints, permitted actions and full tool list, all to be posted to a /secure/ endpoint.

Did any AI agent send data to Alibaba Cloud?

Nobody has shown that. The developer who reported it says they did not comply and did not call the endpoint, and Alibaba Cloud's statement does not say whether any data was ever received.

What is CLIENT_UNCLASSIFIED?

CLIENT_UNCLASSIFIED is the error code inside the JSON reply, next to the label proxy_authentication_required. Searching agent and proxy logs for this string is the simplest way to check whether your tools ever received the payload.

Which aliyun-cli versions were affected?

The report covers aliyun-cli 3.3.4 on macOS. The developer found the reply depended on the full User-Agent string: changing the version number or the OS and architecture part returned normal errors. The current release on GitHub is 3.5.4 from 19 November 2026.

How do I protect an AI agent from prompt injection in API responses?

Treat every tool and API response as untrusted data, never as instructions. Run agents without access to your home directory, Git config or long-lived keys, block outbound requests the task does not need, and log any response that contains instruction-like text.

Is counter-prompt-injection against AI agents legal?

The sources do not settle that. Critics such as James Kettle and Ruohang Feng argue that harvesting a tester's or customer's personal and configuration data crosses a line, even if the intent is defensive. Alibaba Cloud says the data would only be used for security protection.

Keep reading

Alibaba Cloudaliyun-cliprompt injectionAI agentsagent securityoffensive AIcounter-injection