| タイトル | mahmoudai1 School Management System ecec9faaf2fb1a3c5cd096e063f8ef326d09cdfd SQL Injection |
|---|
| 説明 | An unauthenticated SQL injection vulnerability was found in the login handler of mahmoudai1 School Management System. The file loginServer.php forwards the POST parameter "id" to userModel::checkUserInDB() without sanitization. In modules/userModel.php line 353 the value is concatenated into the WHERE clause without surrounding quotes, which creates a numeric injection context.
The guard at line 350 is ineffective. It evaluates strpos($id, "'") twice instead of checking $password, and it only blocks the single quote character, which a numeric injection does not require.
A tautology followed by a MySQL comment sequence removes the password, accepted and isDeleted predicates, so an anonymous attacker reaches the authenticated branch without knowing any credential. The session then inherits the user_type of the first matching row of the users table, which may be an administrator.
Steps to reproduce:
1. Deploy the application and import oopse.sql. At least one row must exist in the users table; the seed data satisfies this condition.
2. Send POST /login.php with the body: id=1 OR 1=1#&password=x&login=1
3. The response contains "Redirecting..." and a session is created. The password predicate has been commented out.
The numeric context also provides a boolean oracle, because a successful and a failed authentication render different responses. Blind extraction example: id=1 AND (SELECT ASCII(SUBSTRING(password,1,1)) FROM users LIMIT 1)=36#&password=x&login=1
Note: line 371 assigns the raw payload string to $_SESSION['loggedId'], so pages that reuse this value in their own queries behave unpredictably. The authentication bypass itself and the blind extraction channel are both reliable.
Suggested CVSS: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N (8.2)
Suggested fix: cast the id parameter to an integer or use a prepared statement with a bound parameter, and validate the password field rather than the id field.
|
|---|
| ソース | ⚠️ https://github.com/mahmoudai1/school-management-system/issues/1 |
|---|
| ユーザー | LinJ (UID 102009) |
|---|
| 送信 | 2026年10月28日 10:10 (28 日 ago) |
|---|
| モデレーション | 2026年11月25日 18:40 (28 days later) |
|---|
| ステータス | 承諾済み |
|---|
| VulDBエントリ | 443968 [mahmoudai1 school-management-system 迄 ecec9faaf2fb1a3c5cd096e063f8ef326d09cdfd Login loginServer.php userModel::checkUserInDB id SQLインジェクション] |
|---|
| ポイント | 20 |
|---|