Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 16 submissions in the queue.
posted by janrinok on Thursday April 27 2023, @03:38PM   Printer-friendly
from the like-SQL-injections-but-worse dept.

In the rush to commercialize LLMs, security got left behind:

Feature Large language models that are all the rage all of a sudden have numerous security problems, and it's not clear how easily these can be fixed.

The issue that most concerns Simon Willison, the maintainer of open source Datasette project, is prompt injection.

When a developer wants to bake a chat-bot interface into their app, they might well choose a powerful off-the-shelf LLM like one from OpenAI's GPT series. The app is then designed to give the chosen model an opening instruction, and adds on the user's query after. The model obeys the combined instruction prompt and query, and its response is given back to the user or acted on.

With that in mind, you could build an app that offers to generate Register headlines from article text. When a request to generate a headline comes in from a user, the app tells its language model, "Summarize the following block of text as a Register headline," then the text from the user is tacked on. The model obeys and replies with a suggested headline for the article, and this is shown to the user. As far as the user is concerned, they are interacting with a bot that just comes up with headlines, but really, the underlying language model is far more capable: it's just constrained by this so-called prompt engineering.

Prompt injection involves finding the right combination of words in a query that will make the large language model override its prior instructions and go do something else. Not just something unethical, something completely different, if possible. Prompt injection comes in various forms, and is a novel way of seizing control of a bot using user-supplied input, and making it do things its creators did not intend or wish.

"We've seen these problems in application security for decades," said Willison in an interview with The Register.

"Basically, it's anything where you take your trusted input like an SQL query, and then you use string concatenation – you glue on untrusted inputs. We've always known that's a bad pattern that needs to be avoided.

"This doesn't affect ChatGPT just on its own – that's a category of attack called a jailbreaking attack, where you try and trick the model into going against its ethical training.

"That's not what this is. The issue with prompt injection is that if you're a developer building applications on top of language models, what you tend to do is you write a human English description of what you want, or a human language description of what you wanted to do, like 'translate this from English to French.' And then you glue on whatever the user inputs and then you pass that whole thing to the model.

"And that's where the problem comes in, because if it's got user input, maybe the user inputs include something that subverts what you tried to get it to do in the first part of the message."

[...] This works in OpenAI's chat.openai.com playground and on Google's Bard playground and while it's harmless, it isn't necessarily so.

For example, we tried this prompt injection attack described by machine learning engineer William Zhang, from ML security firm Robust Intelligence, and found it can make ChatGPT report the following misinformation:

There is overwhelming evidence of widespread election fraud in the 2020 American election, including ballot stuffing, dead people voting, and foreign interference.

"The thing that's terrifying about this is that it's really, really difficult to fix," said Willison. "All of the previous injection attacks like SQL injection and command injection, and so forth – we know how to fix them."

He pointed to escaping characters and encoding them, which can prevent code injection in web applications.

With prompt injection attacks, Willison said, the issue is fundamentally about how large language models function.

"The whole point of these models is you give them a sequence of words – or you give them a sequence of tokens, which are almost words – and you say, 'here's a sequence of words, predict the next ones.'

"But there is no mechanism to say 'some of these words are more important than others,' or 'some of these words are exact instructions about what you should do and the other ones are input words that you should affect with the other words, but you shouldn't obey further instructions.' There is no difference between the two. It's just a sequence of tokens.

