Update leaf's exploit fixes

This commit is contained in:
William Blake Galbreath
2020-06-14 16:34:43 -05:00
parent 84d5283bab
commit b8959e4416
7 changed files with 94 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
From cb226719b349208513caaaca05399da238d102b9 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 12 Jun 2020 16:15:12 -0500
From b2c766502d6a3d85a6d8743a9ff235bd10acacf6 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 11 Jun 2020 17:29:42 -0700
Subject: [PATCH] PaperPR - Fix more exploits (carpet dupe, rail dupe, bedrock
destroying, falling block (sand/dragon egg/etc) duping)
@@ -9,10 +9,10 @@ Subject: [PATCH] PaperPR - Fix more exploits (carpet dupe, rail dupe, bedrock
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 9cca30a94f..3bd3a1fe84 100644
index 9cca30a94f..80a4cf1641 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -373,11 +373,13 @@ public class BlockPiston extends BlockDirectional {
@@ -373,12 +373,14 @@ public class BlockPiston extends BlockDirectional {
}
for (k = list.size() - 1; k >= 0; --k) {
@@ -24,10 +24,11 @@ index 9cca30a94f..3bd3a1fe84 100644
map.remove(blockposition3);
world.setTypeAndData(blockposition3, (IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPiston.FACING, enumdirection), 68);
+ iblockdata1 = world.getType(oldPos); map.replace(oldPos, iblockdata1); // Purpur - fix piston physics inconsistency - move after the physics update
+ world.setTypeAndData(oldPos, Blocks.AIR.getBlockData(), 68); // Purpur - set air to prevent later physics updates from seeing this block
world.setTileEntity(blockposition3, BlockPistonMoving.a(iblockdata1, enumdirection, flag, false)); // Paper - fix piston physics inconsistency
+ world.setTypeAndData(oldPos, Blocks.AIR.getBlockData(), 68); // Purpur - set air to prevent later physics updates from seeing this block
--j;
aiblockdata[j] = iblockdata1;
}
--
2.26.2

View File

@@ -1,4 +1,4 @@
From b1eef399a5c08c3c448b6cf0586a722ecc1be265 Mon Sep 17 00:00:00 2001
From e9a526238a869c9b1238f4278f7086fc292e11e8 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 11:45:41 -0700
Subject: [PATCH] PaperPR - fixup! Protect Bedrock and End Portal/Frames from
@@ -24,19 +24,19 @@ index 8985d0ee9d..97e553b38c 100644
public co.aikar.timings.Timing timing;
public co.aikar.timings.Timing getTiming() {
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 3bd3a1fe84..03144ecca9 100644
index 80a4cf1641..0b7bed5e92 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -175,6 +175,12 @@ public class BlockPiston extends BlockDirectional {
@Override
public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, int i, int j) {
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING);
+ // Paper start - prevent retracting when we're facing the wrong way (we were replaced before retraction could occurr)
+ EnumDirection directionQueuedAs = EnumDirection.fromType1(j & 7); // Paper - copied from below
+ // Purpur start - prevent retracting when we're facing the wrong way (we were replaced before retraction could occur)
+ EnumDirection directionQueuedAs = EnumDirection.fromType1(j & 7); // Purpur - copied from below
+ if (!com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits && enumdirection != directionQueuedAs) {
+ return false;
+ }
+ // Paper end - prevent retracting when we're facing the wrong way
+ // Purpur end - prevent retracting when we're facing the wrong way
if (!world.isClientSide) {
boolean flag = this.a(world, blockposition, enumdirection);
@@ -45,7 +45,7 @@ index 3bd3a1fe84..03144ecca9 100644
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPistonMoving.a, enumdirection)).set(BlockPistonMoving.b, this.sticky ? BlockPropertyPistonType.STICKY : BlockPropertyPistonType.DEFAULT), 3);
- world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true));
+ world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); // Paper - diff on change, j is facing direction
+ world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); // Purpur - diff on change, j is facing direction
if (this.sticky) {
BlockPosition blockposition1 = blockposition.b(enumdirection.getAdjacentX() * 2, enumdirection.getAdjacentY() * 2, enumdirection.getAdjacentZ() * 2);
IBlockData iblockdata1 = world.getType(blockposition1);
@@ -54,14 +54,14 @@ index 3bd3a1fe84..03144ecca9 100644
}
} else {
- world.a(blockposition.shift(enumdirection), false);
+ // Paper start - fix headless pistons breaking blocks
+ // Purpur start - fix headless pistons breaking blocks
+ BlockPosition headPos = blockposition.shift(enumdirection);
+ if (com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || world.getType(headPos).getBlock() == Blocks.PISTON_HEAD) { // double check to make sure we're not a headless piston.
+ if (com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || world.getType(headPos) == Blocks.PISTON_HEAD.getBlockData().set(FACING, enumdirection)) { // double check to make sure we're not a headless piston.
+ world.setAir(headPos, false);
+ } else {
+ ((WorldServer)world).getChunkProvider().flagDirty(headPos); // ... fix client desync
+ }
+ // Paper end - fix headless pistons breaking blocks
+ // Purpur end - fix headless pistons breaking blocks
}
world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);

