Skip to content
RCE Write-up Intermediate

The Initial Setup

The .NET Core SDK installer appended a user-controlled path to the SYSTEM account's PATH environment variable, allowing a local user to achieve code execution as SYSTEM by planting a DLL. The bug was partially fixed but not acknowledged by Microsoft.

itm4n.github.io

Published on itm4n.github.io

There was a weird bug in the DotNet Core Toolset installer that allowed any local user to elevate their privileges to SYSTEM. In this blog post, I want to share the details of this bug that was silently (but only partially) fixed despite not being acknowledged as a vulnerability by Microsoft.

The author, on itm4n.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The installer used the current user's environment to build a path but then wrote it to the SYSTEM account's registry because the process was running as SYSTEM.

Impact

A local user with no admin rights could elevate their privileges to SYSTEM, but the text notes that the path is no longer appended by the latest .NET Core installers, so the exploit may be limited to older versions.

What the attacker needed

Local user account; ability to run MSI files; vulnerable .NET Core SDK installer

The fix

The installer should not append user-controlled paths to the SYSTEM account's PATH; the text says it was partially fixed in later .NET Core installers.

How it was found

  1. Install Visual Studio Community 2019 and select the .Net desktop development component.
  2. Observe that the .Net Core toolset installation modifies the SYSTEM account's PATH environment variable.
  3. As a normal user, run the MSI file that installs the .Net Core toolset using msiexec with the /qn /a options.
  4. Observe that the user's .dotnet\tools folder is appended to the SYSTEM account's PATH.
  5. Plant a DLL in that folder and wait for a service to load it, achieving code execution as SYSTEM.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a program runs as the SYSTEM account, it has the highest privileges on a Windows computer. The installer for the .NET Core SDK mistakenly added a folder that a normal user can write to into SYSTEM's list of places to look for programs (the PATH). This meant a normal user could put a malicious file in that folder, and when SYSTEM later ran a program, it would load the malicious file and give the user SYSTEM-level control.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.