| 标题 | code-projects Online Hospital Management System April 15, 2026 SQL Injection |
|---|
| 描述 | 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. |
|---|
| 来源 | ⚠️ https://github.com/Mi0uno/Online-Hospital-Management-System-has-SQL-Injection |
|---|
| 用户 | mi0034 (UID 80111) |
|---|
| 提交 | 2026-05-07 12時10分 (29 日前) |
|---|
| 管理 | 2026-05-31 09時01分 (24 days later) |
|---|
| 状态 | 已接受 |
|---|
| VulDB条目 | 367487 [code-projects Online Hospital Management System 1.php login_1.php login_user 用户名 SQL注入] |
|---|
| 积分 | 20 |
|---|