{"id":5071,"date":"2026-08-20T14:54:11","date_gmt":"2026-08-20T14:54:11","guid":{"rendered":"https:\/\/www.hackmosphere.fr\/slopsquatting-the-security-injection-attack-that-exploits-hallucinations-in-ai-code-assistants\/"},"modified":"2026-08-27T10:30:46","modified_gmt":"2026-08-27T10:30:46","slug":"slopsquatting-the-security-injection-attack-that-exploits-hallucinations-in-ai-code-assistants","status":"publish","type":"post","link":"https:\/\/www.hackmosphere.fr\/en\/slopsquatting-the-security-injection-attack-that-exploits-hallucinations-in-ai-code-assistants\/","title":{"rendered":"Slopsquatting: The Security Injection Attack That Exploits Hallucinations in AI Code Assistants"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text admin_label=&#8221;Text&#8221; _builder_version=&#8221;4.27.8&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p>In January 2026, security researcher<a href=\"https:\/\/www.aikido.dev\/blog\/agent-skills-spreading-hallucinated-npx-commands\"> Charlie Eriksen of Aikido Security<\/a> registered the react-codeshift package on npm\u2014a name he hadn\u2019t created and that had never been published before. This package was a figment of the imagination created by merging two real libraries, jscodeshift and react-codemod, and then spread to 237 GitHub repositories via instruction files (Agent Skills) generated by language models. After it was registered, automated agents began attempting to install it on a regular basis, demonstrating that a package name invented by AI could quickly make its way into real-world environments.  &nbsp;<\/p>\n<p>This episode illustrates &#8220;slopsquatting,&#8221; a supply chain attack in which a malicious actor registers nonexistent packages\u2014often suggested by AI tools\u2014in order to trick developers or IT staff into installing them.<\/p>\n<h2 class=\"wp-block-heading\">Attack Mechanism: A Cybersecurity Risk That Exploits the Predictability of LLMs<\/h2>\n<p>A language model does not systematically check whether a dependency exists in a registry such as npm or PyPI before recommending it: it generates a probabilistic response and can thus produce a plausible but nonexistent package name. This error becomes particularly exploitable when it recurs. In<a href=\"https:\/\/arxiv.org\/pdf\/2406.10279\"> their study<\/a>, Joseph Spracklen and his co-authors reran 500 prompts\u2014each of which had previously led to package hallucinations\u2014ten times: 43% of the invented names reappeared in every run, and 58% appeared at least twice.  &nbsp;<\/p>\n<p>This persistence means that an attacker does not need to guess a random name: they can probe a model, identify the fictitious dependencies that appear regularly, and then register them in a public registry before a developer or deployment agent attempts to install them.<\/p>\n<h2 class=\"wp-block-heading\">Extent of the Problem and Hallucination Rates According to LLM Models (Claude, GPT, Gemini, DeepSeek)<\/h2>\n<p><a href=\"https:\/\/www.usenix.org\/system\/files\/usenixsecurity25-spracklen.pdf\">The landmark study by Spracklen et al.<\/a>, presented at USENIX Security 2025, reveals some particularly striking figures. By analyzing 576,000 code samples generated by 16 models, the researchers found that nearly 20% of the recommended dependencies did not exist\u2014that is, more than 440,000 names out of 2.23 million. <\/p>\n<p>The trend is even more pronounced in the open-source sector, with an average rate of 21.7 percent, compared with 5.2 percent for commercial models.<\/p>\n<p>A replication published in 2026 by&nbsp;<a href=\"https:\/\/arxiv.org\/pdf\/2605.17062\">Aleksandr Churilov\u2019s<\/a> study, which examines several recent models (Claude, GPT, Gemini, DeepSeek), shows a relative improvement: the observed rates range from 4.62% to 6.10%. The gap between models has thus narrowed, but the problem remains significant. On a large scale, even a few percentage points represent a significant volume of fictitious dependencies.  <\/p>\n<p>The initial study also highlights another risk: confusion between ecosystems. Approximately 8.7% of the \u201challucinated\u201d Python packages actually correspond to existing packages on npm. In practice, a developer might be redirected to a dependency for another language or, worse, to a malicious package uploaded by an attacker under the same name.  <\/p>\n<h2 class=\"wp-block-heading\">Real-world cases and documented vulnerabilities: from malicious npm\/PyPI packages to HalluSquatting<\/h2>\n<p>A telling example, documented by Bar Lanyado (Lasso Security), illustrates the problem well: several language templates recommended installing a Python package named&nbsp;<em>huggingface-cli<\/em>. Problem: this package did not exist. The official method actually relied on  &nbsp;<em>huggingface_hub<\/em>, which provides the CLI (now accessible via the command&nbsp;<em>hf<\/em>).<\/p>\n<p>To measure the actual impact of this error, the researcher released an empty package named&nbsp;<em>huggingface-cli<\/em> on PyPI. The result: more than 30,000 downloads in three months, with no malicious content. His analysis then showed that this incorrect recommendation had been copied into the documentation for a public research project linked to Alibaba (GraphTranslator). In other words, an AI hallucination can end up in real code and be executed by developers.   <\/p>\n<p>A more recent case illustrates a worrying escalation. A malicious npm package named<em> unused-imports<\/em>, suggested by algorithms in place of the legitimate package eslint-plugin-unused-imports, continued to be downloaded despite a security block, with approximately 233 weekly installations in early 2026 (Cloud Security Alliance). <\/p>\n<p>This type of attack is part of a technique known as&nbsp;<strong>HalluSquatting<\/strong>. The concept: exploiting AI\u2019s predictable hallucinations to create booby-trapped packets or resources. In agent-based environments, the risk is even higher: an agent can retrieve these resources and execute malicious instructions, paving the way for compromises or even remote code execution.  <\/p>\n<h2 class=\"wp-block-heading\">Mitigating Slopsquatting: A Rigorous Chain of Trust, Not Blind Automation<\/h2>\n<ul class=\"wp-block-list\">\n<li><strong>Always verify packages before installation<\/strong>: never run an installation command suggested by an AI without confirming that the package actually exists in the target registry (PyPI, npm, crates.io, etc.). In particular, you should verify the maintainer, release date, version history, and, when relevant, download statistics. This verification can be automated in CI\/CD pipelines to block builds when a dependency is unknown, newly released, or does not comply with security policies.  <\/li>\n<li><strong>Require human approval for new dependencies<\/strong>: When an autonomous code agent proposes or adds a library, its installation should not be executed automatically. Human approval is necessary to verify that the dependency actually meets the need and that it is the correct package. An explicit step to review dependencies in pull requests can, in particular, help identify package names that are plausible but nonexistent or suspicious.  &nbsp;<\/li>\n<li><strong>Monitor recently published packages<\/strong>: An unknown dependency within the organization that was recently registered warrants special attention before it is integrated into production. Checks can flag very recent packages, those with few downloads, or those associated with maintainers who lack an established track record. Their owner, version history, documentation, and source repository must then be verified before approval.  &nbsp;<\/li>\n<li><strong>Prioritize a whitelist for critical projects<\/strong>: rather than allowing any dependency suggested by a code assistant by default, organizations can maintain an internal catalog of approved packages and versions. For sensitive environments, direct access to public registries can be restricted in favor of an internal repository serving as a control point. Any new dependency must then be validated before it can be used by a developer or AI agent.  &nbsp;<\/li>\n<\/ul>\n<p>To learn more, see <a href=\"https:\/\/www.hackmosphere.fr\/en\/ai-architectures-risk-factors-which-component-which-risk\/\" data-type=\"post\" data-id=\"4746\">our guide to AI architectures and risk vectors to <\/a>understand how this risk vector fits into the supply chain risks specific to AI.<\/p>\n<h2 class=\"wp-block-heading\">FAQ: AI Security and Development Agents<\/h2>\n<p>[\/et_pb_text][et_pb_accordion _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;Does a newer model eliminate the risk of slopsquatting?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243; open=&#8221;on&#8221;]No, it reduces it without eliminating it. Studies from 2026 show a significantly lower rate of hallucinations in recent models, but the rate is still high enough\u2014given the volume of code generated\u2014to represent a real-world exposure.[\/et_pb_accordion_item][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;Does this risk apply only to individual developers?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243; open=&#8221;off&#8221;]No, it now also affects autonomous code agents\u2014those capable of installing a dependency without intermediate human validation\u2014a scenario in which risk spreads more quickly than when a developer could spot an anomaly before execution.[\/et_pb_accordion_item][et_pb_accordion_item _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; title=&#8221;How does an attacker know which made-up names to target?&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243; open=&#8221;off&#8221;]By observing the repeatability of a model\u2019s suggestions for similar prompts\u2014a hallucinated name that consistently reappears with each generation is a more profitable target than a name that appeared only once\u2014this makes the attack scalable rather than random.[\/et_pb_accordion_item][\/et_pb_accordion][et_pb_text _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h2 class=\"wp-block-heading\">AI Audits and Penetration Testing: Securing Your DevSecOps Software Supply Chain<\/h2>\n<p>Our experts assess the vulnerability of your development pipelines to phantom dependencies and test the resilience of your code agents as part of our AI-powered penetration testing service. Would you like to discuss your project or assess your needs?   <a href=\"https:\/\/www.hackmosphere.fr\/en\/contact\/\">Contact our experts.<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In January 2026, security researcher Charlie Eriksen of Aikido Security registered the react-codeshift package on npm\u2014a name he hadn\u2019t created and that had never been published before. This package was a figment of the imagination created by merging two real libraries, jscodeshift and react-codemod, and then spread to 237 GitHub repositories via instruction files (Agent [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5070,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"Slopsquatting: The AI Risk to the Software Supply Chain","_seopress_titles_desc":"Learn about Slopsquatting, a cyberattack that exploits LLM hallucinations and fictitious npm\/PyPI packages. Mechanisms, risks to AI agents, and mitigation strategies.","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[46],"tags":[],"class_list":["post-5071","post","type-post","status-publish","format-standard","has-post-thumbnail","category-other"],"_links":{"self":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/comments?post=5071"}],"version-history":[{"count":6,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5071\/revisions"}],"predecessor-version":[{"id":5284,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5071\/revisions\/5284"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media\/5070"}],"wp:attachment":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media?parent=5071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/categories?post=5071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/tags?post=5071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}