Open cardosec

Case 885520 · AI security · L2 Practitioner

Hallucinated Packages (Slopsquatting)

Practise as: Explain it · InterviewLevel: L2 Practitioner

Interview questionHow can an AI coding assistant lead a developer to install malware?

  1. 01 What is it?
  2. 02 How is it abused?
  3. 03 How do you stop it?
What a strong answer covers

Try it out loud first. Then check yourself:

  1. Coding assistants sometimes suggest package names that do not exist, and they repeat the same made-up names.
  2. Attackers register those names on npm or PyPI with malicious code; this is known as slopsquatting.
  3. Treat suggested dependencies like any new dependency: check the package exists, its age, maintainers and downloads.
  4. Controls: lockfiles, an internal registry or allowlist, and dependency scanning in CI before anything new is installed.

If the interviewer pushes back

  • How would you detect a hallucinated package that already made it into a build?

Go deeper

More AI security cards

All AI security cards →

cardosec draws a security topic and gives you a clock: explain it out loud with no notes, then see what you covered and what you missed. Free during early access.

Reviewed 2026-10-09