Skip to content
RCE Disclosed report Intermediate

Fetching binaries (for software installation) over HTTP without verification (RCE as ROOT by MITM)

The official installation script for Phabricator downloads binaries over plain HTTP and then runs or installs them with sudo without any checksum or signature verification. An attacker able to intercept the traffic, or a compromised or hijacked download server, could substitute malicious code that would then execute as root.

e3amn2l Follow

Originally disclosed on HackerOne

Bounty$300 View original
  • Fixed in 8 hours
  • Paid in 8 hours
  • Disclosed after 30 days

From: https://secure.phabricator.com/book/phabricator/article/installation_guide/

Installing Required Components If you are installing on Ubuntu or an RedHat derivative, there are install scripts available which should handle most of the things discussed in this document for you: RedHat Derivatives: install_rhel-derivs.sh Ubuntu: install_ubuntu.sh

The install_rhel-derivs.sh file download binaries over plain HTTP and run/install them using sudo without verification (checksum / GPG), thus:

  • active MITM attacker can modify the binaries with malicious code.
  • malformed target server infrastructure can deliver malicious code (server hacked/DNS hijacked/etc..)

The malicious code will run under ROOT.

for example in 1, a downloaded file over HTTP will be run as php using sudo (the script won't run without root/sudo rights) https://github.com/phacility/phabricator/blob/master/scripts/install/install_rhel-derivs.sh#L49-L58

echo "ERROR: You must be able to sudo to run this script, or run it as root.";

1. https://github.com/phacility/phabricator/blob/master/scripts/install/install_rhel-derivs.sh#L95

  echo "Attempting to install PEAR"
  wget http://pear.php.net/go-pear.phar
  $SUDO php go-pear.phar && $SUDO pecl install apc

2. https://github.com/phacility/phabricator/blob/master/scripts/install/install_rhel-derivs.sh#L68-L70

    echo "It doesn't look like you have the EPEL repo enabled. We are to add it"
    echo "for you, so that we can install git."
    $SUDO rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

fix:

1. use https:// instead of http:// (the used URLs support HTTPS) 2. implement verification (sha256 on static files, such as if specific version is used) & GPG on dynamic files (verify signatures of signed files, such as downloading latest version of software).

misc: safe word "mongoose" or mongoose to indicate that I read the rules.

The original report as published on HackerOne, by e3amn2l. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 installer fetches remote binaries over unencrypted HTTP and executes them with sudo without verifying a checksum or GPG signature.

Impact

An active man-in-the-middle attacker, or anyone who controls or hijacks the download server, could run arbitrary code as root on the installing host.

What the attacker needed

Attacker on the network path or control of server; administrator runs the install script

The fix

The script should use HTTPS and verify downloaded files with SHA-256 checksums for pinned versions and GPG signatures for dynamic downloads.

How it was found

  1. Run the install_rhel-derivs.sh script, which requires sudo or root.
  2. The script downloads a PEAR installer file over HTTP and runs it with sudo using php.
  3. The script also downloads an EPEL repository package over HTTP and installs it with sudo rpm.

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 a script downloads a file over plain HTTP, anyone sitting on the network path can swap the file for their own. This installer then runs those downloaded files with administrator rights, so the swapped file gets full control of the machine. Checking a file's fingerprint (a checksum) or a cryptographic signature would reveal that it had been changed.

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 e3amn2l

View all

8 more disclosed reports, best first.

More from Phabricator

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.