
Slopsquatting: The New Supply Chain Attack Targeting AI-First Developers
Slopsquatting is the latest security threat for AI-assisted frontend developers. Learn how to protect your Next.js project from AI-hallucinated malicious npm packages using AGENTS.md and verification scripts.
The Invisible Threat in Your Terminal
Imagine this: You’re deep in a "vibe coding" session with Claude Code Terminal Flicker: NO_FLICKER Config (May 2026)">Claude Code /advisor Troubleshooting: 8 Errors and Fixes (May 2026)">Claude Code /advisor Recipes: 5 Use Cases with Real Output (May 2026)">Claude Code /advisor vs claude-code-router: Which Routing Strategy Wins (May 2026)">Claude Code or Cursor. You ask the agent to "implement a complex state transition with flicker-free rendering in Next.js." The AI, being helpful and confident, suggests installing a specialized utility: npm install next-flicker-zero. You approve the command without a second thought. Five minutes later, your environment variables are being exfiltrated to a remote server in North Korea.
Welcome to Slopsquatting—the most sophisticated supply chain attack of 2026. Unlike traditional typosquatting, which relies on your fat-fingering a package name, slopsquatting exploits the hallucinations of the very AI agents we’ve come to trust with our codebases. In this deep dive, we’ll explore how this attack works, why frontend developers are the primary targets, and how to harden your workflow against AI-driven dependency injection.
What is Slopsquatting?
Slopsquatting occurs when an attacker identifies non-existent but "plausible" package names that LLMs frequently hallucinate. When an AI agent like Claude 3.7 or Gemini 2.5 suggests a package that doesn't exist (e.g., react-codeshift or tailwind-magic-anims), the attacker registers that exact name on the npm registry with a malicious payload.
The term is a portmanteau of "slop" (the derogatory term for low-quality AI output) and "cybersquatting." It is particularly dangerous because developers often treat AI suggestions with less scrutiny than a random StackOverflow comment. When the agent says "You need X to solve Y," our natural instinct is to believe it—especially when we're moving at the speed of thought.
The "react-codeshift" Incident
In early 2026, security researchers identified a surge in downloads for a package called react-codeshift. The package didn't exist in any official documentation, yet it was appearing in hundreds of GitHub repositories. The source? A common hallucination across several major LLMs when asked to "refactor React components using automated codemods." Attackers had registered the name, and AI agents—operating autonomously in "agentic" modes—were installing it and executing post-install scripts that harvested .env files.
Why Frontend Developers are at High Risk
The frontend ecosystem is uniquely vulnerable to slopsquatting for three reasons:
- Package Density: The average Next.js project has hundreds of dependencies. One more small utility seems harmless.
- Abstraction Layers: We frequently use "wrappers" and "adapters." If an AI suggests
@vercel/ai-adapter-qroq, it sounds legitimate enough to pass a cursory glance. - The "Flicker" Obsession: As seen in recent GSC trends for keywords like
claude_code_no_flicker, developers are desperate for performance-specific fixes. Attackers target these niche pain points with hallucinated "optimization" libraries.
Hardening Your Agentic Workflow
To benefit from AI agents without losing your keys to the kingdom, you must move from "Blind Approval" to "Verified Execution."
1. Implementing AGENTS.md (The Next.js 16.2 Way)
As we discussed in our recent breakdown of Next.js 16.2, the new AGENTS.md standard is your first line of defense. By forcing your AI agent to read local, version-matched documentation instead of relying on its internal (and potentially outdated or hallucinating) weights, you drastically reduce the chance of a slopsquatting suggestion.
# AGENTS.md for NextFuture Project
## Instructions
- Always refer to documentation in node_modules/next/dist/docs/
- NEVER install new npm packages without checking npmjs.com/package/ first.
- If a suggested package has < 1,000 downloads or was published in the last 72 hours, flag it for manual review.
2. Automated Dependency Guardrails
You can script your AI agent to run a "sanity check" before every installation. Below is a simple Node.js script you can ask your agent to use as a tool before it runs npm install.
import fetch from 'node-fetch';
async function verifyPackage(packageName) {
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
if (response.status === 404) {
throw new Error(`CRITICAL: Package ${packageName} does not exist. Potential Slopsquatting detected!`);
}
const data = await response.json();
const createdDate = new Date(data.time.created);
const ageInDays = (new Date() - createdDate) / (1000 * 60 * 60 * 24);
if (ageInDays < 7) {
console.warn(`⚠️ WARNING: ${packageName} is only ${ageInDays.toFixed(1)} days old. Proceed with extreme caution.`);
}
return true;
}
// Example usage:
// verifyPackage('react-codeshift').catch(console.error);
3. Use Restricted Shells
Tools like Claude Code allow you to set permissions. Never give an AI agent unrestricted sudo access or the ability to edit your ~/.zshrc or ~/.bashrc. Keep the agent's "reach" limited to the project directory.
Beyond Security: The Productivity Angle
While security is paramount, the "noise" of hallucinations also kills productivity. If you find yourself constantly correcting an AI that is trying to use non-existent APIs, you’re losing the "vibe coding" flow. This is why we developed the AI Frontend Starter Kit. It includes pre-configured CLAUDE.md and AGENTS.md files that ground the model in reality, ensuring it uses the latest Next.js 16.2 patterns instead of hallucinating 2023-era workarounds.
For those looking to supercharge their existing setup, our 150 Cursor Prompts for FE Devs includes specific "Security Audit" prompts that force the AI to double-check its own package recommendations against the official registry.
👉 Check out our products: NextFuture AI Tools for Developers
Conclusion: The Human in the Loop
In the age of Agent-First IDEs, the role of the Senior Engineer has shifted. You are no longer just a "writer" of code; you are an Editor and a Security Architect. Slopsquatting is a reminder that while AI can provide the "slop" (the raw material), it requires human "craft" to ensure that material is safe, performant, and real.
Before you run that next npm install suggested by your favorite agent, ask yourself: "Does this package exist, or am I just following a hallucination into a trap?"
Support our work: If you're looking for a way to manage the explosion of AI tools without going broke, check out Galaxy.ai. It gives you access to 3,000+ AI models (including the latest O3 and Claude 3.7) in one dashboard, making it easier to verify outputs across different models to spot hallucinations before they become security risks.
🚀 Try Galaxy.ai: https://try.galaxy.ai/nguyen-dang-binh
A Quick Checklist for the AI-First Developer
Before you approve a package installation recommended by an AI agent, run through this 15-second audit:
- Is the name "too" descriptive? Hallucinations like
next-js-flicker-free-rendererare more common than short names. - Is it on npmjs.com? A simple
open https://npmjs.com/package/can save you a week of disaster recovery. - Is it in the official docs? AI agents often "invent" helper libraries that wrap native APIs. It's almost always better to write the native code yourself.
- Check the publisher. Malicious packages often have random, autogenerated publisher names. Look for verified orgs like
@vercel,@react, or@next-safe.
The transition to agentic development is the biggest shift in our industry since the arrival of the cloud. But with great power comes the absolute responsibility of verifying the suggestions we receive from our non-human colleagues. Slopsquatting is the first of many AI-driven threats we'll face. By using grounding tools like AGENTS.md and maintaining a healthy skepticism, you can keep your Next.js application both cutting-edge and secure.
Get weekly highlights
No spam, unsubscribe anytime.
Galaxy.ai
AI workspace for developers — all AI tools in one place. Supercharge your workflow.



Comments (0)
Sign in to comment
No comments yet. Be the first to comment!