Gửi #1062347: SourceCodester Online Food Ordering System 1.0 SQL Injectionthông tin

tiêu đềSourceCodester Online Food Ordering System 1.0 SQL Injection
Mô tả## Description The administrator creation handler trims the submitted username and inserts it directly into a `SELECT` used for the duplicate-account check. Trimming removes surrounding whitespace but does not escape quotes or bind the value. An attacker can change the query predicate and observe the result through the “username already exists” versus success/error branches. ## Source evidence and analysis Repository root: `targets/web-scan-20261028/web/`. `admin/add_admin.php` (lines 7–8 and 22–27): ```php $fullname = trim($_POST['fullname']); $username = trim($_POST['username']); ... $password_hash = md5($password_raw); $user = "select * from tbl_admin where username = '$username'"; $execute = mysqli_query($conn, $user); $count = mysqli_num_rows($execute); if ($count === 0) { ``` This is a source-to-sink path from `$_POST['username']` to SQL syntax with no SQL-specific protection. Later, the `INSERT` escapes `fullname` and `username` at lines 29–35. That later escaping does not protect the earlier duplicate-check `SELECT`; the two queries must be assessed separately. ## Reproduction (disposable local instance only) Use a disposable test database containing at least one administrator. The payload changes the predicate to true, so the handler takes the “username already exists” branch: ```bash BASE=http://127.0.0.1:8080 curl -i -X POST "$BASE/admin/add_admin.php" \ --data-urlencode 'submit=1' \ --data-urlencode 'fullname=Probe User' \ --data-urlencode "username=probe' OR '1'='1' -- " \ --data-urlencode 'password=TestPass1!' ``` The password satisfies the handler's uppercase/lowercase/digit/symbol checks. Inspect the response for the duplicate-name branch. Do not use an existing account or production database. ## Impact and scope The caller controls a database predicate and can infer its truth through the account-creation branch. With suitable conditional expressions, that response can act as a boolean oracle against data visible to the database connection; this handler does not directly print the selected rows, so this report does not claim direct table dumping. The shared authentication guard also fails to stop unauthenticated execution (G01), which increases reachability. ## Recommended fix Use a prepared statement for the duplicate check and enforce a unique database constraint on `username`; treat a duplicate-key result as the authoritative outcome. Keep the existing insert parameterized as well. Authentication must be enforced independently of these SQL controls.
Nguồn⚠️ https://gist.github.com/Ka7arotto/c74ecc431ff3df8150a66bd3063113c5
Người dùng
 Goku (UID 80486)
Đệ trình28/10/2026 13:19 (cách đây 29 ngày)
Kiểm duyệt26/11/2026 01:58 (29 days later)
Trạng tháiđược chấp nhận
Mục VulDB444128 [SourceCodester Online Food Ordering System 1.0 Admin Panel admin/add_admin.php username Tiêm SQL]
điểm20

Interested in the pricing of exploits?

See the underground prices here!