Mittel

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

  • Veröffentlicht: 01.04.2026
  • Aktualisiert: 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.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Composer-Paket thorsten/phpmyfaq < 4.1.1 4.1.1

Verweise

CVSS-Wert 5.3/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Schwäche (CWE)
CWE-943
Plattform
Composer
Paket
thorsten/phpmyfaq
Veröffentlicht
01.04.2026
Aktualisiert
11.10.2026 10:22

Quellen und Lizenzen

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

Schwachstellenhistorie: thorsten/phpmyfaq

Alle veröffentlichten Schwachstellen dieses Pakets (Composer-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (112) im Archiv
Einträge insgesamt
112
Erste → letzte
05.2022 09.2026
Ohne Fix
2
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 8
  • Hoch 36
  • Mittel 67
  • Niedrig 1

Veröffentlichungen pro Jahr

  1. 2022: 8
  2. 2023: 62
  3. 2024: 2
  4. 2025: 6
  5. 2026: 34
Schweregrad:
  1. Hoch · 8.1 CVE-2026-56737 >= 3.2.0, < 4.1.6 4.1.6
  2. Hoch · 7.5 CVE-2026-35672 < 4.1.3 4.1.3
  3. Hoch · 8.8 CVE-2026-35671 < 4.1.3 4.1.3
  4. Hoch · 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 dieser Eintrag
    Mittel · 5.3 CVE-2026-34973 < 4.1.1 4.1.1
  6. Hoch · 7.5 CVE-2025-69200 < 4.0.16, >= 4.1.0-alpha, <= 4.1.0-beta.2 4.0.16
  7. Hoch · 8.1 CVE-2025-59943 >= 4.0.7, < 4.0.13 4.0.13
  8. Hoch · 7.6 CVE-2023-5865 < 3.2.2 3.2.2
  9. Hoch · 7.4 CVE-2023-5864 < 3.2.1 3.2.1
  10. Hoch · 8.3 CVE-2023-5319 < 3.1.18 3.1.18
  11. Kritisch · 9.0 CVE-2023-5320 < 3.1.18 3.1.18
  12. Kritisch · 9.1 CVE-2023-5316 < 3.1.18 3.1.18
  13. Hoch · 8.8 CVE-2023-4007 < 3.1.16 3.1.16
  14. Hoch · 8.2 CVE-2023-2550 < 3.1.13 3.1.13
  15. Hoch · 8.3 CVE-2023-1887 < 3.1.12 3.1.12
  16. Hoch · 7.3 CVE-2023-1886 < 3.1.12 3.1.12
  17. Kritisch · 9.8 CVE-2023-0788 < 3.1.11 3.1.11
  18. Kritisch · 9.8 CVE-2023-0789 < 3.1.11 3.1.11
  19. Hoch · 8.8 CVE-2023-0790 < 3.1.11 3.1.11
  20. Hoch · 8.8 CVE-2023-0793 < 3.1.11 3.1.11
  21. Kritisch · 9.8 CVE-2023-0311 < 3.1.10 3.1.10
  22. Hoch · 7.5 CVE-2022-4409 < 3.1.9 3.1.9
  23. Kritisch · 9.8 CVE-2022-3754 < 3.1.8 3.1.8
  24. Hoch · 8.4 CVE-2022-3608 < 3.2.0-alpha 3.2.0-alpha
  25. Hoch · 8.8 CVE-2018-16650 < 2.9.11 2.9.11

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.