GHSA-h79x-98r2-g6qc

Suggest an improvement
Source
https://github.com/advisories/GHSA-h79x-98r2-g6qc
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/01/GHSA-h79x-98r2-g6qc/GHSA-h79x-98r2-g6qc.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-h79x-98r2-g6qc
Published
2022-01-21T23:02:15Z
Modified
2024-12-05T05:32:32.295176Z
Severity
  • 4.7 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
Impersonation of other users (passing XBOX Live authentication) by theft of logins in PocketMine-MP
Details

Impact

Minecraft Bedrock authentication and its protocol encryption are inseparably linked. One is not complete without the other.

This vulnerability affects servers which are able to be directly connected to via the internet (i.e. not behind a proxy).

If you are using a proxy, please check that it supports protocol encryption and that it is enabled.

Technical details

<details> <summary>click to expand</summary>

Basics

  1. The client generates a private ECC key clientPriv which it uses to complete ECDH for encryption.
  2. A JWT containing the public key clientPub corresponding to this key is signed by Microsoft servers with the Mojang root public key mojangPub.
  3. The server verifies that the token was issued by Microsoft servers by verifying the JWT signature with mojangPub.

Why this is a problem

However, this only ensures that the token was issued by Microsoft. It does not ensure that the client actually possesses the private key corresponding to the public key in the token. In a login replay attack, the attacker sends a login captured from another session. This login is valid because it is verifiable by mojangPub; however, without encryption, the server doesn't know that the client actually possesses clientPriv, and the authenticity of the client cannot be verified.

How encryption prevents the attack

  1. The server calculates a shared secret for encryption using ECDH of serverPriv and clientPub.
  2. It then signs a return token using serverPriv and sends this to the client, along with serverPub.
  3. The client then verifies the JWT using serverPub, and calculates the same shared secret as the server using clientPriv and serverPub.

If the client does not possess clientPriv (i.e. because it replayed a stolen login), then the session cannot proceed once encryption is enabled, since the client cannot calculate the shared secret needed to decrypt the server packets and encrypt its own packets.

Since PM3 does not implement protocol encryption, this means that ALL versions of PM3 are affected by this login stealing attack.

How does the attacker capture a login in the first place?

The typical way to do this would be to trick a player into joining a server controlled by the attacker. This would allow the attacker to grab the login from the connection and store it for future use.

Are the logins valid forever?

No. All the JWTs have expiry dates after which they cannot be used. These expiry dates are typically 2-3 days after the token was issued by XBOX servers. PocketMine-MP 3.x does verify these expiry dates, so the use-by dates of these attacks are limited.

</details>

Patches

This problem has been fixed in all 4.x versions by implementing Minecraft protocol encryption.

~This has not yet been addressed on 3.x, but since this vulnerability is already public knowledge, the advisory has been released early to make sure people are aware of it and the mitigation steps they can take.~

Update 2022-01-22: This has been fixed on 3.x by d28be4eaf24a890f7ef110a51181a3d806a6acca.

Workarounds

  • Use a proxy that supports encryption such as gophertunnel between your server and players. Make sure that the server only accepts connections from the proxy. If the proxy is on the same machine as the server, you can use server-ip=127.0.0.1 to ensure that only the proxy can create connections for you.

The following things may help mitigate the problem: - Verify that the LoginPacket serverAddress field is the same as the server's exposed domain name. For example: https://github.com/JustTalDevelops/AntiLoginForger WARNING: THIS DOES NOT SOLVE THE ROOT ISSUE. YOU WILL REMAIN VULNERABLE UNLESS YOU UPGRADE.

For more information

If you have any questions or comments about this advisory: * Email us at team@pmmp.io

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2022-01-21T21:16:04Z"
}
References

Affected packages

Packagist / pocketmine/pocketmine-mp

Package

Name
pocketmine/pocketmine-mp
Purl
pkg:composer/pocketmine/pocketmine-mp

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.0.0
Fixed
4.0.0

Affected versions

3.*

3.0.0
3.0.1
3.0.2
3.0.3
3.0.4
3.0.5
3.0.6
3.0.7
3.0.8
3.0.9
3.0.10
3.0.11
3.0.12
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.1.7
3.1.8
3.2.0
3.2.1
3.2.2
3.2.3
3.2.4
3.2.5
3.2.6
3.2.7
3.3.0
3.3.1
3.3.2
3.3.3
3.3.4
3.4.0
3.4.1
3.4.2
3.4.3
3.5.0
3.5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