CVE-2026-34973: Thorsten/phpmyfaq PhpMyFAQ Has A LIKE Wildcard Vulnerability

MODERATE
Advisory Identifier: GHSA-gcp9-5jc8-976x
CVSS 5.3
CWE-943
Published
Advisory Summary

CVE-2026-34973 is a MODERATE (CVSS 5.3) phpmyfaq has a like wildcard vulnerability (CWE-943: Improper Neutralization of Special Elements in Data Query Logic) affecting Thorsten/phpmyfaq libraries in the Packagist ecosystem. The issue involves phpmyfaq has a like wildcard injection in search.php — unescaped % and _ metacharacters enable broad content disclosure. Remediation is available by upgrading affected packages to version 4.1.1.

CVE-2026-34973 at a Glance

CVE Identifier CVE-2026-34973
GHSA Identifier GHSA-gcp9-5jc8-976x
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-943: Improper Neutralization of Special Elements in Data Query Logic
Affected Product Thorsten/phpmyfaq
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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

How to Fix CVE-2026-34973

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.1.1
Upgrade thorsten/phpmyfaq to 4.1.1
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-2026-34973, 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.1.1), 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-943: Improper Neutralization of Special Elements in Data Query Logic, where the product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. 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 The `searchCustomPages()` method in `phpmyfaq/src/phpMyFAQ/Search.php` uses `real_escape_string()` (via `escape()`) to sanitize the search term before embedding it in LIKE clauses. However, `real_escape_string()` does **not** escape SQL LIKE metacharacters `%` (match any sequence) and `_` (match any single character). An unauthenticated attacker can inject these wildcards into search queries, causing them to match unintended records — including content that was not meant to be surfaced — resulting in information disclosure. ### Details **File:** `phpmyfaq/src/phpMyFAQ/Search.php`, lines 226–240 **Vulnerable code:** ```php $escapedSearchTerm = $this->configuration->getDb()->escape($searchTerm); $searchWords = explode(' ', $escapedSearchTerm); $searchConditions = []; foreach ($searchWords as $word) { if (strlen($word) <= 2) { continue; } $searchConditions[] = sprintf( "(page_title LIKE '%%%s%%' OR content LIKE '%%%s%%')", $word, $word ); } ``` `escape()` calls `mysqli::real_escape_string()`, which escapes characters like `'`, `\`, `NULL`, etc. — but explicitly does **not** escape `%` or `_`, as these are not SQL string delimiters. They are, however, LIKE pattern wildcards. **Attack vector:** A user submits a search term containing `_` or `%` as part of a 3+ character word (to bypass the `strlen <= 2` filter). Examples: - Search for `a_b` → LIKE becomes `'%a_b%'` → `_` matches any single character, e.g. matches `"aXb"`, `"a1b"`, `"azb"` — broader than the literal string `a_b` - Search for `te%t` → LIKE becomes `'%te%t%'` → matches `test`, `text`, `te12t`, etc. - Search for `_%_` → LIKE becomes `'%_%_%'` → matches any record with at least one character, effectively dumping all custom pages This allows an attacker to retrieve custom page content that would not appear in normal exact searches, bypassing intended search scope restrictions. ### PoC 1. Navigate to the phpMyFAQ search page (accessible to unauthenticated users by default). 2. Submit a search query: `_%_` (underscore, percent, underscore — length 3, bypasses the `<= 2` filter). 3. The backend executes: `WHERE (page_title LIKE '%_%_%' OR content LIKE '%_%_%')` 4. This matches **all** custom pages with at least one character in title or content — returning content that would not appear for a specific search term. ### Impact - **Authentication required:** None — search is publicly accessible - **Affected component:** `searchCustomPages()` in `Search.php`; custom pages (faqcustompages table) - **Impact:** Unauthenticated users can enumerate/disclose all custom page content regardless of the intended search term filter - **Fix:** Escape `%` and `_` in LIKE search terms before interpolation: ```php $word = str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $word); ``` Or use parameterized queries with properly escaped LIKE values.

CVE-2026-34973 Affected Thorsten/phpmyfaq Versions

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

References

Frequently Asked Questions

