0x00 C00Handshake

The very first packet sent by the client. Initiates the connection and requests a protocol state transition.

Serverbound (Client → Server) · HANDSHAKING · net/minecraft/network/handshake/client/C00Handshake.java

Published 2026-06-18 · Updated 2026-10-14

connectionhandshakeprotocol
Comprehensive 7/8

Fields

FieldTypeDescription
protocolVersionVarIntProtocol version (47 for 1.8.9)
serverAddressString (max 255)Hostname the client connected to
serverPortunsigned shortPort the client connected to
requestedStateVarInt1=STATUS, 2=LOGIN

Wire Encoding

FieldTypeNotes
Protocol VersionVarInt47 for 1.8.9
Server AddressStringHostname or IP
Server Portunsigned shortBig-endian uint16
Next StateVarInt1=Status, 2=Login

MCP References

MCPNetHandlerHandshakeTCP.processHandshake()
MCPNetHandlerHandshakeMemory.processHandshake()

Handler Interface

HNDINetHandlerHandshakeServer

Notes

Determines whether the connection enters STATUS or LOGIN state. Sent by GuiConnecting.java during server connection, Minecraft.java for local singleplayer, OldServerPinger.java for server list pinging, and RealmsConnect.java for Realms. The requestedState field is critical: value 1 enters STATUS (used by server pinger), value 2 enters LOGIN (used for actual gameplay).

Vanilla Source

C00Handshake.java67 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.handshake.client;
2
3
import java.io.IOException;
4
import net.minecraft.network.EnumConnectionState;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.handshake.INetHandlerHandshakeServer;
8
9
public class C00Handshake implements Packet<INetHandlerHandshakeServer>
10
{
11
    private int protocolVersion;
12
    private String ip;
13
    private int port;
14
    private EnumConnectionState requestedState;
15
16
    public C00Handshake()
17
    {
18
    }
19
20
    public C00Handshake(int version, String ip, int port, EnumConnectionState requestedState)
21
    {
22
        this.protocolVersion = version;
23
        this.ip = ip;
24
        this.port = port;
25
        this.requestedState = requestedState;
26
    }
27
28
    /**
29
     * Reads the raw packet data from the data stream.
30
     */
31
    public void readPacketData(PacketBuffer buf) throws IOException
32
    {
33
        this.protocolVersion = buf.readVarIntFromBuffer();
34
        this.ip = buf.readStringFromBuffer(255);
35
        this.port = buf.readUnsignedShort();
36
        this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer());
37
    }
38
39
    /**
40
     * Writes the raw packet data to the data stream.
41
     */
42
    public void writePacketData(PacketBuffer buf) throws IOException
43
    {
44
        buf.writeVarIntToBuffer(this.protocolVersion);
45
        buf.writeString(this.ip);
46
        buf.writeShort(this.port);
47
        buf.writeVarIntToBuffer(this.requestedState.getId());
48
    }
49
50
    /**
51
     * Passes this Packet on to the NetHandler for processing.
52
     */
53
    public void processPacket(INetHandlerHandshakeServer handler)
54
    {
55
        handler.processHandshake(this);
56
    }
57
58
    public EnumConnectionState getRequestedState()
59
    {
60
        return this.requestedState;
61
    }
62
63
    public int getProtocolVersion()
64
    {
65
        return this.protocolVersion;
66
    }
67
}

Deobfuscated MCP 1.8.9 source of C00Handshake, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/handshake/client/C00Handshake.java) at build time and verified present.

Deep Dive

Role in the protocol

The handshake is the first packet of every connection: a single serverbound C00PacketHandshake carrying the protocol version, the server address as a length-prefixed string, the destination port, and an int state (1 = status, 2 = login). It is sent exactly once, before any encryption, and its state field selects which protocol machine the server runs next. Nothing in the 8 reference clients constructs or intercepts it at runtime; the MCP code path that builds it lives in GuiConnecting.attemptHandshake and the integrated-server path skips it entirely.

Why clients do not touch it