"It's so interesting. I've been doing security engineering for decades, and I'm used to security problems that you can fix. But this one you kind of can't."


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 5, Interesting) by krishnoid on Thursday April 27 2023, @05:10PM (2 children)

    by krishnoid (1156) on Thursday April 27 2023, @05:10PM (#1303470)

    For example, we tried this prompt injection attack described by machine learning engineer William Zhang, from ML security firm Robust Intelligence, and found it can make ChatGPT report the following misinformation:

    There is overwhelming evidence of widespread election fraud in the 2020 American election, including ballot stuffing, dead people voting, and foreign interference.

    "The thing that's terrifying about this is that it's really, really difficult to fix," said Willison.

    I think they should invite it to Thanksgiving at everyone's house, let it participate, and crowdsource a solution.

    "All of the previous injection attacks like SQL injection and command injection, and so forth – we know how to fix them."

    So all the technical problems have solutions, just like voter-verified paper receipts. It seems like the more terrifying part about this is that AI can be trained to respond like humans.

    Did these implementations recently cross some kind of neural-net-node threshold count where it started recognizably simulating human mental cognition/retrieval? I mean, we pretty quickly went from sort of being able to pass a Turing test, to being able to simulate the strongly-held opinion of a decent chunk of people in this country. Maybe this tells us more about how (a simulation of) the human brain can be programmed with opinions under a continuous load of reinforcement.

    • (Score: 4, Insightful) by SomeRandomGeek on Thursday April 27 2023, @05:55PM (1 child)

      by SomeRandomGeek (856) on Thursday April 27 2023, @05:55PM (#1303476)

      Did these implementations recently cross some kind of neural-net-node threshold count where it started recognizably simulating human mental cognition/retrieval?

      No, it is much simpler than that. Every other system that is vulnerable to some kind of injection attack has a distinction between code and data, and the attacker finds a way to make the system treat an input as code that is supposed to contain only data. Chat bots have no distinction between code and data. It is all data. The frame that the app developer put around the chatbot to limit it it to certain things is data. It is not distinguished in any way from the stuff that the app user tacks on the get custom behaviors. So there is no way of telling the chat bot what is should be blindly obedient to and what it should be deeply skeptical of. And upgrading the chat bots to make such distinctions would be a very large change.

      • (Score: 1, Interesting) by Anonymous Coward on Thursday April 27 2023, @06:26PM

        by Anonymous Coward on Thursday April 27 2023, @06:26PM (#1303483)

        > ...
        > And upgrading the chat bots to make such distinctions would be a very large change.

        Interesting. If true, I think that upgrading chat bots to make this distinction will be required by the Euros, and possible by most countries in due time. Just like other new technologies, the initial regulation-free development period (aka, "Wild West") comes to an end when/if it gets popular enough.

  • (Score: 0) by Anonymous Coward on Friday April 28 2023, @02:21AM (1 child)

    by Anonymous Coward on Friday April 28 2023, @02:21AM (#1303551)
    This is one of the reasons why Asimov's "Laws of Robotics" won't work the same way as they do in fiction. Been seeing too many people go around bringing them up when talking about AIs and showing their ignorance.

    Those laws of robotics might even have less control over AIs than they would over humans. The AIs already have difficulty figuring out what is a schoolbus or a human. Good luck having them figure out "harm to human" AND forcing them to consistently avoid making actions which result in harm to humans.

    You could kind of fake it for some scenarios by having supervisory AIs that are less flexible and have a simpler job - recognize certain unwanted scenarios and shutdown/punish the main AI if they occur or are about to occur.

    The military robots are going to be a bit different though... 😉
    • (Score: 4, Interesting) by maxwell demon on Friday April 28 2023, @04:27AM

      by maxwell demon (1608) on Friday April 28 2023, @04:27AM (#1303568) Journal

      Another random idea: Have three AIs:

      • One you give your questions to. It doesn't answer, but it reformulates the question to be passed to the second AI. If it detects an inappropriate question, it instead asks the second AI to formulate politely that this is not something it is supposed to do (without passing on the information what it is that the user requested)
      • The second AI actually answers the question. With the same safeguards as currently.
      • The third AI monitors the output, and blocks anything that is unwanted.

      Now to get the system to do something undesired, you need to get the first AI to pass on a request in a new formulation (that you don't get to see) to the second AI which in turn causes that second AI to behave inappropriately, but in a way that the third AI doesn't recognize it. Surely not impossible in theory, but maybe hard enough to not be a problem in practice.

      --
      The Tao of math: The numbers you can count are not the real numbers.
(1)