Skip to content

phpMyFAQ SQL injections at insertentry & saveentry

High severity GitHub Reviewed Published Mar 25, 2024 in thorsten/phpMyFAQ • Updated Mar 25, 2024

Package

composer phpmyfaq/phpmyfaq (Composer)

Affected versions

= 3.2.5

Patched versions

3.2.6

Description

Summary

A SQL injection vulnerability has been discovered in the insertentry & saveentry when modifying records due to improper escaping of the email address. This allows any authenticated user with the rights to add/edit FAQ news to exploit this vulnerability to exfiltrate data, take over accounts and in some cases, even achieve RCE.

PoC 1 - SQL Injection at insertentry:

  1. Browse to “/admin/?action=editentry”, edit record and save. Intercept the POST request to "/admin/?action=insertentry" and modify the email and notes parameters in the body to the payloads below:
    a. email=test'/*@email.com
    b. notes=*/,1,1,1,1,null,1);select+pg_sleep(5)--

  2. Send the request and notice the pg_sleep(5) command is executed with a time delay of 5 seconds in the response. This verifies that the SQL injection vulnerability exists.
    image

PoC 2 - SQL Injection at saveentry

  1. Browse to “/admin/?action=editentry”, edit record and save. Intercept the POST request to "/admin/?action=saveentry" and modify the email and notes parameters in the body to the payloads below:
    a. email=test'/*@email.com
    b. */,notes=(select+pg_sleep(5))--
  2. Send the request and notice the pg_sleep(5) command is executed with a time delay of 5 seconds in the response. This verifies that the SQL injection vulnerability exists.
    image

Impact

The SQL injection vulnerability discovered allows authenticated users with appropriate privileges to execute malicious SQL queries, potentially leading to data exfiltration, account takeover, and even remote code execution. Attackers can exploit the vulnerability to read sensitive data from the database, such as user credentials and system files, compromising the confidentiality and integrity of the system. Moreover, successful exploitation may enable attackers to gain unauthorized access to user accounts or execute arbitrary commands on the server, impacting both system administrators and end users.

References

@thorsten thorsten published to thorsten/phpMyFAQ Mar 25, 2024
Published by the National Vulnerability Database Mar 25, 2024
Published to the GitHub Advisory Database Mar 25, 2024
Reviewed Mar 25, 2024
Last updated Mar 25, 2024

Severity

High

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
Unchanged
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:U/C:H/I:H/A:H

EPSS score

0.043%
(10th percentile)

Weaknesses

CVE ID

CVE-2024-28107

GHSA ID

GHSA-2grw-mc9r-822r

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.