| tiêu đề | ONLINE_FOOD_ORDER_SYSTEM - Stored XSS Vulnerability in edit_food_items.php v1 Stored XSS |
|---|
| Mô tả | ## ONLINE_FOOD_ORDER_SYSTEM - Stored XSS Vulnerability in edit_food_items.php
### Vulnerability Description
A stored Cross-Site Scripting (XSS) vulnerability exists in the `edit_food_items.php` file of the ONLINE_FOOD_ORDER_SYSTEM. The `dname` parameter is directly inserted into the database without any sanitization, and subsequently output to the HTML page without escaping, allowing arbitrary JavaScript execution.
### Impact
An attacker can inject malicious JavaScript code via the `dname` parameter, which gets stored in the database and executed in the browser of any user viewing the affected pages. This can lead to cookie theft and session hijacking.
### Code Analysis
**edit_food_items.php (Lines 130-148):**
```php
if (isset($_GET['submit'])) {
$name = $_GET['dname']; // No sanitization
$price = $_GET['dprice'];
$description = $_GET['ddescription'];
// Directly concatenated into SQL UPDATE
$query = mysqli_query($conn, "UPDATE food set
name='$name', price='$price',
description='$description' where F_ID='$F_ID'");
}
// Output from database directly into HTML without htmlspecialchars()
$query = mysqli_query($conn, "SELECT * FROM food f WHERE ...");
while ($row = mysqli_fetch_array($query)) {
echo "<b><a href='edit_food_items.php?update= {$row['F_ID']}'>"
. "{$row['name']}" // Malicious code rendered directly
. "</a></b>";
}
```
### Payload
```
<sCrIpT>alert(9999)</ScRiPt>
```
### Source Download
https://code-projects.org/online-food-order-system-in-php-with-source-code/ |
|---|
| Nguồn | ⚠️ https://github.com/zzzxc643/CVE1/blob/main/project1/vul6.md |
|---|
| Người dùng | SSL_Seven_Security Lab_WangZhiQiang_XiaoZiLong (UID 38936) |
|---|
| Đệ trình | 26/06/2026 16:17 (cách đây 2 các tháng) |
|---|
| Kiểm duyệt | 15/08/2026 07:08 (2 months later) |
|---|
| Trạng thái | được chấp nhận |
|---|
| Mục VulDB | 390166 [code-projects Online Food Order System 1.0 edit_food_items.php dname Tập lệnh chéo trang] |
|---|
| điểm | 20 |
|---|