RCE @ arewefastyet
A PHP endpoint accepted a JSON field that was later concatenated into a shell command without sanitisation, so an attacker could append their own command and run it on the server. The report claims this gives remote code execution.
- Fixed in 4 hours
- Paid in 7 days
- Disclosed after 4 hours
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36
Steps to reproduce:
Found another RCE.
The RCE start at file retrigger.php:
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$machine_id = (int)$request->machine_id;
$mode_id = (int)$request->mode_id;
$revision = $request->revision;
$run_before_id = (int)$request->run_before_id;
$run_after_id = (int)$request->run_after_id;
$benchmarks = $request->benchmarks;
$retrigger = RetriggerController::fromMachine($machine_id, $mode_id);
$retrigger->convertToRevision($mode_id, $revision, $run_before_id, $run_after_id);
$retrigger->selectBenchmarks($benchmarks);
$retrigger->enqueueNow();
See the $revision param.
It goes to $retrigger->convertToRevision function.
@ lib/RetriggerController.php:->
public function convertToRevision($mode_id, $revision, $run_before_id, $run_after_id) {
$mode = new Mode($mode_id);
foreach ($this->tasks as $task) {
$task->update_modes(Array("jmim"/*$mode->mode()*/));
$task->setBuildRevision($revision);
$task->setSubmitterOutOfOrder("jmim"/*$mode->mode()*/, $revision, $run_before_id, $run_after_id);
}
}
The function pass it to $task->setSubmitterOutOfOrder
@lib/ManipulateTask.php
public function setSubmitterOutOfOrder($mode_name, $revision, $run_before_id, $run_after_id) {
$commands = BashInterpreter::matchCommand($this->task, "python submitter.py");
foreach ($commands as $command) {
if (count(BashInterpreter::matchFlag($command, "-c")) > 0 ||
count(BashInterpreter::matchFlag($command, "--create")) > 0)
{
$flag = "--revision ".$revision." ";
$flag .= "--mode ".$mode_name." ";
$flag .= "--run_before ".$run_before_id." ";
$flag .= "--run_after ".$run_after_id;
$this->task = BashInterpreter::addFlagToCommand($this->task, $command, $flag);
}
}
}
see the $revision on flag?, just add semicolon (;) and execute a new command :).
SORUCES @ https://github.com/mozilla/arewefastyet
arewefastyet - 63.245.208.0/20 0 (arewefastyet.com) - 63.245.223.14.
This is part of mozilla's CORE subnet. (arewefastyet.firefox.local)
Actual results:
RCE
Expected results:
Should not execute RCE
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 user-controlled input was concatenated into a shell command string without escaping or validation, allowing command injection.
Impact
An attacker could execute arbitrary commands on the server hosting the tool.
What the attacker needed
Network access to retrigger.php
How it was found
- Send a POST request to retrigger.php with a JSON body
- Include a revision value containing a shell separator and an extra command
- The revision is passed through convertToRevision to setSubmitterOutOfOrder
- The value is appended to a submitter command flag and executed by the shell
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.
The server builds a command line by gluing together text from the user. If the user's text contains a shell separator like a semicolon, the shell treats what follows as a second command and runs it too. That lets an attacker run their own programs on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.