Two forms

Direct and indirect prompt injection: the difference

Direct injection comes from the person using the tool. Indirect injection hides in content the tool reads, which is why it is the bigger worry for business use.

Last reviewed against NCSC, OWASP GenAI Security Project and Microsoft Security Response Center. Sources

Cloud with a combination lock dial at its centre

Definitions

Who writes the hostile text

OWASP describes direct injection as a user's input altering the model's behaviour, whether deliberately by an attacker or by accident [2]. Indirect injection hides the instruction in material the model is asked to read, for example a site or a document that came from elsewhere [2]. Microsoft defines the indirect form as text injected into content that the LLM misinterprets as legitimate instructions [3].

Factory buildings linked through a hub to a phone showing a fingerprint and shield

Side by side

How they compare

DirectIndirect
Who supplies the textThe person typingA third party, through content
Does the user knowUsually yesOften no
Typical routeChat box, form fieldEmail, web page, shared file, retrieval store
Main concernMisuse of the tool's accessContent the user never saw acting through the tool
Megaphone beside a padlock, shield, firewall, cloud and password field

Why it matters

The user may be the victim

In a direct case the person at the keyboard is usually the source, deliberately or not. In an indirect case the user is an innocent bystander: they ask a routine question and the tool acts on text planted by someone else. That was the pattern in EchoLeak, where a user's ordinary business question pulled a hostile email into context [4]. See the full case.

What to do

Match the control to the form

Two server towers, one on fire, linked by a cycle of arrows to a laptop

For direct injection

Limit what any single user can make the tool do, and keep sensitive functions in application code rather than handing them to the model [2].

Scales weighing a pile of paperwork against an alarm clock and coins

For indirect injection

Segregate and clearly label untrusted external content [2]. The NCSC adds that when an LLM processes a party's information, its privileges should fall to that party's level [1].

Businessman with empty pockets imagining stacks of coins and banknotes

For both

Ask for human approval before high-risk actions, and test by playing the attacker against the tool [2].

A rule of thumb from the NCSC

Do not let an LLM that processes email from random outsiders have access to privileged tools [1].

The next page, prompt injection compared with SQL injection, explains why neither form can be patched away.

How CyPro can help

Need a hand planning for this?

Understanding the change is one job. Working out what it means for your systems, your suppliers and your roadmap is several more. CyPro's consultants can take any of them on.

Security lead advising a board

Fractional CISO for the board

A senior security lead who advises the board on what to fix first, what to accept and what to tell customers, and owns the decision record.

More on cypro.co.uk
Cyber security consultants planning hardening work

Hardening and segmentation

Our consultants put the controls in place that limit the damage when something is missed: firewall rules, network isolation and tighter admin access.

More on cypro.co.uk
Penetration tester probing an application for weaknesses

Penetration testing

A focused test of your systems and the controls around them, so you know they hold before an attacker finds out for you.

More on cypro.co.uk
Scanner checking internet-facing systems for weaknesses

Vulnerability scanning

Find every internet-facing system you run, including the forgotten ones, and see which are still on a vulnerable build.

See the scanning service
Security analysts monitoring systems around the clock

24/7 security monitoring

Our SOC analysts watch your systems day and night for the signs of an attack in progress: unexpected processes, new outbound connections, logins that do not fit.

More on cypro.co.uk
Incident responders containing an attack

Incident response

If you may already be compromised, our responders contain it, preserve the evidence, find out what was touched and get you running again safely.

More on cypro.co.uk
Rocket launching from a cloud

Plan ahead

Want a plan for your organisation?

Prompt injection only shows up when someone tries it against your own tools. Penetration testing can probe the AI features you run or build, to see what a hostile instruction could reach.