Submit #1062385: SourceCodester Online Food Ordering System 1.0 Client-Side Parameter Tampering of Trusted Datainfo

TitleSourceCodester Online Food Ordering System 1.0 Client-Side Parameter Tampering of Trusted Data
Description# [G19≈] Order totals are calculated from a client-controlled hidden price **Assessment:** Confirmed by source audit; missed by the final Agent report and absent from the YASA candidate set. **Vulnerability type:** Client-Side Parameter Tampering of Trusted Data (CWE-472). ## Description The order form displays a product price from the database and copies it into a hidden form field. On submission, the server trusts the submitted `price`, converts it with `floatval()`, and calculates the total from that client-controlled value. The server does not reload the product's authoritative price before creating the order. ## Source evidence and analysis Repository root: `targets/web-scan-20261028/web/`. During POST processing, `order.php` reads and uses the submitted price (lines 5–15): ```php $qty = mysqli_real_escape_string($conn, intval($_POST['qty'])); $price = mysqli_real_escape_string($conn, floatval($_POST['price'])); $title = mysqli_real_escape_string($conn, htmlspecialchars($_POST['title'])); $total = $price * $qty; ``` The result is written using a prepared statement (lines 20–22), which protects SQL syntax but persists the already-tampered value: ```php $stmt = $conn->prepare("INSERT INTO tbl_order (food, price, qty, total, order_date, status, customer_name, customer_contact, customer_email, customer_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->bind_param("sdidssssss", $title, $price, $qty, $total, $date, $status, $full_name, $contact, $email, $address); ``` The form makes the price a client-controlled hidden field (`order.php`, lines 125–127): ```php <input type="hidden" name="price" value="<?php echo $fetch['price'] ?>"> <input type="hidden" name="title" value="<?php echo $fetch['title'] ?>"> ``` Hidden fields are part of the HTTP request and can be edited by a user or proxy. The server uses the value directly rather than looking up `tbl_food.price` using a validated product ID. `floatval()` converts a value; it does not establish that the value matches the database price. ## Reproduction (disposable local instance only) Use an existing test food item and a local test database. Submit an order with a price below the product's displayed database price: ```bash BASE=http://127.0.0.1:8080 curl -i -X POST "$BASE/order.php?id=12" \ --data-urlencode 'submit=1' \ --data-urlencode 'full-name=Test User' \ --data-urlencode 'contact=5550100' \ --data-urlencode '[email protected]' \ --data-urlencode 'address=Test Address' \ --data-urlencode 'qty=1' \ --data-urlencode 'title=Test Food' \ --data-urlencode 'price=0.01' ``` Replace `12` with a test food ID. Inspect the disposable `tbl_order` row: `price` and `total` are based on `0.01`, even if the product's database price is higher. Delete the test order afterward. Do not test a real checkout or fulfillment system. ## Impact and scope A customer can create an order record with an underpriced amount, corrupting order and accounting data. If downstream staff or automation fulfill orders based on these stored totals, this can result in financial loss. The source proves the integrity flaw; actual financial impact depends on how orders are reviewed and fulfilled. ## Recommended fix Submit a product ID and quantity, not a trusted price. On the server, load the product and current price from the database using a prepared statement, validate that the item is orderable, compute the total from that value, and persist the server-calculated fields. Treat any client-supplied title/price as display-only and ignore them during order creation.
Source⚠️ https://gist.github.com/Ka7arotto/c74ecc431ff3df8150a66bd3063113c5/edit
User
 Goku (UID 80486)
Submission10/28/2026 13:42 (29 days ago)
Moderation11/26/2026 09:36 (29 days later)
StatusDuplicate
VulDB entry426511 [SourceCodester Online Food Ordering System 1.0 order.php price/title client-side enforcement of server-side security]
Points0

Interested in the pricing of exploits?

See the underground prices here!