From 53ab4039525899da7ddae53b296185e49862d4e3 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 8 Dec 2022 17:38:05 +0100 Subject: [PATCH] Fix Insecure PopUp (zOnlyKroks made it) --- SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java | 10 ---------- SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java | 5 ----- SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java | 2 -- SpigotCore_Main/src/de/steamwar/core/Core.java | 3 ++- .../steamwar/network/handlers/ServerDataHandler.java | 9 +-------- 5 files changed, 3 insertions(+), 26 deletions(-) diff --git a/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java b/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java index 0b5078c..bef03b5 100644 --- a/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java +++ b/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java @@ -19,10 +19,8 @@ package de.steamwar.core; -import com.comphenix.tinyprotocol.Reflection; import net.minecraft.network.chat.IChatMutableComponent; import net.minecraft.network.chat.contents.LiteralContents; -import net.minecraft.network.protocol.game.ClientboundServerDataPacket; public class ChatWrapper19 implements ChatWrapper { @@ -30,12 +28,4 @@ public class ChatWrapper19 implements ChatWrapper { public Object stringToChatComponent(String text) { return IChatMutableComponent.a(new LiteralContents(text)); } - - private static final Reflection.FieldAccessor accessor = Reflection.getField(ClientboundServerDataPacket.class, boolean.class,0); - @Override - public Object modifyServerDataPacket(Object o) { - ClientboundServerDataPacket clientboundServerDataPacket = (ClientboundServerDataPacket) o; - accessor.set(clientboundServerDataPacket,true); - return clientboundServerDataPacket; - } } diff --git a/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java b/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java index 7c18381..68b8e07 100644 --- a/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java +++ b/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java @@ -28,9 +28,4 @@ public class ChatWrapper8 implements ChatWrapper { public Object stringToChatComponent(String text) { return chatComponentConstructor.invoke(text); } - - @Override - public Object modifyServerDataPacket(Object o) { - return null; - } } diff --git a/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java b/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java index 2ca729a..2f4df8f 100644 --- a/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java +++ b/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java @@ -23,6 +23,4 @@ public interface ChatWrapper { ChatWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); Object stringToChatComponent(String text); - - Object modifyServerDataPacket(Object o); } diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 4745175..7c76ebc 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -28,6 +28,7 @@ import de.steamwar.core.events.PlayerJoinedEvent; import de.steamwar.core.events.WorldLoadEvent; import de.steamwar.message.Message; import de.steamwar.network.NetworkReceiver; +import de.steamwar.network.handlers.ServerDataHandler; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.internal.Statement; @@ -122,7 +123,7 @@ public class Core extends JavaPlugin{ Bukkit.getScheduler().runTaskTimer(Core.getInstance(), SchematicNode::clear, 20L * 30, 20L * 30); if(Core.getVersion() >= 19) - //new ServerDataHandler(); + new ServerDataHandler(); try { getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine()); diff --git a/SpigotCore_Main/src/de/steamwar/network/handlers/ServerDataHandler.java b/SpigotCore_Main/src/de/steamwar/network/handlers/ServerDataHandler.java index 0882560..86da445 100644 --- a/SpigotCore_Main/src/de/steamwar/network/handlers/ServerDataHandler.java +++ b/SpigotCore_Main/src/de/steamwar/network/handlers/ServerDataHandler.java @@ -2,19 +2,12 @@ package de.steamwar.network.handlers; import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.core.ChatWrapper; -import de.steamwar.core.CraftbukkitWrapper; -import org.bukkit.entity.Player; public class ServerDataHandler { private Class serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket"); public ServerDataHandler() { - TinyProtocol.instance.addFilter(serverDataPacket, this::packetFilter); - } - - private Object packetFilter(Player player, Object o) { - return ChatWrapper.impl.modifyServerDataPacket(o); + TinyProtocol.instance.addFilter(serverDataPacket, (p, o) -> null); } } -- 2.39.2