GHSA-5jfw-35xp-5m42: Pocketmine/bedrock protocol Buffer Length Underflow Vulnerability
HIGHGHSA-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
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).
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.
Upgrade pocketmine/bedrock-protocol to 8.0.2
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
GHSA-5jfw-35xp-5m42 Affected Pocketmine/bedrock protocol Versions
1 component(s)| 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?
Which Pocketmine/bedrock protocol versions are affected?
What version fixes GHSA-5jfw-35xp-5m42?
Is pocketmine/bedrock-protocol affected?
What is the CVSS score of GHSA-5jfw-35xp-5m42?
What CWE is associated with GHSA-5jfw-35xp-5m42?
How can I check Packagist dependencies for GHSA-5jfw-35xp-5m42?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}