Skip to content
RCE Advisory Intermediate

GHSL-2020-145: Command injection on Windows in Opener

On Windows, the Opener library uses cmd.exe to open URLs and only escapes the & character, not the ^ character. An attacker who controls part of a URL passed to Opener could inject shell commands, leading to remote code execution.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

A typical usage of Opener is to open a url such as https://google.com. Opener will launch a browser and open that page.

ghsecuritylab, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The library only escapes the & character but not the ^ character when passing arguments to cmd.exe on Windows, allowing command injection.

Impact

On Windows, this issue may lead to remote code execution if a client of the library calls the vulnerable method with untrusted input; other platforms are not vulnerable.

What the attacker needed

Windows operating system; client uses Opener with untrusted input

The fix

The fix was to escape both & and ^ characters when passing arguments to cmd.exe on Windows.

How it was found

  1. A client application uses the Opener library to open a URL that includes attacker-controlled input.
  2. The attacker supplies a value containing ^& followed by a command.
  3. On Windows, Opener passes the URL to cmd.exe without escaping the ^ character.
  4. The ^ escapes the following &, so cmd.exe interprets the rest as a separate command and executes it.

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 report has not been written yet. The Original tab links to the source.

Opener is a small program that opens web links for you. On Windows it uses the command prompt (cmd.exe) to do this, and it tries to block dangerous characters like & but forgets about ^. If a bad person can put a ^ into a link that a program opens, they can make the computer run other commands, like launching the calculator.

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 ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

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.