| Title | KusalkaSilva Learning-Management-System ffeb873f8803f1e9664384ff75000c7da45466d2 SQL Injection |
|---|
| Description | The affected component is `login.php` (repository root). The endpoint reads `$_POST['username']` and `$_POST['password']` and concatenates them directly into two authentication queries, one against the `student` table and one against the `teacher` table:
```php
$username = $_POST['username'];
$password = $_POST['password'];
/* student */
$query = "SELECT * FROM student WHERE username='$username' AND password='$password'";
$result = mysql_query($query)or die(mysql_error());
...
/* teacher */
$query_teacher = mysql_query("SELECT * FROM teacher WHERE username='$username' AND password='$password'")or die(mysql_error());
```
No authentication, escaping, or parameterization is applied. An unauthenticated attacker can inject `' OR 1=1 -- -` into `username` to make the WHERE clause always true; the first row of the `student` table is then loaded and `$_SESSION['id']` is set to that student's id, so the attacker is logged in as an arbitrary existing user without knowing any password. Because the raw database error is printed with `or die(mysql_error())`, the same endpoint also works as an error-based SQL injection primitive (e.g. `UPDATEXML`/`CONCAT` payloads leak arbitrary column values such as the stored plaintext passwords). Combined with the plaintext password storage of this application, a single unauthenticated request is enough to take over any student or teacher account. |
|---|
| Source | ⚠️ https://github.com/KusalkaSilva/Learning-Management-System/issues/1 |
|---|
| User | yinian328 (UID 101459) |
|---|
| Submission | 09/20/2026 17:19 (16 days ago) |
|---|
| Moderation | 10/06/2026 07:49 (16 days later) |
|---|
| Status | Accepted |
|---|
| VulDB entry | 413892 [Kusalkasilva Learning-Management-System up to ffeb873f8803f1e9664384ff75000c7da45466d2 Login Endpoint login.php mysql_error username/password sql injection] |
|---|
| Points | 20 |
|---|