Medium

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

  • Disclosed: 01.04.2026
  • Updated: 11.10.2026 10:22

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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package thorsten/phpmyfaq < 4.1.1 4.1.1

References

CVSS score 5.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Weakness (CWE)
CWE-943
Platform
Composer
Package
thorsten/phpmyfaq
Disclosed
01.04.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-gcp9-5jc8-976x - CC BY 4.0

Vulnerability history: thorsten/phpmyfaq

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (112) in the archive
Total entries
112
First → latest
05.2022 09.2026
Without a fix
2
Exploited in attacks
0

Severity breakdown

  • Critical 8
  • High 36
  • Medium 67
  • Low 1

Disclosures per year

  1. 2022: 8
  2. 2023: 62
  3. 2024: 2
  4. 2025: 6
  5. 2026: 34
Severity:
  1. High · 8.1 CVE-2026-56737 >= 3.2.0, < 4.1.6 4.1.6
  2. High · 7.5 CVE-2026-35672 < 4.1.3 4.1.3
  3. High · 8.8 CVE-2026-35671 < 4.1.3 4.1.3
  4. High · 7.6 CVE-2026-46367 >= 4.1.1, < 4.1.2 4.1.2
  5. phpMyFAQ has a LIKE Wildcard Injection in Search.php — Unescaped % and _ Metacharacters Enable Broad Content Disclosure this entry
    Medium · 5.3 CVE-2026-34973 < 4.1.1 4.1.1
  6. High · 7.5 CVE-2025-69200 < 4.0.16, >= 4.1.0-alpha, <= 4.1.0-beta.2 4.0.16
  7. High · 8.1 CVE-2025-59943 >= 4.0.7, < 4.0.13 4.0.13
  8. High · 7.6 CVE-2023-5865 < 3.2.2 3.2.2
  9. High · 7.4 CVE-2023-5864 < 3.2.1 3.2.1
  10. High · 8.3 CVE-2023-5319 < 3.1.18 3.1.18
  11. Critical · 9.0 CVE-2023-5320 < 3.1.18 3.1.18
  12. Critical · 9.1 CVE-2023-5316 < 3.1.18 3.1.18
  13. High · 8.8 CVE-2023-4007 < 3.1.16 3.1.16
  14. High · 8.2 CVE-2023-2550 < 3.1.13 3.1.13
  15. High · 8.3 CVE-2023-1887 < 3.1.12 3.1.12
  16. High · 7.3 CVE-2023-1886 < 3.1.12 3.1.12
  17. Critical · 9.8 CVE-2023-0788 < 3.1.11 3.1.11
  18. Critical · 9.8 CVE-2023-0789 < 3.1.11 3.1.11
  19. High · 8.8 CVE-2023-0790 < 3.1.11 3.1.11
  20. High · 8.8 CVE-2023-0793 < 3.1.11 3.1.11
  21. Critical · 9.8 CVE-2023-0311 < 3.1.10 3.1.10
  22. High · 7.5 CVE-2022-4409 < 3.1.9 3.1.9
  23. Critical · 9.8 CVE-2022-3754 < 3.1.8 3.1.8
  24. High · 8.4 CVE-2022-3608 < 3.2.0-alpha 3.2.0-alpha
  25. High · 8.8 CVE-2018-16650 < 2.9.11 2.9.11

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.