Fake OpenAI Repository on Hugging Face Spreads Malware

Fake OpenAI Repository on Hugging Face Spreads Malware

The rapid expansion of artificial intelligence technologies has transformed global digital interaction while simultaneously providing a fertile landscape for sophisticated cybercriminal campaigns targeting unsuspecting developers. This weaponization of trust in established brands recently manifested as a targeted campaign against the Hugging Face community, which serves as a central hub for machine learning collaboration. By impersonating a legitimate OpenAI project, attackers demonstrated a critical shift in the modern threat landscape, moving beyond traditional software repositories like npm or PyPI to exploit specialized AI platforms. This chronological dissection of the attack explores the sequence of events from its emergence on trending lists to the execution of its malicious payload, serving as a vital case study for cybersecurity professionals navigating the risks inherent in the modern AI supply chain.

Chronological Breakdown of the Typosquatting Attack

May 2024: Discovery of the Open-OSS/privacy-filter Repository

The campaign first came to light when researchers at HiddenLayer identified a suspicious repository named Open-OSS/privacy-filter. This repository was a textbook example of “typosquatting,” designed to mimic OpenAI’s legitimate “Privacy Filter” release to deceive users seeking data protection tools. To increase its perceived authenticity, the attackers copied the official model card nearly verbatim, lending an air of professional legitimacy to the fraudulent project. This initial phase was remarkably successful; the repository briefly climbed to the #1 spot on Hugging Face’s trending list, accumulating a reported 244,000 downloads and 667 “likes.” While these metrics were likely artificially inflated by bot activity, they provided the necessary social proof to lure human users into downloading the malicious files.

May 2024: Analysis of the Malicious loader.py Script

Upon technical inspection, researchers found that the repository contained a file named loader.py that served as the primary entry point for the infection. While the script included snippets of fake AI-related code to maintain a veneer of legitimacy, its actual function was highly malicious. The script operated silently in the background, first disabling SSL verification to bypass certain network security checks that might otherwise flag the connection. It then decoded a base64-encoded URL to fetch a JSON payload from an external server. This payload triggered a PowerShell command executed in an invisible window, initiating a multi-stage infection process that moved the attack from a simple Python script to a deep system compromise.

May 2024: Deployment of the Rust-Based Infostealer

The final stage of the attack involved the execution of a sophisticated malware strain known as “sefirah.” After a batch file named start.bat performed privilege escalation and added the malware to Microsoft Defender’s exclusion list, the Rust-based infostealer began its extensive data harvesting operations. The malware targeted a wide array of sensitive information, including browser cookies, saved passwords, Discord tokens, and cryptocurrency wallet seeds. Notably, the malware featured extensive anti-analysis capabilities, checking for virtual machines and debuggers to evade detection by security researchers. All stolen data was eventually compressed and exfiltrated to a command-and-control server, marking the completion of the theft cycle.

Turning Points and Security Implications

A significant turning point in this event was the successful manipulation of Hugging Face’s trending algorithm, which allowed the threat to reach a massive audience. By using bot accounts to inflate download counts, the attackers bypassed the “community trust” filter that many developers use to vet their tools. This highlights a shift in industry standards; as AI platforms become as central to development as GitHub, they inherit the same risks of supply chain poisoning. The use of Rust for the final payload also reflects a broader trend in malware development, where attackers favor modern, high-performance languages that are more difficult to reverse-engineer than traditional scripts.

An overarching theme identified here is the “Validation Gap” in platform security. While Hugging Face implements security scans, the logic-based nature of a malicious loader.py script often evades automated signature-based detection. This incident revealed a notable gap in how the industry handled model supply chain security during this period. Future exploration was directed toward behavioral analysis for AI repositories, ensuring that scripts associated with model loading were scrutinized as heavily as the weights themselves.

Nuances of AI-Centric Cyber Threats

Regional differences and competitive factors in the global AI race contributed to the effectiveness of these social engineering tactics. The global rush to implement privacy-preserving AI tools made a “Privacy Filter” an incredibly enticing target. Experts suggested that as companies became desperate to secure internal data from AI leakage, they bypassed standard procurement processes, leading developers to download “quick fixes” from public repositories without proper auditing.

A common misconception was that malware in an AI repository must be hidden within complex tensors. As this case demonstrated, the most effective attacks often resided in the surrounding infrastructure, such as the Python wrappers and setup scripts that users executed without a second thought. Innovations in security, such as “Model Signing” and sandboxed execution environments, were developed to counter these threats. However, until these methodologies became industry standard, the human element remained the weakest link in the security chain. Researchers recommended that affected users rotate all credentials and implement hardware-based security keys to mitigate the long-term impact of the exfiltrated data. Professionals also looked toward integrated static analysis tools to better identify malicious logic in model-adjacent scripts.

Subscribe to our weekly news digest.

Join now and become a part of our fast-growing community.

Invalid Email Address
Thanks for Subscribing!
We'll be sending you our best soon!
Something went wrong, please try again later