GHSA-5jfw-35xp-5m42: Pocketmine/bedrock protocol Buffer Length Underflow Vulnerability

HIGH
CVSS 7.5
CWE-124
Published
Advisory Summary

GHSA-5jfw-35xp-5m42 is a HIGH (CVSS 7.5) buffer length underflow vulnerability (CWE-124: Buffer Underwrite ('Buffer Underflow')) affecting Pocketmine/bedrock protocol libraries in the Packagist ecosystem. The issue involves buffer length underflow in loginpacket causing unchecked exceptions to be thrown. Remediation is available by upgrading affected packages to version 8.0.2.

GHSA-5jfw-35xp-5m42 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-5jfw-35xp-5m42
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-124: Buffer Underwrite ('Buffer Underflow')
Affected Product Pocketmine/bedrock protocol
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-5jfw-35xp-5m42

To remediate this vulnerability, upgrade all affected Pocketmine/bedrock protocol dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pocketmine/bedrock-protocol fixed: 8.0.2
Upgrade pocketmine/bedrock-protocol to 8.0.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for pocketmine/bedrock-protocol

How to Check if You Are Affected

To determine whether your application is affected by GHSA-5jfw-35xp-5m42, inspect your project dependencies for Pocketmine/bedrock protocol:

inspect dependencies for pocketmine/bedrock-protocol

Analyze the terminal output to locate any version of Pocketmine/bedrock protocol in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-124: Buffer Underwrite ('Buffer Underflow'), where the product writes to a buffer using an index or pointer that references a memory location prior to the beginning of the buffer. In Pocketmine/bedrock protocol, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact `LoginPacket` uses `BinaryStream->getLInt()` to read the lengths of JSON payloads it wants to decode. Unfortunately, `BinaryStream->getLInt()` returns a signed integer, meaning that a malicious client can craft a packet with a large uint32 value for payload buffer size (which would be interpreted as a negative signed int32), causing `BinaryStream->get()` to throw an exception. In the context of PocketMine-MP, this leads to a server crash when the vulnerability is exploited. ### Patches e3fce7632b94e83fd6a518a87dcaf6a11681c4ac ### Workarounds This can be worked around by registering a custom `LoginPacket` implementation into `PacketPool` which overrides [this code](https://github.com/pmmp/BedrockProtocol/blob/47532c95ea37d5f0365b23f734d70d943ff95295/src/LoginPacket.php#L54) to patch it. ### For more information * Email us at [team@pmmp.io](mailto:team@pmmp.io)

GHSA-5jfw-35xp-5m42 Affected Pocketmine/bedrock protocol Versions

1 component(s)
Fixed Versions:
8.0.2
Product / Package Ecosystem Affected Versions Fixed Version
pocketmine/bedrock-protocol
Packagist
< 8.0.2
8.0.2

References

Frequently Asked Questions

What is GHSA-5jfw-35xp-5m42?
GHSA-5jfw-35xp-5m42 is a security vulnerability in Pocketmine/bedrock protocol involving Buffer length underflow in LoginPacket causing unchecked exceptions to be thrown under CWE-124: Buffer Underwrite ('Buffer Underflow').
Which Pocketmine/bedrock protocol versions are affected?
Affected versions include releases prior to 8.0.2 across affected packages: pocketmine/bedrock-protocol.
What version fixes GHSA-5jfw-35xp-5m42?
Upgrading to 8.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pocketmine/bedrock-protocol affected?
Yes, pocketmine/bedrock-protocol is affected in releases prior to 8.0.2. Upgrade your dependency to 8.0.2 or later.
What is the CVSS score of GHSA-5jfw-35xp-5m42?
GHSA-5jfw-35xp-5m42 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-5jfw-35xp-5m42?
GHSA-5jfw-35xp-5m42 is classified under CWE-124: Buffer Underwrite ('Buffer Underflow') (The product writes to a buffer using an index or pointer that references a memory location prior to the beginning of the buffer.).
How can I check Packagist dependencies for GHSA-5jfw-35xp-5m42?
Run the dependency tree command: 'inspect dependencies for pocketmine/bedrock-protocol'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5jfw-35xp-5m42",
  "modified" : "2022-04-05T17:53:22Z",
  "published" : "2022-04-05T17:53:22Z",
  "aliases" : [ ],
  "summary" : "Buffer length underflow in LoginPacket causing unchecked exceptions to be thrown",
  "details" : "### Impact\n`LoginPacket` uses `BinaryStream->getLInt()` to read the lengths of JSON payloads it wants to decode. Unfortunately, `BinaryStream->getLInt()` returns a signed integer, meaning that a malicious client can craft a packet with a large uint32 value for payload buffer size (which would be interpreted as a negative signed int32), causing `BinaryStream->get()` to throw an exception.\n\nIn the context of PocketMine-MP, this leads to a server crash when the vulnerability is exploited.\n\n### Patches\ne3fce7632b94e83fd6a518a87dcaf6a11681c4ac\n\n### Workarounds\nThis can be worked around by registering a custom `LoginPacket` implementation into `PacketPool` which overrides [this code](https://github.com/pmmp/BedrockProtocol/blob/47532c95ea37d5f0365b23f734d70d943ff95295/src/LoginPacket.php#L54) to patch it.\n\n### For more information\n* Email us at [team@pmmp.io](mailto:team@pmmp.io)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "pocketmine/bedrock-protocol"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pmmp/BedrockProtocol/security/advisories/GHSA-5jfw-35xp-5m42"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pmmp/BedrockProtocol/commit/e3fce7632b94e83fd6a518a87dcaf6a11681c4ac"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pmmp/BedrockProtocol"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-124" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-05T17:53:22Z",
    "nvd_published_at" : null
  }
}