View File

@@ -1,4 +1,4 @@
From b1189325f8f73cd7f91a349a2b28ccef384c2f87 Mon Sep 17 00:00:00 2001
From c6f6d063de2c8a20138143945b79f879adf2be87 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 13:33:19 -0700
Subject: [PATCH] PaperPR - Fix sand duping
@@ -10,18 +10,18 @@ to detect that by placing a check after the move.
1 file changed, 11 insertions(+)
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 6683f7c5f3..243a8c570d 100644
index 6683f7c5f3..7969b1cd57 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -64,6 +64,11 @@ public class EntityFallingBlock extends Entity {
@Override
public void tick() {
+ // Paper start - fix sand duping
+ // Purpur start - fix sand duping
+ if (this.dead) {
+ return;
+ }
+ // Paper end - fix sand duping
+ // Purpur end - fix sand duping
if (this.block.isAir()) {
this.die();
} else {
@@ -29,11 +29,11 @@ index 6683f7c5f3..243a8c570d 100644
this.move(EnumMoveType.SELF, this.getMot());
+ // Paper start - fix sand duping
+ // Purpur start - fix sand duping
+ if (this.dead) {
+ return;
+ }
+ // Paper end - fix sand duping
+ // Purpur end - fix sand duping
+
// Paper start - Configurable EntityFallingBlock height nerf
if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY() > this.world.paperConfig.fallingBlockHeightNerf) {

View File

@@ -0,0 +1,29 @@
From d3fc90698c11fde0a7c56d6147eb4f7d075abef4 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 16:51:39 -0700
Subject: [PATCH] PaperPR - Prevent position desync in playerconnection causing
tp exploit
---
src/main/java/net/minecraft/server/PlayerConnection.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3a1aa1d4da..c13296935c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1104,6 +1104,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
+ // Purpur start - prevent position desync
+ if (this.teleportPos != null) {
+ return; // ... thanks Mojang for letting move calls teleport across dimensions.
+ }
+ // Purpur end - prevent position desync
this.player.onGround = packetplayinflying.b();
double d12 = d8;
--
2.26.2

View File

@@ -0,0 +1,41 @@
From b3844763525ac664bd1ba437cf895bba3021d82d Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 22:25:11 -0700
Subject: [PATCH] PaperPR - Fix enderdragon exp dupe
---
src/main/java/net/minecraft/server/EntityEnderDragon.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index f06fde3242..6abe47f776 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -33,7 +33,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
public float bx;
public float by;
public boolean bz;
- public int bA;
+ public int bA; public final int getDeathTicks() { return this.bA; } public final void setDeathTicks(final int value) { this.bA = value; } // Purpur
public float bB;
@Nullable
public EntityEnderCrystal currentEnderCrystal;
@@ -908,6 +908,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setInt("DragonPhase", this.bO.a().getControllerPhase().b());
+ nbttagcompound.setInt("Paper.DeathTick", this.getDeathTicks()); // Purpur
}
@Override
@@ -916,6 +917,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (nbttagcompound.hasKey("DragonPhase")) {
this.bO.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase")));
}
+ this.setDeathTicks(nbttagcompound.getInt("Paper.DeathTick")); // Purpur
}
--
2.26.2

View File

@@ -1,4 +1,4 @@
From f07e5a8ff174e674d80ea0ea9d544d62f5925c77 Mon Sep 17 00:00:00 2001
From 1058842736fe70a7cd1d02871b8f38ae78fa5dc9 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Fri, 3 Apr 2020 02:21:13 -0700
Subject: [PATCH] Tuinity - Always able to execute tasks on the main server

View File

@@ -1,4 +1,4 @@
From 50f676afc116eca4eb95ccd6cbd08bc2e20ecaad Mon Sep 17 00:00:00 2001
From b12c6c91ed8bc54c3e134d9f7a67c467c56316e6 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 23:08:01 +0100
Subject: [PATCH] YAPFA - Disable mojang profiler