Skip to content

Server crash due to incorrect EC curve used for LoginPacket identityPublicKey

High
dktapps published GHSA-79rc-jjh6-rc89 Sep 13, 2023

Package

composer pocketmine/pocketmine-mp (Composer)

Affected versions

>= 5.2.0

Patched versions

5.3.1, 4.23.1

Description

Impact

The server uses ECDH to calculate a shared secret for the symmetric encryption key used to encrypt network packets after logging in. ECDH requires that the keys used must both belong to the same elliptic curve. In Minecraft: Bedrock Edition, the curve used is secp384r1.

Using any other curve (for example secp256r1) to sign the LoginPacket JWTs would lead to successfully verifying the login chain, but would later crash due to an uncaught exception during ECDH key derivation due to the client-provided key belonging to a different curve than the server's key. It's also theoretically possible that a non-EC key could be used (e.g. RSA or DH), which would also pass login verification as long as SHA384 hashing algorithm was used for the JWT signatures, and also lead to a crash.

Patches

The problem was fixed in 4.23.1 and 5.3.1 in the following commit: 4e646d1
While 4.x would not have crashed when this was encountered, the faulty validation code has also been corrected there.

Workarounds

A plugin could handle LoginPacket and check that all of the identityPublicKeys provided in the JWT bodies actually belong to secp384r1. This can be checked by verifying that openssl_pkey_get_details($key)["ec"]["curve_name"] is set and equal to secp384r1. Beware that this element may not exist if the key is not an EC key at all.

Severity

High

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
High

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:H

CVE ID

No known CVE

Weaknesses

No CWEs

Credits