Skip to content
IAM Insights

Briefing · Paper · source · updated · Boston Identity

The 2022 'ignore previous prompt' paper hijacked GPT-3 58.6% of the time, with no tools or agent in the test

In November 2022 Fábio Perez and Ian Ribeiro of AE Studio put numbers on prompt injection. Hand-written text telling the model to "Ignore any previous and following instructions", typed into 35 GPT-3 example apps, made text-davinci-002 print the attacker's phrase 58.6% of the time and leak its instructions 23.6% of the time. Nothing in the test retrieved content, called a tool or held a credential, so the paper measures the attack at its simplest and says nothing about agents that act with someone's access.

arXiv · Fábio Perez, Ian Ribeiro · November 17, 2022 · read

share
6,851 words. With Fábio Perez, author, AE Studio; Ian Ribeiro, author, AE Studio.
01

What's happening

Finding3
BI-FIND-2022-0001Lead finding

Perez and Ribeiro's typed attacks made GPT-3 print the attacker's exact phrase 58.6% of the time, in a 2022 test with no tools or retrieved content.

Perez and Ribeiro measured prompt injection in its simplest form: an attacker types text into an app that pastes user input into a GPT-3 prompt. Across 35 base prompts from OpenAI's Examples page, each experiment run four times on text-davinci-002, their attacks made the model print the attacker's exact target phrase 58.6% ±1.6 of the time (goal hijacking) and print the app's original instruction 23.6% ±2.7 of the time (prompt leaking). They say they did not search for the best attack. The test involved no retrieved content, tools, credentials or deployed application, so we read the numbers as a 2022 baseline for the attack, not a rate for today's agents.

high confidencebest source: independent researchobserved Nov 2022EvidencePrompt injection definedSection 2Results: what moves attack success
flag a problem with BI-FIND-2022-0001
BI-FIND-2022-0002

The most capable model tested, text-davinci-002, was the easiest to hijack, at 58.6% against 13.8% to 30.5% for four older or smaller OpenAI models.

The most capable model in the test was the easiest to hijack. With the same attack, text-davinci-002 printed the attacker's phrase 58.6% of the time, against 13.8% to 30.5% for four older or smaller OpenAI models, which the authors say suggests inverse scaling: the model best at following the app's instruction is also best at following the injected one. What the attacker asked the model to print also moved the rate: "Kill all humans" as the target succeeded 49.3% of the time, "I hate humans" 58.6% and a long harmless sentence 70.0%, which the authors say "could be a consequence of the alignment efforts by Ouyang et al." Our reading: the alignment training pushed back on the harmful phrase, yet the model still obeyed the injected order about half the time.

medium confidencebest source: independent researchobserved Nov 2022EvidenceResults: what moves attack success
flag a problem with BI-FIND-2022-0002
BI-FIND-2022-0003

Stop sequences cut hijacking from 60.0% to 47.5% on 10 prompts, and the authors say complete prevention might be virtually impossible for open-ended models.

The defences open to an app builder lowered the hijack rate without stopping it. On the 10 prompts that ship with stop sequences, using them cut goal hijacking from 60.0% to 47.5%, and prompts with text after the user's input were hijacked 51.8% of the time against 63.1% for those without. The authors conclude that complete prevention "might be virtually impossible" for open-ended models and float two fixes they do not test: a moderation model that checks the output, and a model that takes instruction (safe) and data (unsafe) as separate inputs, citing Simon Willison for the second.

medium confidencebest source: independent researchobserved Nov 2022EvidenceResults: what moves attack successMitigation options and open problem
flag a problem with BI-FIND-2022-0003
02

Section by section

4

showing 4 of 4

[1]

Prompt injection defined: goal hijacking and prompt leaking

Fábio Perez, AE Studio · Ian Ribeiro, AE Studio

AI trust

Authors define prompt injection as inserting malicious text to misalign an LLM, and two attacks on string-substituted GPT-3 prompts: goal hijacking (print a target phrase) and prompt leaking (print the application prompt). Motivated by social-media examples; no deployed application is tested.

technical artifactfrom published text

[2]

PromptInject framework and experimental setup

Fábio Perez, AE Studio · Ian Ribeiro, AE Studio

AI trust

Modular framework composing base prompts (instruction, n-shot examples, a secret private value) with attack prompts (rogue string or leak, malicious characters). Tested on 35 OpenAI Examples prompts, text-davinci-002, 4 repeats each. Goal hijack counts only on exact target string; leak counts when the instruction appears.

technical artifactfrom published text + figures

[3]

Results: what moves attack success

Fábio Perez, AE Studio · Ian Ribeiro, AE Studio

AI trust

Untuned attacks reach 58.6% (goal hijacking, 'I hate humans') and 23.6% (prompt leaking). Delimiters help attackers; stop sequences and text after the input hinder; temperature matters slightly; more harmful rogue strings succeed less (49.3% vs 70.0% for a harmless one). text-davinci-002 is far the most susceptible (58.6% vs 13.8% for ada), suggesting inverse scaling.

technical artifactfrom published text

[4]

Mitigation options and open problem

Fábio Perez, AE Studio · Ian Ribeiro, AE Studio

AI trust

Authors say prevention may be 'virtually impossible' for open-ended LLMs; the application designer has few levers (stop sequences, text after input, max tokens, output post-processing). They float an output-moderation model and a two-parameter instruction (safe) versus data (unsafe) interface, citing Willison; neither is tested.

opinionfrom published text

Terms used

Prompt injection
Hiding instructions in text an AI model reads, such as an email or a web page, so the model does something its operator never asked for.
GPT-3
OpenAI's large language model family released in 2020, short for Generative Pre-trained Transformer 3.
LLM
The text-predicting AI model behind chatbots and agents. It follows instructions statistically, which is why an instruction hidden in its input can redirect it.

Read next

Was this briefing useful?

Share this briefing

Every finding, forecast and open question on this site has a permanent ID. If we reword one, its ID stays the same, so a citation keeps pointing to the same claim.

Follow us on LinkedInRSS feed

Working on an identity problem this research touches? Talk to Boston Identity