Connect with us

Hi, what are you looking for?


Malware & Threats

Malicious NuGet Packages Used to Target .NET Developers

Software developers have been targeted in a new attack via malicious packages in the NuGet repository.

A newly discovered attack has been targeting .NET developers with malicious packages loaded to the NuGet repository, JFrog’s security researchers explain.

A package manager helping developers share and consume reusable code, NuGet allows developers to create code packages using the NuGet client app and have them published in either public or private repositories.

While attacks abusing open source repositories are nothing new, NuGet has not seen severe malicious activity until now, aside from packages designed to spread phishing links.

This incident, however, brings NuGet in line with NPM and PyPI repositories, which are often targeted by cybercriminals: malicious packages submitted to the repository contained code that triggered the download of a second-stage payload.

As part of the attack, typosquatting was used to trick developers into downloading the malicious packages. With roughly 150,000 downloads racked up before the packages were removed from NuGet, the operation was highly successful.  

Within the malicious packages, the attackers included a PowerShell script that was executed at the package’s installation. The script changed the system configuration so that PowerShell scripts could be executed without restrictions and then fetched a secondary payload from a remote server.

The payload, a Windows executable file, was designed to steal cryptocurrency, extract and execute code from Electron archives, and drop a small updater executable that ensures the malware is always up-to-date.

Advertisement. Scroll to continue reading.

To carry out the attack, the threat actors abused a feature in older Visual Studio versions where scripts could be placed in the ‘tools’ directory of a NuGet package to have them executed automatically with no constraints on specific events.

Newer iterations of Visual Studio ignore run-on-install scripts, but they still honor the execution of scripts added with older versions, without displaying a warning during the installation of a NuGet package.

“These kinds of autorun mechanisms are a big reason why we can find thousands of malicious packages plaguing the NPM and PyPI ecosystems as compared to the Go package ecosystem, for example, in which the client will not cause code to automatically run when a module is installed. The attacker’s code is much more likely to run if only package installation is needed to trigger it,” JFrog points out.

As part of the observed attack, the security researchers identified 13 NuGet packages containing the same malicious payload, most of which were impersonating popular packages.

The most popular of these, Coinbase.Core, had over 120,000 downloads at the time it was removed from the repository. The second most popular, Anarchy.Wrapper.Net, had over 30,000 downloads, while the third, DiscordRichPresence.API, had over 14,000.

“The top three packages were downloaded an incredible amount of times – this could be an indicator that the attack was highly successful, infecting a large amount of machines.  However, this is not a fully reliable indicator of the attack’s success since the attackers could have automatically inflated the download count (with bots) to make the packages seem more legitimate,” JFrog notes.

Related: Top 10 Security, Operational Risks From Open Source Code

Related: Vulnerability in Popular JsonWebToken Open Source Project Leads to Code Execution

Related: Google Announces Vulnerability Scanner for Open Source Developers

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join security experts as they discuss ZTNA’s untapped potential to both reduce cyber risk and empower the business.


Join Microsoft and Finite State for a webinar that will introduce a new strategy for securing the software supply chain.


Expert Insights

Related Content


The changing nature of what we still generally call ransomware will continue through 2023, driven by three primary conditions.


A recently disclosed vBulletin vulnerability, which had a zero-day status for roughly two days last week, was exploited in a hacker attack targeting the...


No one combatting cybercrime knows everything, but everyone in the battle has some intelligence to contribute to the larger knowledge base.

Malware & Threats

Threat actors are increasingly abusing Microsoft OneNote documents to deliver malware in both targeted and spray-and-pray campaigns.

Malware & Threats

Unpatched and unprotected VMware ESXi servers worldwide have been targeted in a ransomware attack exploiting a vulnerability patched in 2021.


The recent ransomware attack targeting Rackspace was conducted by a cybercrime group named Play using a new exploitation method, the cloud company revealed this...

Application Security

Virtualization technology giant VMware on Tuesday shipped urgent updates to fix a trio of security problems in multiple software products, including a virtual machine...

Malware & Threats

A vulnerability affecting IBM’s Aspera Faspex file transfer solution, tracked as CVE-2022-47986, has been exploited in attacks.