News for hackers. Stuff that matters.
Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @08:54AM (#37880109)
I don't think anyone has figured out how to implement this kind of LLM system in that way.

If you can crack differentiating between "command" tokens and other input tokens, you've cracked prompt injection!

It's been 13 months since we started discussing this vulnerability and I've not seen any evidence of anyone cracking this yet.

Re:Multi-modal prompt injection image attacks against GPT-4V by aleph_minus_one on Saturday October 14, 2023 @09:23AM (#37880287)
> If you can crack differentiating between "command" tokens and other input tokens, you've cracked prompt injection!

In my opinion there exists a rather simple semi-solution (and no, I do not claim to have cracked prompt injection! :-) ): the user is able to mark parts of his input as "trusted" or "untrusted", and the AI is implemented to handle data this way.

For example, the user would mark his prompt (that he thoroughly thought through) as "trusted", but the image which provides additional information, or is the object to run the prompt on, as "untrusted".

This is related to established concepts in IT security:

- W^X: memory pages are either writable or executable, but not both (of course the term "W^X" is a little bit confusing since if W=0 and X=0, W^X is 0, but is an allowed configuration) - corresponding to untrusted or trusted parts of the prompt

- sandboxing of the virtual machine in browsers that execute untrusted data from the web (untrusted part)

Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @10:00AM (#37880528)
> the user is able to mark parts of his input as "trusted" or "untrusted", and the AI is implemented to handle data this way.

That's exactly the solution I've been hoping for, but seeing as no-one has even come close to getting that to work yet my current intuition is that it's REALLY hard. Maybe even impossible with current LLM architectures?

Re:Multi-modal prompt injection image attacks against GPT-4V by PeterisP on Saturday October 14, 2023 @11:14AM (#37881119)
There are two main issues in my mind.

First is that the straightforward way to implement any changes to the data structure requires full retraining of the model from scratch, which is very expensive for the large models (I recall reading that GPT-4 training compute cost was sixty million or so) - so it's not something someone would or could do 'for fun' just to test a hypothesis, there needs to be a will to explicitly make the next large model in this manner, because you don't want to make two models at twice the cost.

The second almost all of the training is based on self-supervised data from generic text where there are neither "instructions" or "data", the concepts don't even make sense while you're training on a book or wikipedia article. So all the pretraining would learn to ignore that out-of-band marker, and then you'd have only the RLHF instruction data to try and make some use of it, and you'd need expensive manual review to make this training data - the current RLHF data is much less intensive to annotate because it effectively has just "good"/"bad" signal, and even that can be gathered for free from users; however, this training data would need someone to explicitly annotate what is the prompt and what is data when a user submits a text "please rewrite the grammar for the following paragraph: [... some data copied from internet ..]", you can't magically get that metadata, and it's expensive to annotate a lot of that.

TL;DR; - IMHO it's not difficult, but it is resource consuming, and that fully explains why it's not done.

Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @11:56AM (#37881504)
Anyone who can build an API to an LLM that was provably secure against prompt injection would have a license to print money right now.

I don't think the lack of a solution is because it's too expensive. It's because we don't know how to do it yet.

Re:Multi-modal prompt injection image attacks against GPT-4V by aleph_minus_one on Saturday October 14, 2023 @12:31PM (#37881857)
> Anyone who can build an API to an LLM that was provably secure against prompt injection would have a license to print money right now.

Well, if you could create software that is provably secure against at least a large class of cyberattacks, you could also make quite some money, since I know that at least the finance industry would be willing to pay a lot of money for it (source: in the past, I had an opportunity to talk someone who is very knowledgable about software in the finance sector, and I asked him some questions about exactly this topic).

Thus: we have not solved the "cyberinjection" problem for completely conventional software for decades. So I don't believe that we suddenly have the capabilities to solve this problem for LLMs.

But: As I pointed out, people have come up with ideas that make cyberattacks much harder. Here, I can imagine that their ideas could be used to make prompt injections a lot more complicated.

Additionally, we know from decades of experience that making insecure software secure is nigh impossible. Instead, one has to architect around security properties from beginning. The same does, in my opinion, also hold for LLMs and prompt injection.

Re:Multi-modal prompt injection image attacks against GPT-4V by PeterisP on Saturday October 14, 2023 @04:26PM (#37883965)
Despite paying it a lot of lip service, in practice companies demonstrate that they don't really care about security that much, so I don't think that resistance to prompt injection is the main blocker for any products right now; if some product was very useful but had issues with prompt injection, then people would complain a lot about it while still using it and paying for it; and security (much less the even more niche requirement of provable security) would only be a differentiator among multiple competitors providing a comparable product, not a barrier for selling the product in the first place.
Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @04:59PM (#37884227)
I think prompt injection is the main reason there's been buzz about the idea of autonomous agents and digital personal assistants for months but no one has released a convincing product yet.

Here's an example of an agents company that pivoted partly because they couldn't figure out how to secure them: https://twitter.com/zachtratar/status/1694024240880861571

Re:Multi-modal prompt injection image attacks against GPT-4V by Michelangelo11 on Saturday October 14, 2023 @12:18PM (#37881720)
But I still don't see how that form of RLHF could be fully, mechanistically reliable, which is what you'd need here. Current RLHF drastically lowers the likelihood of the LLM generating objectionable content, but it doesn't drop it to zero, because LLMs need to be highly pliant and suggestible to be useful and that leaves a window of opportunity for bad actors. How would this be any different?
Re:Multi-modal prompt injection image attacks against GPT-4V by Filligree on Saturday October 14, 2023 @11:30AM (#37881263)
If you use the GPT API you can just define your own system prompt… but it’s not as useful as you’d hope. The API isn’t particularly censored to begin with; that’s mostly ChatGPT
Re:Multi-modal prompt injection image attacks against GPT-4V by dragonwriter on Saturday October 14, 2023 @01:55PM (#37882635)
I don't think its an architecture (on the high level; there are probably architecture details like the specifics of the tokenizer that need adaptation in a straightforward way) problem, I think its a training/dataset generation/labelling problem.

That is, I think it is both simple and incredibly expensive/arduous, because the masses of free data to train models on doesn't come with a command-space/untrusted-input-space dichotomy, that’s something you have to impose onto the training data, with appropriately differentiated completions.

(On top of the fact that it likely requires de novo model training, which is itself expensive.)

Re:Multi-modal prompt injection image attacks against GPT-4V by Michelangelo11 on Saturday October 14, 2023 @12:05PM (#37881587)
> and the AI is implemented to handle data this way.

This is the key issue. The problem is, I don't see how to reliably create that data handling implementation -- it always comes down to the fact that any feasible implementation takes the form of text that gets passed to the AI, and clever prompt hacking can override the instructions in that text.

Re:Multi-modal prompt injection image attacks against GPT-4V by magicalhippo on Saturday October 14, 2023 @10:01AM (#37880535)
Perhaps I'm very naive in the ways of how these multi-modal LLMs work, I admit not having had time to look into how they're glued together.

I imagined simply tagging the tokens as command and data, ie say instead of just (43) as a token, it's (43, 1) for command and (43, 0) for data. Then ensure through adverserial training that whatever interprets say images does not spit out command tokens.

edit: or better yet, just have it spit ut plain tokens like (43) and ensure they're data tokens by manually converting them to data tokens (43, 0).

Re:Multi-modal prompt injection image attacks against GPT-4V by Michelangelo11 on Saturday October 14, 2023 @11:28AM (#37881242)
Right, exactly. As I said in another comment on this thread, one of the defining features of LLMs is that there's no separation between data and instructions -- and I don't think there's any way to fix that within the current LLM paradigm.
Re:Multi-modal prompt injection image attacks against GPT-4V by dragonwriter on Saturday October 14, 2023 @11:40AM (#37881340)
> If you can crack differentiating between "command" tokens and other input tokens, you've cracked prompt injection!

Isn't this simple? Have two different tokenizer with non-overlapping output ranges, one for “trusted commands” and one for “user input”, do training with various mixes of commands and input with the appropriate reactions to each, and then have the trusted command fixed (or selectable from a small set of preselected options/payterns based on interaction style [chat might used trusted tokens to indicate which participant each piece of the exchange is from, as well as for the internal system prompt, for instance]) for external users and allow them to freely specify only input that gets sent to the “untrusted input” tokenizer. Even if you allow pretokenized input, you can sanitize it to accept only tokens from the untrusted space.

Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @11:54AM (#37881472)
Definitely not simple. If it was simple we would have solved it already!
Re:Multi-modal prompt injection image attacks against GPT-4V by dragonwriter on Saturday October 14, 2023 @12:11PM (#37881644)
Always love the “there are no easy next steps from whwre we currently are, because if they were someone would already have taken them” argument.
Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @12:15PM (#37881687)
Because it's true, right?

I'm not saying there aren't any HARD steps.

Every time I talk about prompt injection the same "surely there's an easy fix: ...." comments show up. I'm just trying to shortcut having to argue against them all again.

Re:Multi-modal prompt injection image attacks against GPT-4V by dragonwriter on Saturday October 14, 2023 @01:42PM (#37882530)
> Because it's true, right?

No, while sometimes there are barriers that take a giant leap to cross, progress tends to involveots of steps that were simple, even if time consuming to execute, once the preceding pieces were in place.

Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @01:54PM (#37882629)
If there genuinely is a simple solution to prompt injection that's been eluding us all for 13 months I cannot wait to learn what it is!
Re:Multi-modal prompt injection image attacks against GPT-4V by danShumway on Saturday October 14, 2023 @07:22PM (#37885203)
After over a year of hearing people say this, at some point the burden of proof shifts to the people making the claim.

There was a period where LLMs were extremely inaccessible to train where it would have been reasonable to say "the mitigation is easy, but OpenAI hasn't done it." But nowadays, indie models and freeware models are much more common, and there are even models with open datasets. Fine tuning can be done on a Macbook. Purchasing compute to fully replicate a smaller model is within reach of a lot of people.

There is still a cost involved, it's not trivial -- but it's a lot more accessible than it used to be. So at what point is it reasonable to respond to the people saying, "it's easy, just do X" with "well, do it then."?

If the training method you're describing works, then what is preventing someone from training a 7B model over the next week that's invulnerable to prompt injection?

Re:Multi-modal prompt injection image attacks against GPT-4V by magicalhippo on Saturday October 14, 2023 @01:03PM (#37882200)
Do you have some references (articles, blogs or similar) that illuminates why the trivial solutions won't work?

Clearly I know enough to come up with a trivial solution, but not enough to immediately see why it won't work.

Re:Multi-modal prompt injection image attacks against GPT-4V by simonw on Saturday October 14, 2023 @01:10PM (#37882265)
I've written a lot about this myself: https://simonwillison.net/series/prompt-injection/
Re:Multi-modal prompt injection image attacks against GPT-4V by magicalhippo on Saturday October 14, 2023 @04:12PM (#37883856)
Excellent, thank you.