Hallucination Squatting¶
Hallucination Squatting¶
A.k.a. Package Hallucinations:
- LLMs often hallucinate (invent) code libraries or packages that sound real but don’t actually exist. (Which is in-general just how LLMs work; they generate plausible-sounding text based on patterns in training data.)
- The attack:
- Attackers query LLMs to find these common hallucinations.
- They register the package name on package repositories (like npm, PyPI).
- They upload malicious code to these packages.
- The victim: Developers who copy-paste code from LLMs without verifying the existence of the packages then run
npm installorpip installon the hallucinated package, thereby installing Malware.