Building a Supply Chain Attack With .NET and NuGet | Maarten Balliauw | .NET Day 2026
In a Nutshell
Supply chain attacks against .NET/NuGet rely on dependency confusion, Unicode typosquatting, source generators, MSBuild targets, and startup hooks to inject malicious code during package restore or build. Attackers can use module initializers and Covenant C2 frameworks to deploy stealthy droppers that execute before the application starts, while lock files, package signing, and SBOM generation provide critical detection points. Effective defense requires layered mitigations—source mapping, thorough PR reviews with Unicode detection, dependency tracking, and behavioral monitoring—since single controls can be bypassed.
These notes were generated by AI and may contain inaccuracies.
A software supply chain attack occurs when a malicious party attacks elements in a software supply network. This could involve accessing dependencies or hacking into tools to send malicious payloads to customers. The goal is to infiltrate the supply chain and infiltrate systems of end customers or end users. These attacks often use a "sleeper cell" approach where the attacker injects something and waits, sometimes a year after the initial attack, before the actual attack begins.
A notable example is the Shah Hulot attack on NPM, where an attacker compromised over 500 packages on NPM. The attack involved running a script whenever someone installed the package, including the bun environment.js file with the malicious payload. This was installed on developers' machines and CI runners, creating persistent integration triggers that allowed attackers to capture commands, deploy wiper tools, and extract secrets like AWS and Azure passwords.
Supply chain attacks and malware typically contain several components. The dropper serves as primary code executed on the victim's device, ideally being discreet to establish a foothold. Payloads are then run by the dropper to perform actions often received via a command and control (C2) server. This C2 infrastructure gives instructions to collect environment variables, inspect files, conduct network reconnaissance, and execute commands.
Attack vectors include accessing source code through social engineering, pull requests, or obtaining maintainer account details. Dependency confusion involves posting packages that should be private to the public registry. Typosquatting uses Unicode characters that look similar to legitimate package names, such as using a dotted Ukrainian letter I instead of a regular letter I.
Sign in to read the full notes
Get access to AI-generated notes, topic timestamps, and more.





