Introduction
The integration of AI coding agents into software development lifecycles has accelerated productivity, but it has also opened a dangerous new attack surface. Security researchers are sounding the alarm on a technique dubbed "Slopsquatting," "Phantom Domains," or "HalluSquatting." While the names vary, the threat is identical: a late-binding attack pattern where AI agents hallucinate package names, repositories, or domains that do not exist—yet.
Attackers are actively monitoring these hallucinations. When an AI suggests a plausible-sounding but non-existent library (e.g., pandas-data-utils instead of the legitimate pandas), attackers rush to register that package name in public repositories (PyPI, npm, NuGet) or claim the domain. The moment the developer or CI/CD pipeline accepts the AI's suggestion and runs the install command, malicious code is injected directly into the build environment. This is not theoretical; it is an active, emerging supply-chain threat that bypasses traditional vulnerability scanning because the package technically "exists" and passes basic linting checks. Defenders must implement governed dependency management to stop this at the pre-fetch stage.
Technical Analysis
Attack Vector: Supply Chain Compromise / Dependency Confusion via AI Hallucination.
Affected Platforms: All environments utilizing AI coding assistants (e.g., GitHub Copilot, Cursor, ChatGPT) interacting with package managers like Python (pip), JavaScript (npm), .NET (NuGet), and Ruby (gems).
Mechanism of Action: The attack leverages the "late-binding" nature of package resolution.
- Hallucination: An AI model generates code referencing a dependency that looks authoritative but is hallucinated (e.g., a common typo or a mashup of real library names).
- Squatting: An automated system or human actor identifies the hallucinated name in query logs or public code suggestions and registers the package/domain immediately.
- Execution: The developer trusts the AI, runs
pip installornpm install, and the build pipeline pulls the unverified, malicious package.
Why it Bypasses Traditional Defenses: Standard Software Composition Analysis (SCA) tools check for known CVEs. If a package was registered 10 minutes ago, it has no CVE history. It is a zero-day supply chain entry. The defense must shift from "scanning for bad code" to "verifying source and provenance" before installation.
Detection & Response
Detecting HalluSquatting requires identifying high-risk package installation behaviors and deviations from established baselines. Since the packages are technically valid (registry-wise), we must look for the context of the installation and the integrity of the source.
Sigma Rules
These rules target suspicious package installation patterns often associated with AI-generated code suggestions or supply chain infiltration attempts.
---
title: Potential Python HalluSquatting - Pip Install from Unusual Source
id: 8a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects pip installation processes attempting to pull packages from non-standard or external indexes, a common tactic in HalluSquatting and dependency confusion attacks.
references:
- https://attack.mitre.org/techniques/T1195/
- https://www.bleepingcomputer.com/news/security/slopsquatting-phantom-domains-and-hallusquatting-are-the-same-ai-attack/
author: Security Arsenal
date: 2026/04/06
tags:
- attack.initial_access
- attack.supply_chain
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith:
- '\python.exe'
- '\python3.exe'
- '\pip.exe'
CommandLine|contains:
- 'pip install'
- 'pip3 install'
filter_legit_registry:
# Fails if command line attempts to use an external index url or trusted host override
CommandLine|contains:
- '--extra-index-url'
- '--index-url'
- '--trusted-host'
condition: selection and filter_legit_registry
falsepositives:
- Legitimate installation of internal corporate packages from private indices.
level: high
---
title: Suspicious NPM Installation with Registry Manipulation
id: 9b3c4d5e-6f7a-5b8c-9d0e-1f2a3b4c5d6e
status: experimental
description: Detects npm processes modifying the registry configuration or installing directly from a specific URL, indicative of potential Phantom Domain squatting.
references:
- https://attack.mitre.org/techniques/T1195/
author: Security Arsenal
date: 2026/04/06
tags:
- attack.initial_access
- attack.execution
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith:
- '\node.exe'
- '\npm.cmd'
- '\npx.cmd'
CommandLine|contains:
- 'npm install'
- 'npm ci'
filter_suspicious:
CommandLine|contains:
- '--registry'
- '@'
- 'git://'
- 'git+'
condition: selection and filter_suspicious
falsepositives:
- Developers installing packages from private Git repositories or internal scoped packages.
level: medium
KQL (Microsoft Sentinel / Defender)
This hunt queries for package installations that immediately result in network connections to recently registered or non-standard domains, correlating process activity with network telemetry.
let PackageInstallProcesses = DeviceProcessEvents
| where Timestamp > ago(1d)
| where ProcessName has "python" or ProcessName has "pip" or ProcessName has "npm" or ProcessName has "nuget"
| where ProcessCommandLine has "install"
| extend InstallHash = hash_sha256(ProcessCommandLine);
let NetworkConnections = DeviceNetworkEvents
| where Timestamp > ago(1d)
| where InitiatingProcessFileName has "python" or InitiatingProcessFileName has "node" or InitiatingProcessFileName has "nuget"
| where RemoteUrl has "pypi.org" or RemoteUrl has "npmjs.com" or RemoteUrl has "nuget.org"
| summarize ConnectionCount = count(), MinTime = min(Timestamp), MaxTime = max(Timestamp) by InitiatingProcessCommandLine, DeviceId;
PackageInstallProcesses
| join kind=inner (NetworkConnections) on $left.ProcessCommandLine == $right.InitiatingProcessCommandLine
| project Timestamp, DeviceName, ProcessCommandLine, RemoteUrl, ConnectionCount
| order by Timestamp desc
Velociraptor VQL
This artifact hunts for the execution of package managers and parses the command line arguments to identify risky installation flags (like extra-index-url) that could bypass standard repository checks.
-- Hunt for package manager installation commands
SELECT ProcessId, Pid, Name, Cmdline, Username
FROM pslist()
WHERE Name IN ('python', 'python3', 'pip', 'pip3', 'npm', 'node', 'nuget')
AND (
Cmdline =~ 'install' OR
Cmdline =~ 'add' OR
Cmdline =~ 'i '
)
AND (
-- Flag potential external registry usage or non-standard install methods
Cmdline =~ '--extra-index-url' OR
Cmdline =~ '--registry' OR
Cmdline =~ '--trusted-host' OR
Cmdline =~ 'git://' OR
Cmdline =~ 'http:'
)
Remediation Script (Bash)
This script assists in auditing the environment for known bad practices, such as allowing external indices globally, and checks the integrity of currently installed packages against known databases (if audit tools are available).
#!/bin/bash
# Audit Script: Check Python and NPM environments for HalluSquatting risks
# Usage: sudo ./audit_hallusquatting.sh
echo "[*] Starting HalluSquatting Audit..."
# 1. Check pip configuration for external global indices
echo "[+] Checking pip global configuration for trusted hosts or extra indices..."
if command -v pip &> /dev/null; then
pip config list | grep -E "(extra-index-url|index-url|trusted-host)" && echo "[!] WARNING: pip is configured to use external indices. This increases HalluSquatting risk." || echo "[+] No global external pip indices found."
fi
# 2. Check npm configuration for registry
echo "[+] Checking npm registry configuration..."
if command -v npm &> /dev/null; then
REGISTRY=$(npm config get registry)
if [[ "$REGISTRY" != "https://registry.npmjs.org/" ]]; then
echo "[!] WARNING: npm registry is set to: $REGISTRY"
else
echo "[+] npm registry is default."
fi
fi
# 3. Run pip-audit if available to check for dependencies with known vulnerabilities
# (Note: HalluSquatting packages often have no CVEs yet, but this ensures baseline hygiene)
if command -v pip-audit &> /dev/null; then
echo "[+] Running pip-audit..."
pip-audit --desc 2>/dev/null || echo "[!] pip-audit failed or found issues."
else
echo "[!] pip-audit not found. Install it via: pip install pip-audit"
fi
echo "[*] Audit complete."
Remediation
To effectively neutralize the threat of Slopsquatting and HalluSquatting, organizations must move away from blind trust in AI suggestions and implement Governed Dependency Management:
-
Pre-fetch Verification: Implement tools that intercept package installation requests (e.g.,
pip install,npm install) and verify the package against an internal allowlist or a repository of known-good software before the download executes. The tool should reject packages with low download counts, very recent release dates, or unverified publisher signatures. -
Disable Spontaneous AI Installs: Strictly configure IDEs and AI agents to prevent them from automatically executing shell commands or installation scripts. Require human verification for every
importorinstallsuggestion. -
Package Lockfiles: Enforce the use of lockfiles (
package-lock.,requirements.txtwith hashes,poetry.lock) and check them into version control. AI agents should be instructed to modify code to use existing, locked dependencies rather than suggesting new ones. -
Private Repositories: Host internal proxies for public repositories (e.g., Nexus, Artifactory, Sonatype). Configure these proxies to block packages from external sources unless explicitly whitelisted. This creates an "air gap" between the developer's AI suggestion and the public internet.
-
Network Segmentation for Build Agents: Restrict internet access for CI/CD pipelines. If a build agent needs a package, it must pull it from the internal proxy only. This prevents the "late-binding" of a hallucinated package from the public internet during a build.
Related Resources
Security Arsenal Healthcare Cybersecurity AlertMonitor Platform Book a SOC Assessment healthcare Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.