AI coding agents are increasingly autonomous, but their tendency to hallucinate package names has created a new attack vector known as slopsquatting. Windyam Juste Yannel Belemsigri, Ange Bado, and WindpouyirΓ© Faissal CΓ©dric Konkobo, three engineering students in Morocco, developed Phantom Imports during the Kiroween 2026 hackathon to mitigate this risk. The tool acts as a pre-install guard, analyzing package names for existence, security advisories, and code behavior before allowing an agent to proceed.

The Ghost Package Problem

The team's research revealed that 6.6% of package names suggested by three different AI models did not exist on the npm registry, with one model hallucinating names at a rate of 9.1%. A prominent example is 'react-codeshift', a non-existent package confused with the real tool 'jscodeshift'. Attackers exploit this by registering these hallucinated names, waiting for agents to automatically install the malicious placeholder. Existing tools like OSV.dev and the deps.dev API failed to flag any of the 23 unique ghost names identified by the team, as they primarily track known vulnerabilities in existing packages.

Inside the Phantom Imports Architecture

Phantom Imports operates through an engine comprised of eight distinct 'organs' that evaluate specific facts, including registry status, OSV advisories, lookalike name detection, and static code analysis. These signals are processed by a central component called the Judge, which applies plain rules to output one of three verdicts: ALLOW, REVIEW, or BLOCK. The system is designed to be fail-safe, ensuring that network errors never result in an automatic ALLOW decision. The guard is available as a Kiro hook, a CLI and MCP server, and a web interface that visualizes package behavior in a 'haunted house' metaphor.

Kiro Steering and Spec-Driven Development

The team highlighted four key lessons from using Kiro, an AI development environment, to build the tool. First, steering files fundamentally changed the code logic, correcting Kiro's initial inability to rate non-existent packages as risky. Second, reviewing specifications proved more efficient than code review, allowing the team to catch edge cases like 'sudo npm install' and Windows-specific pip commands before implementation. Third, property-based testing with fast-check uncovered gaps in handling unpublished packages, such as '@a/a' with no versions. Finally, the team's own QA agent was blocked by their PreToolUse hook due to a parser error involving shell redirection, demonstrating the tool's real-world efficacy.

Key Takeaways

  • AI agents hallucinate package names at a rate of up to 9.1%, creating a significant supply chain risk.
  • Traditional security tools like OSV.dev do not currently detect hallucinated package names.
  • Phantom Imports uses a multi-organ architecture to analyze packages before installation.
  • Spec-driven development in Kiro helped catch edge cases in command parsing early in the process.

The Bottom Line

Phantom Imports proves that AI agents need deterministic guardrails, not just better prompts. By blocking 100% of identified ghost packages where existing tools failed, it sets a new standard for agentic security.