Skip to content

Blind SQL Injection in ecard_send.php

Critical
Fasse published GHSA-69wx-xc6j-28v3 Jul 27, 2024

Package

admidio-4.x.y.zip (zip-file)

Affected versions

< 4.3.9

Patched versions

4.3.9

Description

Description:

An SQL Injection has been identified in the /adm_program/modules/ecards/ecard_send.php source file of the Admidio Application. The SQL Injection results in a compromise of the application's database. The value of ecard_recipients POST parameter is being directly concatenated with the SQL query in the source code causing the SQL Injection.

The SQL Injection can be exploited by a member user, using blind condition-based, time-based, and Out of band interaction SQL Injection payloads. I successfully exploited SQL Injections by causing Time Delays. Advancing the payload, I was able to exfiltrate data from the database based on trial and error conditions and step-wise enumerating the characters of the database name. This was done as a POC of SQL Injection. An attacker could simply drop the database by providing a single payload, steal data, and potentially update the database according to their will.

Impact:

SQL injection (SQLi) vulnerabilities can have serious consequences for the security of a web application and its underlying database. Attackers can use SQLi to access sensitive data, and modify, delete, or add data to the database. SQLi can also be potentially used to perform RCE.

Remediation:

Use parameterized queries or prepared statements instead of concatenating user input directly into SQL queries. Parameterized queries ensure that user input is treated as data and not executable queries.
OR
Sanitize the input before including it in the SQL Query.

Steps to Reproduce:

  • Intercept the POST request to /adm_program/modules/ecards/ecard_send.php, which is used to send photo as greeting card.
  • Change the value of ecard_recipients%5B%5D POST parameter to 2%2bsleep(10).
  • Sending the request will cause a time delay.

Proof Of Concept:

image
Figure 1: Code Vulnerable to SQL Injection

image
Figure 2: Code Vulnerable to SQL Injection

image
Figure 3: SQLi to trigger time delay

image
Figure 4: Data Exfiltration via Condition-based Time Delays

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2024-37906

Weaknesses

Credits