CVE-2026-34973: phpMyFAQ has a LIKE Wildcard Injection in Search.php — Unescaped % and _ Metacharacters Enable Broad Content Disclosure
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).
Published Apr 1, 2026 · Updated Apr 6, 2026
Affected packages
thorsten/phpmyfaq
- Ecosystem
- Composer (PHP)
- Affected
- < 4.1.1
- Fixed in
- 4.1.1
- Check
composer show thorsten/phpmyfaq
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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:
$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 stringa_b - Search for
te%t→ LIKE becomes'%te%t%'→ matchestest,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
- Navigate to the phpMyFAQ search page (accessible to unauthenticated users by default).
- Submit a search query:
_%_(underscore, percent, underscore — length 3, bypasses the<= 2filter). - The backend executes:
WHERE (page_title LIKE '%_%_%' OR content LIKE '%_%_%') - 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()inSearch.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.
Credited to athuljayaram.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-56736
phpMyFAQ has Stored XSS in Admin FAQ Editor via HTML Entity Bypass in Frontend FAQ Submission
high8.2Sep 24, 2026CVE-2026-56737
phpMyFAQ's two-factor authentication login bypasses the password factor
high8.1Sep 24, 2026CVE-2026-56738
phpMyFAQ has SQL Injection in `StopWords::add()` — Unescaped Stop Word Insertion
high8.5Sep 24, 2026GHSA-88g4-74f3-63x9
phpMyFAQ has Potential Authenticated Path Traversal in PDF Export
medium4.9Aug 25, 2026GHSA-mf8r-wm2w-f8c5
phpMyFAQ public FAQ APIs expose inactive FAQ content
medium5.3Aug 25, 2026GHSA-pg62-f8g4-4wqh
phpMyFAQ privilege escalation: GroupController::updatePermissions lets a GROUP_EDIT admin grant rights they do not hold
high8.8Aug 25, 2026
