thorsten/phpmyfaq
Affected
- introduced
0, fixed4.1.1(ecosystem)
Fixed versions
4.1.1
Fix
The export has no generic command for this ecosystem.
Advisory
Also known as: 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 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:
a_b → LIKE becomes '%a_b%' → _ matches any single character, e.g. matches "aXb", "a1b", "azb" — broader than the literal string a_bte%t → LIKE becomes '%te%t%' → matches test, text, te12t, etc._%_ → LIKE becomes '%_%_%' → matches any record with at least one character, effectively dumping all custom pagesThis allows an attacker to retrieve custom page content that would not appear in normal exact searches, bypassing intended search scope restrictions.
PoC
_%_ (underscore, percent, underscore — length 3, bypasses the <= 2 filter).WHERE (page_title LIKE '%_%_%' OR content LIKE '%_%_%')Impact
searchCustomPages() in Search.php; custom pages (faqcustompages table)% and _ in LIKE search terms before interpolation: $word = str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $word);
Or use parameterized queries with properly escaped LIKE values.
Medium Basis: The source's own band: MODERATE
0, fixed 4.1.1 (ecosystem)4.1.1
The export has no generic command for this ecosystem.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0