What is CVE-2026-34973?
CVE-2026-34973 is a security vulnerability in Thorsten/phpmyfaq involving phpMyFAQ has a LIKE Wildcard Injection in Search.php — Unescaped % and _ Metacharacters Enable Broad Content Disclosure under CWE-943: Improper Neutralization of Special Elements in Data Query Logic.
Which Thorsten/phpmyfaq versions are affected?
Affected versions include releases prior to 4.1.1 across affected packages: thorsten/phpmyfaq.
What version fixes CVE-2026-34973?
Upgrading to 4.1.1 (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.1.1. Upgrade your dependency to 4.1.1 or later.
What is the CVSS score of CVE-2026-34973?
CVE-2026-34973 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-34973?
CVE-2026-34973 is classified under CWE-943: Improper Neutralization of Special Elements in Data Query Logic (The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query.).
How can I check Packagist dependencies for CVE-2026-34973?
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-gcp9-5jc8-976x",
  "modified" : "2026-04-06T23:17:56Z",
  "published" : "2026-04-01T23:41:49Z",
  "aliases" : [ "CVE-2026-34973" ],
  "summary" : "phpMyFAQ has a LIKE Wildcard Injection in Search.php — Unescaped % and _ Metacharacters Enable Broad Content Disclosure",
  "details" : "### Summary\n\nThe `searchCustomPages()` method in `phpmyfaq/src/phpMyFAQ/Search.php` uses `real_escape_string()` (via `escape()`) to sanitize the search term before embedding it in LIKE clauses. However, `real_escape_string()` does **not** escape SQL LIKE metacharacters `%` (match any sequence) and `_` (match any single character). An unauthenticated attacker can inject these wildcards into search queries, causing them to match unintended records — including content that was not meant to be surfaced — resulting in information disclosure.\n\n### Details\n\n**File:** `phpmyfaq/src/phpMyFAQ/Search.php`, lines 226–240\n\n**Vulnerable code:**\n```php\n$escapedSearchTerm = $this->configuration->getDb()->escape($searchTerm);\n$searchWords = explode(' ', $escapedSearchTerm);\n$searchConditions = [];\n\nforeach ($searchWords as $word) {\n    if (strlen($word) <= 2) {\n        continue;\n    }\n    $searchConditions[] = sprintf(\n        \"(page_title LIKE '%%%s%%' OR content LIKE '%%%s%%')\",\n        $word,\n        $word\n    );\n}\n```\n\n`escape()` calls `mysqli::real_escape_string()`, which escapes characters like `'`, `\\`, `NULL`, etc. — but explicitly does **not** escape `%` or `_`, as these are not SQL string delimiters. They are, however, LIKE pattern wildcards.\n\n**Attack vector:**\n\nA user submits a search term containing `_` or `%` as part of a 3+ character word (to bypass the `strlen <= 2` filter). Examples:\n\n- Search for `a_b` → LIKE becomes `'%a_b%'` → `_` matches any single character, e.g. matches `\"aXb\"`, `\"a1b\"`, `\"azb\"` — broader than the literal string `a_b`\n- Search for `te%t` → LIKE becomes `'%te%t%'` → matches `test`, `text`, `te12t`, etc.\n- Search for `_%_` → LIKE becomes `'%_%_%'` → matches any record with at least one character, effectively dumping all custom pages\n\nThis allows an attacker to retrieve custom page content that would not appear in normal exact searches, bypassing intended search scope restrictions.\n\n### PoC\n\n1. Navigate to the phpMyFAQ search page (accessible to unauthenticated users by default).\n2. Submit a search query: `_%_` (underscore, percent, underscore — length 3, bypasses the `<= 2` filter).\n3. The backend executes: `WHERE (page_title LIKE '%_%_%' OR content LIKE '%_%_%')`\n4. This matches **all** custom pages with at least one character in title or content — returning content that would not appear for a specific search term.\n\n### Impact\n\n- **Authentication required:** None — search is publicly accessible\n- **Affected component:** `searchCustomPages()` in `Search.php`; custom pages (faqcustompages table)\n- **Impact:** Unauthenticated users can enumerate/disclose all custom page content regardless of the intended search term filter\n- **Fix:** Escape `%` and `_` in LIKE search terms before interpolation:\n  ```php\n  $word = str_replace(['\\\\', '%', '_'], ['\\\\\\\\', '\\\\%', '\\\\_'], $word);\n  ```\n  Or use parameterized queries with properly escaped LIKE values.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "thorsten/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-gcp9-5jc8-976x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-34973"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/thorsten/phpMyFAQ"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/releases/tag/4.1.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-943" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-01T23:41:49Z",
    "nvd_published_at" : "2026-04-02T15:16:51Z"
  }
}