CVE-2026-34973: phpMyFAQ has a LIKE Wildcard Injection in Search.php — Unescaped % and _ Metacharacters Enable Broad Content Disclosure

Published Apr 1, 2026
·
Updated

Summary

The searchCustomPages() method in phpmyfaq/src/phpMyFAQ/Search.php uses realescapestring() (via escape()) to sanitize the search term before embedding it in LIKE clauses. However, realescapestring() 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( "(pagetitle LIKE '%%%s%%' OR content LIKE '%%%s%%')", $word, $word ); }

escape() calls mysqli::realescapestring(), 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 ab → LIKE becomes '%ab%' → matches any single character, e.g. matches "aXb", "a1b", "azb" — broader than the literal string ab - 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 (pagetitle 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 = strreplace(['\\', '%', ''], ['\\\\', '\\%', '\\'], $word); Or use parameterized queries with properly escaped LIKE values.

Other sources

phpMyFAQ is an open source FAQ web application. Prior to version 4.1.1, the searchCustomPages() method in phpmyfaq/src/phpMyFAQ/Search.php uses realescapestring() (via escape()) to sanitize the search term before embedding it in LIKE clauses. However, realescapestring() 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. This issue has been patched in version 4.1.1.

NVD

Affected Software

2 affected componentsFixes available
composer/thorsten/phpmyfaq<4.1.1
4.1.1
PhpMyFaq phpmyfaq=4.1.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/thorsten/phpmyfaq to a version that resolves this vulnerability.

    Fixed in 4.1.1
  2. Upgrade

    Upgrade phpMyFAQ to a version that resolves this vulnerability.

    Fixed in 4.1.1
  3. Configuration

    In searchCustomPages() in phpmyfaq/src/phpMyFAQ/Search.php, escape SQL LIKE metacharacters in the search term by converting % to \% and _ to \_ before using them in expressions like `page_title LIKE '%...%'` and `content LIKE '%...%'`. This prevents payloads such as `_%_` from turning into `'%_%_%'` and matching unintended records.

    phpMyFAQ/src/phpMyFAQ/Search.php (searchCustomPages) LIKE search term escaping = Escape LIKE metacharacters % and _ before interpolation into LIKE clauses (replace % with \% and _ with \_ in each search word)

Event History

Apr 1, 2026
Advisory Published
via GitHub·11:41 PM
Data Sourced
via GitHub·11:41 PM
DescriptionWeaknessAffected Software
Apr 2, 2026
CVE Published
via MITRE·02:47 PM
Data Sourced
via MITRE·02:47 PM
DescriptionWeakness
Data Sourced
via NVD·03:16 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203