Отправить #1062349: SourceCodester Online Food Ordering System 1.0 SQL InjectionИнформация

НазваниеSourceCodester Online Food Ordering System 1.0 SQL Injection
Описание# [G07] The password-change page interpolates the request ID into SQL **Assessment:** Confirmed by source audit; reported by the final Agent run. **Vulnerability type:** SQL Injection (CWE-89). ## Description The password-change page inserts `GET id` directly into its initial account lookup. This query runs while rendering the page, before the current-password comparison. The same raw ID is later reused in the password `UPDATE`. ## Source evidence and analysis Repository root: `targets/web-scan-20261028/web/`. `admin/change_pwd.php` (lines 4–11) reads and queries the unvalidated ID: ```php if (isset($_GET['id'])) { $id = $_GET['id']; } $sql = "select * from tbl_admin where id=$id"; $res = mysqli_query($conn, $sql); $fetch = mysqli_fetch_assoc($res); ``` Only the later POST flow checks the old password (lines 13–19). The update uses the same raw ID (lines 25–33): ```php if ($password === $current_password) { ... $update = "update tbl_admin SET password = '$newPassword' where id= $id; "; $execute = mysqli_query($conn, $update); } ``` The current-password check does not protect the earlier `SELECT`; a request can alter that query before any password is submitted. The update also remains injectable, although successfully reaching that branch additionally requires the current-password comparison to pass. ## Reproduction (local instance only) Use a test database with an administrator row. The request is read-only and changes the predicate to select a row despite the nonexistent ID: ```bash BASE=http://127.0.0.1:8080 curl -i "$BASE/admin/change_pwd.php?id=0%20OR%201=1" ``` The page can render the selected username in its response before any current password has been supplied. Do not submit a password-change POST for this proof. ## Impact and scope The initial query permits SQL predicate manipulation and can expose the selected administrator's username through the page. The code does not display the password hash in the response. A password update is not established by this proof and still checks the current password; do not describe this issue as an unconditional password reset. The shared admin guard is also non-terminating (G01). ## Recommended fix Bind a validated integer ID in a prepared `SELECT` and `UPDATE`. Authorize the current administrator against the target account rather than trusting a caller-selected ID, and retain a correctly verified current-password check for password changes.
Пользователь
 Goku (UID 80486)
Представление28.10.2026 13:25 (29 дни назад)
Модерация26.11.2026 01:58 (29 days later)
Статуспринято
Запись VulDB444130 [SourceCodester Online Food Ordering System 1.0 admin/change_pwd.php id SQL-инъекция]
Баллы20

Do you need the next level of professionalism?

Upgrade your account now!