Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Malware & Threats

Malicious NuGet Packages Abuse MSBuild Integrations for Code Execution

Threat actors are constantly publishing malicious NuGet packages to automatically execute code on developers’ machines.

As part of an ongoing and coordinated campaign, threat actors have been continuously publishing malicious NuGet packages with hidden code execution capabilities, threat detection firm ReversingLabs reports.

The campaign has been ongoing since at least the beginning of August, with several hundred malicious packages published to the NuGet repository to date.

The threat actor behind the campaign has been observed updating tactics in response to disruptions and taking more sophisticated approaches to code execution, including exploiting NuGet’s MSBuild integrations feature.

Just as in similar attacks targeting the NPM, PyPI and RubyGEMS ecosystems, typosquatting is used to trick developers into downloading the malicious packages.

However, while previously seen malicious NuGet packages would place code inside the initialization and post installation PowerShell scripts, the recently identified ones placed the malicious functionality inside the .targets file in the ‘build’ directory.

The technique is borrowed from the IAmRoot package that was published in 2019 to demonstrate the execution of arbitrary code using NuGet packages that contain .targets files with an inline task containing executable code.

If a package containing such a .targets file is added to other packages, the code would be automatically executed when any of those packages is built.

“Based on our research, this is the first known example of malware published to the NuGet repository exploiting this inline tasks feature to execute malware,” ReversingLabs says.

Advertisement. Scroll to continue reading.

The security firm initially identified four NuGet packages with this capability, which were removed from the repository in mid-October. A week later, a new set of similar packages was published and their download counts inflated, to increase their visibility.

Imitating popular packages, the campaign appears to have strong links to two previously reported attacks, one delivering the SeroXen RAT and another leading to Impala Stealer infections. The same delivery mechanism was used in hundreds of malicious packages that were identified in August.

“The threat actors behind [this ongoing campaign] are tenacious in their desire to plant malware into the NuGet repository, and to continuously publish new malicious packages. As soon as the previous packages are removed from the repository, ReversingLabs detects newly published packages on a daily basis,” the security firm notes.

Related: Hundreds Download Malicious NPM Package Capable of Delivering Rootkit

Related: Thousands of Code Packages Vulnerable to Repojacking Attacks

Related: Developers Warned of Malicious PyPI, NPM, Ruby Packages Targeting Macs

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Trending

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 the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

People on the Move

Mike Dube has joined cloud security company Aqua Security as CRO.

Cody Barrow has been appointed as CEO of threat intelligence company EclecticIQ.

Shay Mowlem has been named CMO of runtime and application security company Contrast Security.

More People On The Move

Expert Insights

Related Content

Cybercrime

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...

Cybercrime

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

Malware & Threats

The NSA and FBI warn that a Chinese state-sponsored APT called BlackTech is hacking into network edge devices and using firmware implants to silently...

Cyberwarfare

An engineer recruited by intelligence services reportedly used a water pump to deliver Stuxnet, which reportedly cost $1-2 billion to develop.

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

Apple’s cat-and-mouse struggles with zero-day exploits on its flagship iOS platform is showing no signs of slowing down.

Malware & Threats

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

Malware & Threats

Cisco is warning of a zero-day vulnerability in Cisco ASA and FTD that can be exploited remotely, without authentication, in brute force attacks.