Skip to content
RCE Write-up Intermediate

Shift Happens – Uncovering Two Built-in Command Injections in Windows Context Menus

Two command injection vulnerabilities exist in the Windows Explorer 'Open PowerShell window here' context menu because user-controlled folder paths are inserted into a PowerShell command template without proper quoting. An attacker can create a folder with a crafted name so that when a user opens the context menu, arbitrary PowerShell commands execute.

Remi GASCOU Follow

Published on specterops.io

You can find the scenarios and the slides of the Insomni’hack 2026 talk in https://github.com/p0dalirius/Shift-Happens-Uncovering-to-builtin-command-injection-in-Windows-context-menus

Remi GASCOU, on specterops.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

Likely the command template in the registry inserts the user-controlled folder path (%V) into a PowerShell command without proper quoting or sanitisation, allowing command injection.

Impact

An attacker could achieve arbitrary command execution when a user opens the context menu on a specially named folder, but Microsoft stated it did not meet their criteria for an immediate security update, though it was later fixed in a Windows 11 Canary build.

What the attacker needed

Attacker can create a folder with a crafted name; victim uses Shift+right-click and selects the menu option

The fix

It was fixed in Windows 11 Canary build 10.0.27902.1000.

How it was found

  1. Create a folder with a name containing a semicolon and a command, such as 'folder; calc'.
  2. Hold Shift and right-click the folder.
  3. Select 'Open PowerShell window here' from the context menu.
  4. The injected command (e.g., calc) executes.

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 you right-click a folder in Windows and choose 'Open PowerShell window here', Windows builds a command that includes the folder's name. If the folder name contains special characters like a semicolon, those characters can break out of the intended command and run extra commands. An attacker who can create a folder with a tricky name could trick a user into running malicious code just by using that menu option.

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.