PT-2026-29784 · Thorsten+1 · Phpmyfaq+1
Published
2026-04-01
·
Updated
2026-04-02
·
CVE-2026-34973
CVSS v4.0
6.9
Medium
| AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N |
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–240Vulnerable 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
%andin LIKE search terms before interpolation:
$word = str replace(['', '%', ' '], ['', '%', ' '], $word);
Or use parameterized queries with properly escaped LIKE values.
Fix
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Phpmyfaq
Thorsten/Phpmyfaq