Skip to content

Denial-of-service vulnerability processing large chat messages containing many newlines

Moderate severity GitHub Reviewed Published May 22, 2022 in pmmp/PocketMine-MP • Updated Jan 11, 2023

Package

composer pocketmine/pocketmine-mp (Composer)

Affected versions

< 4.2.10

Patched versions

4.2.10

Description

Impact

PocketMine-MP caps maximum chat message length at 512 Unicode characters, or about 2048 bytes. No more than 2 chat messages may be sent per tick. However, due to legacy reasons, incoming chat message blobs are split by \n, and each part is treated as a separate message, the length of each part is individually checked. The length of the whole message is not checked.

This leads to an exploitable performance issue, in which a malicious client may send a chat packet of several megabytes containing nothing but \n newline characters. The server will parse this into a very large array and spend a long time (several milliseconds) iterating over it for no reason.

Furthermore, due to the lack of sufficient rate limit checks before parsing messages, malicious clients may bombard the server with many thousands of these malicious messages, causing lockups for a significant amount of time (seconds or minutes).

Patches

This bug was addressed in pmmp/PocketMine-MP@df33e17 by:

  • checking the length of the incoming message as a whole before parsing it - it may not be larger than messageCounter * maxChatMessageSize (messageCounter is decremented once for every message sent)
  • limiting the maximum number of times a message may be split on newlines before giving up and discarding the message (maximum 3 parts; anything after the first 2 parts is discarded)

Workarounds

Handle DataPacketReceiveEvent and check for these excessive newlines in incoming TextPacket.

For more information

If you have any questions or comments about this advisory:

References

@dktapps dktapps published to pmmp/PocketMine-MP May 22, 2022
Published to the GitHub Advisory Database May 25, 2022
Reviewed May 25, 2022
Last updated Jan 11, 2023

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Weaknesses

No CWEs

CVE ID

No known CVE

GHSA ID

GHSA-gj94-v4p9-w672

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.