# GHSA-5jfw-35xp-5m42: Buffer length underflow in LoginPacket causing unchecked exceptions to be thrown

- Severity: High 7.5 (CVSS:3.1, scored by GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2022-04-05T17:53:22.000Z
- Modified: 2024-12-05T05:39:20.852Z
- Weaknesses: CWE-124

## Description

### 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)

(As written by GitHub Advisory Database.)

## Affected

- pocketmine/bedrock-protocol (Packagist): before 8.0.2

## References

- <https://github.com/pmmp/BedrockProtocol/security/advisories/GHSA-5jfw-35xp-5m42> (web)
- <https://github.com/pmmp/BedrockProtocol/commit/e3fce7632b94e83fd6a518a87dcaf6a11681c4ac> (web)
- <https://github.com/pmmp/BedrockProtocol> (package)

## Sources

- GitHub Advisory Database: [GHSA-5jfw-35xp-5m42](https://github.com/advisories/GHSA-5jfw-35xp-5m42), CC-BY-4.0, modified 2024-12-05

---

Page: https://cve.day/GHSA-5jfw-35xp-5m42 · Whole record: https://cve.day/GHSA-5jfw-35xp-5m42.json · Rebuilt by cve.day 2026-11-25T22:56:31.203Z
