| Titre | code-projects Online Hospital Management System April 15, 2026 SQL Injection |
|---|
| Description | In `login_1.php`, there is a critical SQL injection vulnerability in the Online Hospital Management System. The controllable parameter is `username` (sent via HTTP POST method). This parameter is directly concatenated into a SELECT SQL query without any sanitization or parameterized query protection. Because `login_1.php` is the login handler and does not require prior authentication, the vulnerability can be triggered by **any unauthenticated remote attacker**. A malicious attacker can bypass authentication entirely, log in as any user (including administrators), or extract sensitive data from the database using UNION or blind SQL injection techniques.
**Code analysis**
The vulnerable code resides on line 10 of `login_1.php`:
php
```
$username=$_POST['username'];
$password=$_POST['password'];
$user=$_POST['user'];
$sql="select * from login_user where username='$username'";
$query=mysqli_query($db,$sql);
```
The `$_POST['username']` value is taken directly from the login form and inserted into the SQL query string without any escaping or use of a prepared statement. The application then checks if a row is returned and subsequently validates the password and user role in PHP. However, an attacker can inject malicious SQL code into the `username` field to manipulate the query's logic or retrieve arbitrary data. |
|---|
| La source | ⚠️ https://github.com/Mi0uno/Online-Hospital-Management-System-has-SQL-Injection |
|---|
| Utilisateur | mi0034 (UID 80111) |
|---|
| Soumission | 07/05/2026 12:10 (il y a 28 jours) |
|---|
| Modérer | 31/05/2026 09:01 (24 days later) |
|---|
| Statut | Accepté |
|---|
| Entrée VulDB | 367487 [code-projects Online Hospital Management System 1.php login_1.php login_user Nom d'utilisateur injection SQL] |
|---|
| Points | 20 |
|---|