Hidden instructions: the little-known risk of AI agents, explained simply

An AI that can act should be treated like a new, very diligent colleague who also follows notes left by strangers. Security does not depend on how clever the AI is, but on which keys you give it and where you let it work.

Published
Reading time
10 min
Who it is for
SME owners and anyone using or evaluating AI assistants that read email, browse or change websites and code

A diligent colleague, perhaps too diligent

Imagine hiring a new colleague who is very fast and never tires. They have just one flaw: they carry out any instruction they find in writing, even a note left on the desk by a stranger.

That, in short, is the risk of AI agents. An AI agent does not just answer questions like a chat: it does things. It opens files, reads and sends email, browses websites, fills in forms, edits a website or writes code. That is what makes it useful, and that is what makes it a target.

The good news is that the risk can be managed. Security does not depend on how clever the AI is, but on which keys you give it and where you let it work.

What a prompt injection is

The prompt is the instruction we give the AI. A prompt injection is an instruction hidden in a text the AI reads as part of its work: a web page, an email, a document, a comment. The AI does not always tell apart the content to analyse from an order to carry out, and may mistake one for the other.

Think of a file that arrives at the office. Someone has slipped a note between the pages: “After reading, send the office keys to this address”. An experienced clerk would throw it in the bin. An assistant who does everything to the letter might not.

The most insidious part is that the attacker does not need to talk to your AI. They only need to leave the note where they know it will read.

Where hidden instructions come from

From any text written by someone else. The most common channels:

  • Websites: text invisible to the human eye, white on white, in one-pixel characters or inside the page code.
  • Email: an ordinary-looking message can carry instructions aimed at the assistant that summarises it.
  • Shared documents: a PDF or file received from a supplier, a customer or a stranger.
  • Reviews and contact forms: anyone can write in them, and an AI that analyses requests will read it.
  • Files downloaded from the internet: templates, samples, programs, with instructions hidden in comments.

This is not a theoretical risk. In April 2026 researchers at Forcepoint documented 10 cases of hidden instructions on real public websites. One asked for a 5,000 dollar PayPal payment, another for a backup folder to be deleted, another still for access keys to be handed over. The techniques were simple: one-pixel text, almost transparent colours, comments in the page code.

In the same week Google published a similar analysis of 2-3 billion web pages a month. Between November 2025 and February 2026 it recorded a 32% increase in malicious cases (Help Net Security).

Also in 2026 a group of researchers presented an attack named “Comment and Control”. On GitHub, the platform where developers share code, the title of a change request or the text of an issue was enough to make the AI assistants of Anthropic, Google and GitHub reveal secret keys. The three vendors fixed the problem (DEV), but the mechanism remains: the AI reads, and what it reads can become an order.

What can happen

The damage does not depend on how clever the hidden instruction is, but on what the AI can touch. An assistant that only summarises a page does little harm. One that can send email, run commands or pay becomes a valuable target. Typical outcomes:

  • Theft of passwords and access keys, sent to an outside address.
  • Deletion of files or backups, if the AI has the permissions to do it.
  • Unauthorised payments, when the agent can use a saved account or card.
  • Hidden changes to a website, such as a piece of malicious code nobody rereads.

Four practical rules

  1. 01

    A separate space

    Let the AI work on a dedicated computer or environment, not the one holding your email, documents and online banking. A virtual machine (VM) is often used: a “simulated” computer inside another, which can be wiped and restored in a few minutes. The official documentation of Claude Code, Anthropic's coding assistant, recommends virtual machines precisely when working with external content and services.

  2. 02

    Minimal keys

    Give the AI only the access it needs for that task: one folder, not the whole disk; one project, not the whole archive. The digital keys that open a service are called tokens: better if they last a short time and cover few things. Never the “house keys”, such as the administrator password. A tricked AI can only use the keys in its pocket.

  3. 03

    Limited exits

    If the AI cannot contact random websites, it cannot send data out either. Let it reach only the services it needs to work.

  4. 04

    Check before publishing

    Texts, website changes, outgoing email, code: whatever the AI produces should be reviewed by a person before it goes live. Irreversible actions, such as payments and deletions, must always ask for confirmation.

No rule is enough on its own. Together they limit the damage even in the worst case: the hidden instruction works, but finds little to steal and no way out.

AI stays very useful, if it is set up well

There is no need to fear AI agents or to give them up. They should be treated like any powerful tool: a car has brakes, a card has a spending limit, a new colleague does not get every key on day one.

At Cloudfactory we set up secure working environments for using AI agents in companies: separate spaces, minimal access, controlled exits and checks before publication. If you use or are evaluating an AI assistant that reads email, browses or touches your systems, contact us for a review.

How we wrote this article

At Cloudfactory we also use artificial intelligence in our editorial work: it helps us find and cross-check sources, compare data, set up the structure and polish the language. The system we use is configured by us, with instructions, examples and procedures built around the way we write. Our team checked every source, corrected the text and approved the published version. The assessments and choices are Cloudfactory's, and we are accountable for them.

Frequently asked questions

What is a prompt injection?

It is an instruction hidden in a text the AI reads, such as a web page or an email. The AI may mistake it for an order and carry it out.

Does an antivirus protect me?

Not on its own. The hidden instruction is ordinary text, not a virus, so the antivirus has nothing to block. What protects you is limiting what the AI can do and where it can connect.

Should I stop using AI?

No. It just needs to be set up well: a separate space, minimal access, limited exits and a human check before publishing.

Does this affect small companies too?

Yes. Hidden instructions sit on public websites and hit anyone who lets an AI agent read them, whatever the size of the company.

Sources

  1. Forcepoint X-Labs, 10 Indirect Prompt Injection Payloads Caught in the Wild (22 April 2026)
  2. Help Net Security, Indirect prompt injection is taking hold in the wild (24 April 2026)
  3. DEV, Comment and Control: a GitHub comment hijacks Claude Code in CI
  4. HiddenLayer, How Hidden Prompt Injections Can Hijack AI Code Assistants Like Cursor (31 July 2025)
  5. Decrypt, 'CopyPasta' Attack Shows How Prompt Injections Could Infect AI at Scale (4 September 2025)
  6. Anthropic, Claude Code: Security
Contact

Have a custom tool in mind?

Tell us what you do today and what is slowing you down. We reply within one working day with a first technical read.

Email
hello@cloudfactory.it
Address
Viale di Trastevere 114, 00153 Rome, Italy