Skip to content

Unauthenticated sessions take up player slots, preventing players from joining

Moderate
dktapps published GHSA-474q-9hgp-hcvx Dec 30, 2022

Package

composer pocketmine/pocketmine-mp (Composer)

Affected versions

4.12.2

Patched versions

4.12.3

Description

Impact

PocketMine-MP currently does not limit the maximum number of unauthenticated sessions. Max player count is checked only when PlayerPreLoginEvent is reached. No problems so far.

On a 100-player server, an attacker can create 110 sessions, and never send the LoginPacket. These sessions won't be kicked as explained above (until a 10-second login timeout is reached). However, since these unauthenticated sessions are included for the max-players check, this means that any real player who sends a LoginPacket is immediately disconnected.

The solution to this is fairly simple: only include sessions in the max-players check which themselves have already passed a max-players check, i.e. sessions which have sent a LoginPacket. (Note that this is NOT the same as count(getOnlinePlayers()), as getOnlinePlayers() only includes connections for which a Player has been created.)

Patches

This problem has been fixed by 59be901.

Workarounds

A possible workaround is to increase the max player count of your server. This isn't a great solution, but it helps to mitigate the problem by making it harder to fill all the player slots. You can also un-cancel PlayerPreLoginEvent if the reason is SERVER_FULL (but beware of using getOnlinePlayers() for a replacement check, as this will allow your max-players to be exceeded in some cases).

Severity

Moderate
5.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

CVE ID

No known CVE

Weaknesses

No CWEs

Credits