Case 885520 · AI security · L2 Practitioner
Hallucinated Packages (Slopsquatting)
Interview questionHow can an AI coding assistant lead a developer to install malware?
- 01 What is it?
- 02 How is it abused?
- 03 How do you stop it?
What a strong answer covers
Try it out loud first. Then check yourself:
- Coding assistants sometimes suggest package names that do not exist, and they repeat the same made-up names.
- Attackers register those names on npm or PyPI with malicious code; this is known as slopsquatting.
- Treat suggested dependencies like any new dependency: check the package exists, its age, maintainers and downloads.
- 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?