Vibe Check: False Packages A New LLM Security Risk?

A flowchart demonstrating the exploit described.

Lots of people swear by large-language model (LLM) AIs for writing code. Lots of people swear at them. Still others may be planning to exploit their peculiarities, according to [Joe Spracklen] and other researchers at USTA. At least, the researchers have found a potential exploit in ‘vibe coding’.

Everyone who has used an LLM knows they have a propensity to “hallucinate”– that is, to go off the rails and create plausible-sounding gibberish. When you’re vibe coding, that gibberish is likely to make it into your program. Normally, that just means errors. If you are working in an environment that uses a package manager, however (like npm in Node.js, or PiPy in Python, CRAN in R-studio) that plausible-sounding nonsense code may end up calling for a fake package.

A clever attacker might be able to determine what sort of false packages the LLM is hallucinating, and inject them as a vector for malicious code. It’s more likely than you think– while CodeLlama was the worst offender, the most accurate model tested (ChatGPT4) still generated these false packages at a rate of over 5%. The researchers were able to come up with a number of mitigation strategies in their full paper, but this is a sobering reminder that an AI cannot take responsibility. Ultimately it is up to us, the programmers, to ensure the integrity and security of our code, and of the libraries we include in it.

We just had a rollicking discussion of vibe coding, which some of you seemed quite taken with. Others agreed that ChatGPT is the worst summer intern ever.  Love it or hate it, it’s likely this won’t be the last time we hear of security concerns brought up by this new method of programming.

Special thanks to [Wolfgang Friedrich] for sending this into our tip line.

18 thoughts on “Vibe Check: False Packages A New LLM Security Risk?

      1. I would imagine it is possible, though not easy to create a turing complete machine using known packages. that doesn’t solve the problem, it obfuscates it which may be even worse because it appears secure.

  1. LLM is not going far enough. Humans need libraries, levels of abstraction, keep things simple and manageable. But if we where faster and could keep more in our heads when we would not need libraries. Just write everything machine code right there and then, or whatever the lowest common deployed level of technology is.

    If the Vibe Coder is no longer checking the output then why bother with programming languages and libraries.

  2. Michael Townsen Hicks, James Humphries, & Joe Slater, in a paper in “Ethics and Information Technology,” suggest that the term “hallucination” by LLM’s is inaccurate. “We … argue that describing A.I. misrepresentations as bullshit is both a more useful and more accurate way of predicting and discussing the behaviour of these systems.”

    1. I’ve read that paper, it makes some good points. The language we use to describe things has pointed subconscious effects about how we perceive things.

      Link to paper for those who are interested:
      https://link.springer.com/article/10.1007/s10676-024-09775-5

      On the language note, “on politics and the English language”, a short-ish essay by Orwell, has some interesting analysis on how vagueness in language is easily exploited. Also worth a good read.

    2. I’m not a fan of the term “hallucination,” either– personally, I prefer “confabulation”, which is just a polite and high-falutin’ way to say bullshitting. That said, “hallucination” is the term of art employed by the researchers, so we use it here to avoid confusion.

  3. I think we will eventually need some gate-keeping for the package repositories. It seems every few weeks there is a newsworthy typosquatting or hijacked package on npm or pypi. When was the last time a malicious package got into Debian?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.