The vulnerability allows a user with an active SFTP connection to a Pterodactyl server to maintain access even after their permissions have been revoked or they have been removed from the server. This is because the application failed to terminate active sessions upon a permission change.
The analysis of the provided patch (commit 2bd9d8baddb0e0606e4a9d5be402f48678ac88d5 in pterodactyl/panel) reveals the flawed logic. The application was using a function called revokeUserJTI, which only invalidated a JSON Web Token (JWT). This action is insufficient for terminating an already established SFTP session, which is stateful.
The patch introduces a new mechanism, a deauthorize method within a new DaemonRevocationRepository. This new method makes a direct API call to the Pterodactyl Wings daemon, instructing it to explicitly terminate the user's active connections (SFTP and websockets).
The vulnerable functions are the ones that were responsible for managing user permissions and called the ineffective revokeUserJTI method. These are:
Pterodactyl\Http\Controllers\Api\Client\Servers\SubuserController::update: Triggered when a subuser's permissions are changed.
Pterodactyl\Http\Controllers\Api\Client\Servers\SubuserController::delete: Triggered when a subuser is removed from a server.
Pterodactyl\Services\Servers\DetailsModificationService::handle: Triggered when server ownership is transferred.
During exploitation, an attacker would have an active SFTP session. An administrator would then perform an action (like deleting the user or changing their permissions) that calls one of these vulnerable functions. Because these functions originally failed to terminate the SFTP session, the attacker's access would persist. The presence of these function names in a runtime profile during such an administrative action would be a strong indicator of this vulnerability.