Skip to content
Minute Campus.

How AI gets attackedLesson 051 min

How does a made-up package name become malware?

AI coding tools sometimes recommend packages that do not exist. Researchers tested sixteen models on more than half a million code samples: about 5% of packages named by commercial models did not exist, and about 22% for open-source models. The same invented names often came back. An attacker can register such a name with malicious code inside. The nickname is slopsquatting.

Remember

Before installing a package you have not used, check it exists and who publishes it.

Sources

Checked at the source.

Every claim in the lesson was checked against these before it was recorded.

  1. 1We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMsSpracklen et al. · USENIX Security 2025 · read 4 Oct 202616 models, 576,000 samples; hallucinated packages averaged at least 5.2% for commercial and 21.7% for open-source models.

Transcript

The lesson, word for word.

Read it at your own pace, or search the page for a term.

AI coding tools sometimes recommend software packages that do not exist. Attackers have noticed. When you ask a model for code, it often tells you to install a package. Usually the package is real. Sometimes the model invents a name that only sounds real. Researchers tested sixteen models, with more than half a million code samples. In commercial models, about five per cent of the packages named did not exist. In open-source models, about twenty-two per cent. And the same invented names often came back, again and again. An attacker registers one of those names on a public package index, and puts malicious code inside. The next person who copies the AI's install command gets the attacker's package. The nickname is slopsquatting. The fix: before you install a package you have not used, look it up. Check that it exists, who publishes it, and how long it has been there.

Questions? Comment on the lesson on YouTube

New lessons every day.

Follow Minute Campus where you already scroll.