| Título | code-projects Online Hospital Management System April 15, 2026 SQL Injection |
|---|
| Descripción | 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. |
|---|
| Fuente | ⚠️ https://github.com/Mi0uno/Online-Hospital-Management-System-has-SQL-Injection |
|---|
| Usuario | mi0034 (UID 80111) |
|---|
| Sumisión | 2026-05-07 12:10 (hace 28 días) |
|---|
| Moderación | 2026-05-31 09:01 (24 days later) |
|---|
| Estado | Aceptado |
|---|
| Entrada de VulDB | 367487 [code-projects Online Hospital Management System 1.php login_1.php login_user Nombre de usuario inyección SQL] |
|---|
| Puntos | 20 |
|---|