Skip to content
RCE Write-up Advanced

Visual Studio Copilot and SSMS Remote Code Execution (CVE-2026-103572)

A path validation check in Copilot for Visual Studio and SQL Server Management Studio could be bypassed by appending a trailing dot to protected configuration filenames, letting the agent write to its own settings. An attacker could then use indirect prompt injection to make Copilot modify settings that launch arbitrary commands, achieving remote code execution.

embracethered.com

Published on embracethered.com

Today Microsoft shipped the patch for a vulnerability in Visual Studio Copilot that I reported in August. Microsoft classified it as Important severity Remote Code Execution vulnerability.

The author, on embracethered.com

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 protected-filename check compared raw strings without normalising the path, so a trailing dot made the name look different while Windows still wrote to the protected file.

Impact

An attacker able to influence Copilot's input could cause arbitrary command execution on the user's machine; the author also notes the model showed poor resilience to indirect prompt injection.

What the attacker needed

Copilot in Visual Studio or SSMS; attacker-controlled content reaches Copilot; user interacts with the crafted content

The fix

The fix adds a call to GetFullPath so the filename is normalised and trailing dots and relative components are resolved before the check.

How it was found

  1. Craft content that misaligns the Copilot model, for example a file the user asks it to explain.
  2. Instruct Copilot to create or modify a settings file whose name ends with a dot.
  3. Set a setting such as the ripgrep path to an arbitrary executable.
  4. Trigger the action that uses that setting, such as a grep search, so the executable runs.

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.

Windows quietly ignores a dot at the end of a file name, so a file called settings.json. is really settings.json. The Copilot assistant tried to block edits to certain important settings files by comparing names, but it did not account for that trailing dot. A tricked assistant could therefore change its own settings and make the computer run a program of the attacker's choosing.

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.