Summary
A SQL injection vulnerability has been discovered in the the "Add News" functionality 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.
Details
The vulnerable field lies in the authorEmail field which uses PHP's FILTER_VALIDATE_EMAIL filter. This filter is insufficient in protecting against SQL injection attacks and should still be properly escaped. However, in this version of phpMyFAQ (3.2.5), this field is not escaped properly can be used together with other fields to fully exploit the SQL injection vulnerability.
PoCs
4 PoCs are demonstrated here to illustrate the potential impacts.
PoC 1 - Postgres Time Based SQLi
- Login as admin or any user with the rights to view and save news.
- Navigate to "../phpmyfaq/admin/?action=news", click on "Add news", fill in some data, send and intercept the request.
- Modify the intercepted "/admin/?action=save-news" request to look like the SS below:
3.1 - Set the "authorEmail" field in the body to "test'/*@[email.com](http://email.com/)".
3.2 - Set the "linkTitle" field in the body to "*/,1,1,1,1,1,1,1);select+pg_sleep(5)--".
3.3 - Set the rest of the fields as empty and send the request. - Notice the 5s delay in the response time, indicating that the sleep function was executed, verifying the existence of the SQLi vulnerability.
PoC 2 - SQLi to Read Data from PostgresDB
- Steps 1 and 2 are the same as PoC 1.
- Modify the intercepted "/admin/?action=save-news" request to look like the SS below and send the request:
2.1 - Set the "authorEmail" field in the body to "test'/*@[email.com](http://email.com/)".
2.2 - Set the "linkTitle" field in the body to "*/,1,1,1,1,1,1,1);SELECT+remember_me+FROM+faquser+limit+1+offset+1%3b--".
PoC 3 - SQLi to Read Files from PostgresDB
- Steps 1 and 2 are the same as PoC 1.
- Modify the intercepted "/admin/?action=save-news" request to look like the SS below and send the request:
2.1 - Set the "authorEmail" field in the body to "test'/*@[email.com](http://email.com/)".
2.2 - Set the "linkTitle" field in the body to "*/,1,1,1,1,1,(select+pg_read_file(CONCAT(CHR(67),CHR(58),CHR(92),CHR(87),CHR(105),CHR(110),CHR(100),CHR(111),CHR(119),CHR(115),CHR(92),CHR(119),CHR(105),CHR(110),CHR(46),CHR(105),CHR(110),CHR(105)))),1)--". (the CONCAT() and CHR() functions are used to bypass the escaping of single quotes, these characters in its decoded form is "select pg_read_file('C:\Windows\win.ini')")
PoC 4 - SQLi to Shell
It is also possible to obtain a shell if superuser is enabled on the postgres DB. These are the high level steps of the exploit chain:
- Create a table called "cmd_exec" to store the payload.
- Create a function in postgres to store the command to write a web shell to the "../htdocs" directory. (This step is required as CONCAT() function cannot be used to bypass the step where; "COPY cmd_exec FROM PROGRAM '' " is run as it requires single quotes.)
- Trigger the function to write the PHP web shell at "
http://<URL>/shell.php" that takes in commands via the "?cmd=" parameter. - Send the Python reverse shell command via a GET request to launch the reverse shell.
The video demo and the Python PoC script can be accessed from this link: https://drive.google.com/drive/folders/1BFL8GHIBxSUxu0TneYf66KjFA0A4RZga?usp=sharing
Impact
The SQL injection vulnerability discovered in the "Add News" functionality of the application 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.
Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access. Typical impact: data disclosure or modification.
CVE-2024-27299 has a CVSS score of 8.8 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.2.6); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2024-27299? CVE-2024-27299 is a high-severity SQL injection vulnerability in phpmyfaq/phpmyfaq (composer), affecting versions = 3.2.5. It is fixed in 3.2.6. Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access.
- How severe is CVE-2024-27299? CVE-2024-27299 has a CVSS score of 8.8 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of phpmyfaq/phpmyfaq are affected by CVE-2024-27299? phpmyfaq/phpmyfaq (composer) versions = 3.2.5 is affected.
- Is there a fix for CVE-2024-27299? Yes. CVE-2024-27299 is fixed in 3.2.6. Upgrade to this version or later.
- Is CVE-2024-27299 exploitable, and should I be worried? Whether CVE-2024-27299 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-27299 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-27299? Upgrade
phpmyfaq/phpmyfaqto 3.2.6 or later.