Copy As Curl(Windows) Lead to Code Execution in Linux
Firefox's 'Copy as cURL (Windows)' feature did not properly escape newline characters in request body parameters, so a crafted request body could inject shell commands. An attacker could get a victim to copy such a request and paste it into a bash shell, causing the injected command to run on the victim's Linux machine.
Originally disclosed on Mozilla
- Fixed in 59 days
- Paid in 59 days
- Disclosed after 59 days
Created attachment 9467893
firefox-copyascurl(windows).mp4
Hi team, Firefox latest version lead to Code Execution on linux machine using copy as curl(windows) feature
The body parameters was not properly sanitized leads to code execution on linux environment
Steps to reproduce
1. Send the request with malicious code in the body
2. Now from network tab copy the request as curl (windows)
3. paste it in bash shell and you can find the whoami command executed
Malcious request
'''js
fetch("https://example.com/postit", {
credentials: "omit",
headers: {
"Accept-Language": "en-US",
"Content-Type": "text/plain",
},
body: "query=evil\n\nwhoami",
method: "POST",
});
'''
My another vice versa issue reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1949994
Note: Chrome is not vulnerable for this, I have showed this in poc video too.
This should be prevented similar to chrome to avoid accidental code execution on linux while working with multiple environment
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
Impact
A victim who copies a crafted request as cURL (Windows) and pastes it into bash could have arbitrary commands executed on their Linux machine; Chrome was not affected.
What the attacker needed
Victim uses Firefox; victim copies request as cURL (Windows); victim pastes it into bash on Linux
The fix
The feature should escape body parameters the way Chrome does, so pasted commands cannot break out into extra shell commands.
How it was found
- Send a request whose body contains a line break followed by a shell command.
- In the network tab, copy the request as cURL (Windows).
- Paste the copied command into a bash shell and observe the command executing.
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 cURL command, the browser builds a text command you can paste into a terminal. If the request body contains special characters like line breaks, and the browser does not escape them, the pasted command can contain extra shell commands. Here a request body with a line break followed by a command caused that command to run when pasted into bash.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.