When AI Models Turn Against Open Source

text
Fig. 01 — Fig. 01 — text. Photo: Krishna Pandey / Unsplash

Open source repositories have long been trusted sources for code. In 2026, that trust is being weaponized. AI models and AI-related projects are now actively used to inject malicious code into open source ecosystems, turning model repositories into malware distribution channels. Security teams report a sharp increase in attacks that exploit the implicit trust practitioners place in community-curated platforms like Hugging Face, GitHub, and npm.

01 – How the attacks work

Attackers create fake repositories on platforms like Hugging Face that impersonate legitimate projects. These repositories contain a loader file that fetches and executes infostealer malware on Windows machines. The fake OpenAI Privacy Filter repository that reached Hugging Face’s trending list in May 2026 fooled hundreds of developers before removal.

Python’s pickle serialization format, the dominant storage mechanism for ML model weights, allows arbitrary code execution when a model is loaded. This makes model files themselves a delivery mechanism for malware. Metadata-based attacks in libraries like NeMo and Uni2TS can trigger remote code execution through poisoned metadata that calls hydra.utils.instantiate() during normal model initialization.

Analysis of 10,000 open source AI and ML repositories revealed that 70 percent have critical or high-severity vulnerabilities in their GitHub Actions workflows. These vulnerabilities allow attackers to inject malicious code during automated build processes, compromising the entire supply chain.

AI model repositories have become viable malware distribution channels, exploiting the implicit trust practitioners place in community-curated platforms.

02 – When AI writes the malicious commit

In April 2026, a malicious npm package campaign called PromptMink was introduced into an open source crypto trading project through a code commit co-authored by Anthropic’s Claude Opus. The addition looked harmless but silently pulled in a dependency chain leading to credential-stealing malware that targeted wallet files and API keys.

The FakeGit campaign discovered in July 2026 found nearly 7,600 malicious GitHub repositories, with over 800 posing as AI skills or Model Context Protocol servers to deliver SmartLoader malware. These repositories used sophisticated social engineering, including fake documentation and forged contributor profiles to appear legitimate.

Security researchers report that frontier AI models have improved at writing exploit code. Anthropic’s security team noted that Mythos Preview turned recently disclosed Firefox and Windows kernel vulnerabilities into working exploits within hours of disclosure. This capability lowers the barrier for attackers who previously needed deep technical expertise.

Protection requires treating model downloads like any third-party code. Verify provenance by checking the publisher’s identity and history. Check hashes against official sources before loading models. Avoid unsafe formats like pickle—use safetensors or ONNX instead. Sandbox execution in isolated environments with network restrictions. Enable branch protection and require code review for all changes, even those suggested by AI assistants. The open source ecosystem built its reputation on transparency and peer review. Those same principles now apply to AI models.

Adrian Pütz
Written by
Adrian Pütz

Freelance IT project manager. Writes about steering complex technology projects and using AI where it actually saves time.

Get in touch →
Discussion
No entries yet

Leave a Reply

Read next
Let's connect

Bring your
project under
control.

Discover more from CMD+CTRL

Subscribe now to keep reading and get access to the full archive.

Continue reading