Skip to content
RCE Write-up Advanced

PowerShell script, Unicode quotes and ウィンドウズ - a story of uncommon command injection

A hypothetical application that inserts user input into a dynamically generated PowerShell script while sanitising only typical ASCII quotes could be vulnerable to command injection via Unicode quote characters, though exploitation is not straightforward.

Krzysztof Andrusiak Follow

Published on blog.stmcyber.com

Author: Krzysztof Andrusiak, 14.09.2021

Krzysztof Andrusiak, on blog.stmcyber.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 escape function only sanitised ASCII quote characters, while PowerShell treats several Unicode quote characters as equivalent string delimiters, allowing an attacker to break out of the string.

Impact

Command injection into a PowerShell script could lead to remote code execution, but the text stresses it is not that easy.

What the attacker needed

Application builds PowerShell script from user input; Sanitisation covers only typical quotes; PowerShell treats Unicode quotes as delimiters

The fix

The sanitisation should account for Unicode quote characters that PowerShell treats as delimiters, not just typical quotes.

How it was found

  1. Identify that the application inserts user input into a dynamically generated PowerShell script and sanitises only ASCII quotes.
  2. Find a Unicode quote character that PowerShell accepts as a string delimiter.

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.

PowerShell treats some Unicode quote characters like normal quotes. An application that sanitises only typical quotes when building a PowerShell script could let an attacker break out of the string, though it is not easy.

What is RCE?

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

More by Krzysztof Andrusiak

View all

1 more disclosed report, best first.

More from Zoho (ManageEngine ADSelfService Plus)

View all

The newest disclosed reports for this program.

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.