Soumettre #1062348: SourceCodester Online Food Ordering System 1.0 SQL Injectioninformation

TitreSourceCodester Online Food Ordering System 1.0 SQL Injection
Description ## Description `admin/edit_admin.php` uses the query-string ID in an unparameterized `SELECT`, then places the submitted full name and username plus the ID into an `UPDATE`. The raw request values can alter the SQL expression and, in the POST path, the update predicate. ## Source evidence and analysis Repository root: `targets/web-scan-20261028/web/`. The selected ID is copied without validation and used as SQL syntax (`admin/edit_admin.php`, lines 3–9): ```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); ``` The POST handler also interpolates all three values (`admin/edit_admin.php`, lines 36–46): ```php $fullname = $_POST['fullname']; $username = $_POST['username']; $update = "update tbl_admin SET full_name = '$fullname', username = '$username' where id = $id; "; $execute = mysqli_query($conn, $update) or die(mysqli_error($conn)); ``` There is no prepared statement or SQL-context escaping on these values. The form's HTML input type is not a server-side constraint. The shared header's guard does not terminate unauthenticated requests (G01), so relying on that include does not make the SQL sink administrator-only. ## Reproduction (local instance only) With an administrator row in a disposable database, the following read-only request changes the lookup predicate and can return a row even though ID `0` does not exist: ```bash BASE=http://127.0.0.1:8080 curl -i "$BASE/admin/edit_admin.php?id=0%20OR%201=1" ``` The response populates the edit form with the selected administrator's visible name and username. Do not send a modifying POST to a live or shared database. To verify the UPDATE path, use a disposable database snapshot and submit test-only values with `submit=1`; inspect only the test row afterward. ## Impact and scope The GET sink allows row-selection manipulation and the POST sink can alter the SQL update expression or its `WHERE` clause. Depending on the injected expression and database privileges, this can expose or modify administrator records. The displayed form exposes names/usernames, not the password column; this source evidence does not by itself prove password hash disclosure. The non-terminating guard increases reachability but is separately reported in G01. ## Recommended fix Validate the identifier as a positive integer and bind it in both queries. Bind full name and username as string parameters in the `UPDATE`; do not rely on HTML validation or authentication to protect SQL syntax. Enforce administrator authorization before either query or mutation.
La source⚠️ https://gist.github.com/Ka7arotto/c74ecc431ff3df8150a66bd3063113c5
Utilisateur
 Goku (UID 80486)
Soumission28/10/2026 13:24 (il y a 29 jours)
Modérer26/11/2026 01:58 (29 days later)
StatutAccepté
Entrée VulDB444129 [SourceCodester Online Food Ordering System 1.0 admin/edit_admin.php id injection SQL]
Points20

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!