grep of all 8 reference sources (Memeware 7.3, Nekoware v1 private, Rise 5.99, Rise 6.1.30, Rise 6.2.4, Sigma 4.11, Spicy, Tenacity 6.0) returns zero module references to C00PacketHandshake. The reasons are structural: it is sent once before the game world exists, so there is no per-tick module hook active; the vanilla client builds it from GuiConnecting state that modules never influence; and the server trusts its fields for routing only. The one place clients historically touch it is a server-list pinger spoofing protocol version 1 (or 0) to enumerate servers, which these 8 clients do not implement.

Vanilla handling

NetHandlerHandshakeTCP.processHandshake reads the state int. State 1 routes the connection to the status handler (NetHandlerStatusServer), state 2 to the login handler (NetHandlerLoginServer). Mojang's version of the packet also carries a second address string (the 'hostname the client thinks it is connecting to'), which proxies and BungeeCord-style setups use for server routing. The server compares the protocol version against its own and answers with a disconnect or LoginDisconnect if the client is too old or too new.

Exploit surface

Because the packet is unencrypted and fully client-controlled, its real abuse is server-side: protocol-version lying (clients claiming an older version than they speak), hostname injection for proxy routing, and state-flip confusion (sending state 1 then 2) which some anti-bot plugins used to fingerprint scanners. For a client cheat, the packet is a dead end: no timing, no per-tick value, no server-side math to abuse. This is why every one of the 8 clients leaves it to vanilla.

Server-Side Handling

NetHandlerHandshakeTCP.processHandshake validates the protocol version against the server's registered versions and selects the next state machine from the state int (1 = status, 2 = login). A mismatched version produces an immediate disconnect (S00PacketDisconnect in login state) or a protocol-error kick. The embedded hostname is used by proxy frontends to route the connection; vanilla singleplayer and most offline servers ignore it.

Protocol Analysis

Wire format: VarInt protocol version, String server address (VarInt length prefix), Unsigned Short port, VarInt next state. Sent over an unencrypted, uncompressed channel. The 1.8.9 protocol version is 47. After this packet the connection switches state machines, and the next serverbound packet must match the chosen state.

Anti-Cheat Landscape

Anti-cheats almost never inspect the handshake because it arrives before the play state and before any player entity exists. The relevant detection is proxy/ban management: plugins (AntiVPN, server-list bots) fingerprint scanners by protocol-version lies or by abnormal status-then-login sequences. None of the 8 clients participate in that game.

implementation Implementation Cases

The one-shot connection preamble: protocol version, hostname, port, and target state. None of the 8 reference clients touch it at runtime, because it is sent once before any module hook exists and carries no per-tick state to exploit.

anticheat Anti-Cheat Checks

The handshake is the first packet on the connection and arrives before any anticheat pipeline exists, so no check in the corpus runs on it. The corpus hits are keyword noise from the proxy and Bungee search terms: chat-component imports, proxy registries and config flags. The only real processing is at the packet-library level, where Artemis decodes GPacketHandshakeClientSetProtocol in ArtemisDecoder.handleHandshake and routes the next-state field into the player profile, and Negativity intercepts PacketType.Handshake.IS_SET_PROTOCOL in its channel inbound handler. Both are infrastructure that establishes protocol state, not checks.

Wiki Cross-Reference

The vanilla server does not use the Server Address or Server Port fields for anything; they exist for proxies and server routing, so address spoofing only matters on BungeeCord-style setups.

By convention a client pinging only to determine the server version should send protocol version -1 in the handshake.

The handshake should be sent immediately after opening the TCP connection or the server may disconnect, and servers should also still accept the legacy 0xFE server list ping which uses a nonstandard non-length-prefixed format.

MCP 1.8.9 C00Handshake implements Packet dispatching to INetHandlerHandshakeServer.processHandshake; wire serde is readPacketData/writePacketData via readStringFromBuffer, readUnsignedShort, readVarIntFromBuffer.

1.8.9 callers: Minecraft.? sends new C00Handshake (line 2338) +4 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/Minecraft.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.