From 6f5d62f302c25ffb3f3bc133917fd6d753f23062 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 14 May 2026 22:56:37 +0300 Subject: [PATCH 1/7] fixed crash exploit --- src/Player.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Player.php b/src/Player.php index 117db768..89b3a716 100755 --- a/src/Player.php +++ b/src/Player.php @@ -2423,8 +2423,24 @@ class Player{ break; } if($this->isSleeping) break; + + + //prevent crash caused by nan values + if(is_nan($packet->x) || is_nan($packet->y) || is_nan($packet->z)){ + ConsoleAPI::warn("{$this->username} Attempted to crash the server using NaN position!"); + $this->close("invalid position"); + break; + } + if(($this->entity instanceof Entity) && $packet->messageIndex > $this->lastMovement){ $this->lastMovement = $packet->messageIndex; + //prevent all movement this far - vanilla collisions break there + //farther distances(like inf) may cause client and server crash + if(abs($packet->x) >= 8388608 || abs($packet->y) >= 8388608 || abs($packet->z) >= 8388608){ + $this->addEntityMovementUpdateToQueue($this->entity); + break; + } + $newPos = new Vector3($packet->x, $packet->y, $packet->z); if($this->forceMovement instanceof Vector3){ if($this->forceMovement->distance($newPos) <= 0.7){ From 171390260dab425b037d82faafdc2659198ffc97 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 16 May 2026 07:01:22 +0300 Subject: [PATCH 2/7] fixed client crash using inf rot, fixed invisibility using nan rot --- src/Player.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Player.php b/src/Player.php index 89b3a716..4ad26a57 100755 --- a/src/Player.php +++ b/src/Player.php @@ -2432,6 +2432,19 @@ class Player{ break; } + if(is_infinite($packet->yaw) || is_infinite($packet->pitch) || is_infinite($packet->bodyYaw)){ + ConsoleAPI::warn("{$this->username} Attempted to crash other clients using INF rotation!"); + $this->close("invalid rotation"); + break; + } + + //doesnt crash anything but allows players to break their model rendering(make them/head invisible) + if(is_nan($packet->yaw) || is_nan($packet->pitch) || is_nan($packet->bodyYaw)){ + ConsoleAPI::warn("{$this->username} Attempted to break their model using NAN rotation!"); + $this->close("invalid rotation"); + break; + } + if(($this->entity instanceof Entity) && $packet->messageIndex > $this->lastMovement){ $this->lastMovement = $packet->messageIndex; //prevent all movement this far - vanilla collisions break there From 11737d0bda4e46acb76612e4a31dec4416275a9c Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 16 May 2026 07:03:36 +0300 Subject: [PATCH 3/7] fixed setBlock with non int coords --- src/entity/ai/tasks/TaskEatTileGoal.php | 8 ++++---- src/pmf/PMFLevel.php | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/entity/ai/tasks/TaskEatTileGoal.php b/src/entity/ai/tasks/TaskEatTileGoal.php index 8bc3766e..a71274e1 100644 --- a/src/entity/ai/tasks/TaskEatTileGoal.php +++ b/src/entity/ai/tasks/TaskEatTileGoal.php @@ -24,14 +24,14 @@ class TaskEatTileGoal extends TaskBase if (--$this->selfCounter == 4) { - $id = $ai->entity->level->level->getBlockID($ai->entity->x, $ai->entity->y, $ai->entity->z); - $idb = $ai->entity->level->level->getBlockID($ai->entity->x, $ai->entity->y - 1, $ai->entity->z); + $id = $ai->entity->level->level->getBlockID((int)$ai->entity->x, (int)$ai->entity->y, (int)$ai->entity->z); + $idb = $ai->entity->level->level->getBlockID((int)$ai->entity->x, (int)$ai->entity->y - 1, (int)$ai->entity->z); if($id === TALL_GRASS){ - $ai->entity->level->fastSetBlockUpdate($ai->entity->x, $ai->entity->y, $ai->entity->z, AIR, 0); + $ai->entity->level->fastSetBlockUpdate((int)$ai->entity->x, (int)$ai->entity->y, (int)$ai->entity->z, AIR, 0); $ai->entity->eatGrass(); }elseif($idb === GRASS){ - $ai->entity->level->fastSetBlockUpdate($ai->entity->x, $ai->entity->y - 1, $ai->entity->z, DIRT, 0); + $ai->entity->level->fastSetBlockUpdate((int)$ai->entity->x, (int)$ai->entity->y - 1, (int)$ai->entity->z, DIRT, 0); $ai->entity->eatGrass(); } } diff --git a/src/pmf/PMFLevel.php b/src/pmf/PMFLevel.php index 0d03bd15..b86a0f28 100644 --- a/src/pmf/PMFLevel.php +++ b/src/pmf/PMFLevel.php @@ -663,9 +663,11 @@ class PMFLevel extends PMF{ }elseif($this->chunks[$index][$Y] === false){ $this->fillMiniChunk($X, $Z, $Y); } - $aX = $x - ($X << 4); - $aZ = $z - ($Z << 4); - $aY = $y - ($Y << 4); + + $aX = $x & 0xf; + $aZ = $z & 0xf; + $aY = $y & 0xf; + $bindex = (int) ($aY + ($aX << 5) + ($aZ << 9)); $mindex = (int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9)); $old_b = ord($this->chunks[$index][$Y][$bindex]); From cece622118689dd11d17b17ae1488773f0c244a3 Mon Sep 17 00:00:00 2001 From: Sunch <120295462+Sunch233@users.noreply.github.com> Date: Sat, 6 Jun 2026 18:46:02 +0800 Subject: [PATCH 4/7] fixed wrong comparison 0x08 == 0x08 --- src/material/block/nonfull/SlabBlock.php | 2 +- src/material/block/nonfull/WoodSlabBlock.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/material/block/nonfull/SlabBlock.php b/src/material/block/nonfull/SlabBlock.php index da167514..ecbeb1ba 100644 --- a/src/material/block/nonfull/SlabBlock.php +++ b/src/material/block/nonfull/SlabBlock.php @@ -29,7 +29,7 @@ class SlabBlock extends TransparentBlock{ [$id, $meta] = $level->level->getBlock($x, $y, $z); - if($meta & 0x08 == 0x08){ + if(($meta & 0x08) == 0x08){ StaticBlock::setBlockBounds($id, 0, 0, 0, 1, 1, 1); }else{ $bottom = (($meta ^ 8) >> 3) & 1; diff --git a/src/material/block/nonfull/WoodSlabBlock.php b/src/material/block/nonfull/WoodSlabBlock.php index 64ced90a..576bae2c 100644 --- a/src/material/block/nonfull/WoodSlabBlock.php +++ b/src/material/block/nonfull/WoodSlabBlock.php @@ -25,7 +25,7 @@ class WoodSlabBlock extends TransparentBlock{ [$id, $meta] = $level->level->getBlock($x, $y, $z); - if($meta & 0x08 == 0x08){ + if(($meta & 0x08) == 0x08){ StaticBlock::setBlockBounds($id, 0, 0, 0, 1, 1, 1); }else{ $bottom = (($meta ^ 8) >> 3) & 1; From 22401a6378bdc921d7b7524a8d18e59272902463 Mon Sep 17 00:00:00 2001 From: Sunch <120295462+Sunch233@users.noreply.github.com> Date: Sat, 6 Jun 2026 18:46:17 +0800 Subject: [PATCH 5/7] Player: typo --- src/Player.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 4ad26a57..de36bad5 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1379,10 +1379,11 @@ class Player{ } public function makeInvisibleForAllPlayers(){ - foreach($this->server->api->player->getA as $player){ + foreach($this->server->api->player->getAll() as $player){ if($player->CID != $this->CID) $this->setInvisibleFor($player, true); } } + public function getGamemode(){ switch($this->gamemode){ case SURVIVAL: From e678d16118b47c0718ebaa38c515c6af3777c56c Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Thu, 11 Jun 2026 02:02:41 +0300 Subject: [PATCH 6/7] fixed possible crash --- src/entity/Entity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index bfb6a2b1..ee566e2d 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -756,8 +756,8 @@ class Entity extends Position public function positionRider($dead){ if($this->rider != 0){ - $e = $this->level->entityList[$this->rider]; - if($e === false) return; + $e = $this->level->entityList[$this->rider] ?? false; + if(!($e instanceof Entity)) return; $v3 = $this->getRideHeight(); if($dead || $this->dead) $v3 = 0.01; From f0f73b55cfce7da9d3c25eefce3b3f2dbe640022 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Fri, 12 Jun 2026 06:25:42 +0300 Subject: [PATCH 7/7] fixed fly kick when riding minecart --- src/entity/Entity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index ee566e2d..968615c8 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -918,7 +918,7 @@ class Entity extends Position } } - if($prevGroundState == $this->onGround && !$this->onGround && $this->player->isSleeping == false && !$this->dead){ //isSleeping may be a vector + if($prevGroundState == $this->onGround && !$this->onGround && $this->player->isSleeping == false && !$this->dead && $this->riding == 0){ //isSleeping may be a vector ++$this->notOnGroundTicks; }else if($this->onGround){ $this->notOnGroundTicks = 0;