| 제목 | 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. PM 12:10 (1 월 ago) |
|---|
| 모더레이션 | 2026. 05. 31. AM 09:01 (24 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 367487 [code-projects Online Hospital Management System 1.php login_1.php login_user 사용자 이름 SQL 주입] |
|---|
| 포인트들 | 20 |
|---|