[Mac] Copy as powershell (on curl) leads to code execution on mac
Firefox's 'Copy as PowerShell' feature failed to escape the HTTP method when generating a curl command, so a malicious method containing shell metacharacters could inject commands. An attacker who tricks a user into copying a request as PowerShell and running it could achieve code execution on the user's machine.
Originally disclosed on Mozilla
- Fixed in 8 days
- Paid in 13 days
- Disclosed after 8 days
HI team, Firefox latest on mac is vulnerable for code execution, which allows the attacker to trick the user with malicious request to copy as powershell and run it on mac leads to code execution
Note: HTTP method is vulnerable part of the resultant curl.
FYI: we can install the powershell in mac via homebrew (instead of moving to windows, i have used this to run powershell command on mac) - Same possible on directly running in windows powershell too
Fetch Command: (run it on console)
fetch('',{method: '||whoami||'});
Steps to reproduce
1. run the above command in browser console (we can achieve this via html file itself)
2. copy the request as powershell
3. paste and run it on powershell
4. you can see the output of whoami command
Note: Issue tested on latest version of firefox
I will attached the poc video for reference shortly
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
What the attacker needed
Victim uses Firefox on Mac; victim copies request as PowerShell; victim runs the copied command
How it was found
- Run a fetch command in the browser console with a malicious HTTP method.
- Copy the request as PowerShell.
- Paste and run it in PowerShell.
- Observe the output of the injected command.
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 copy a network request as a PowerShell command, Firefox builds a command line that includes the request's HTTP method. If that method contains special characters, they can break out of the intended command and run extra commands. An attacker could make a request with a malicious method, and if you copy it and run it, their commands execute on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.