Solved Changing Join Game packet to spoof hashed seed

Discussion in 'Spigot Plugin Development' started by Gadse, Jul 14, 2020.

  1. Hello,

    I'm currently trying to think of ways to combat seed cracking since it's been made relatively popular by hacked clients.

    Since a few versions, Minecraft now sends the first 8 bits of the seed as a hash to the client in the join game packet and that's how the most popular seed cracker currently searches for the seed.

    Is it possible to modify that packet? I would imagine it should be possible with ProtocolLib, however, this is my first time working with it, so I'm not sure if it does work or if it would break the client from rendering certain things.

    Any input or ideas would be appreciated.

    // EDIT
    I researched a bit and assume that it's the PacketType.Play.Server.LOGIN packet in protocol lib.
    Accessing its fields doesn't enlighten me much on how to change a specific part of it though.
     
    #1 Gadse, Jul 14, 2020
    Last edited: Jul 14, 2020
  2. Why does the client even need to know that information, seems a bit weird to me.

    https://wiki.vg/Protocol#Join_Game

    Could maybe write the packet with ProtocolLib but idk what packet it would be, I thought it would be Play.Server.Login, maybe it is but not sure.
     
  3. Same. As I posted, I'm already highly positive on which packet it is, I'm just not sure if I can modify it, if so how and finally which consequences it would have on the client. I can test out the last thing myself if no one has any idea, I pretty much just need assistance on the modifying part of it.
     
  4. Truly weird, I do currently send a seed set to 0 in my project and the client doesn't reject anything.

    Isn't it possible to catch the join packet before it is sent and change the seed field?
     
  5. If this helps at all, this is how I change the players level in the XP packet with PLib.

    Code (Text):
            ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(instance, ListenerPriority.HIGHEST, PacketType.Play.Server.EXPERIENCE) {
                @Override
                public void onPacketSending(PacketEvent event) {
                        final Player player = event.getPlayer();
                        final PacketContainer packet = event.getPacket();
                        try {
                            // Level will be 12345
                            packet.getIntegers().write(1, 12345);
                        } catch (final FieldAccessException exception) {
                            exception.printStackTrace();
                        }
                        event.setPacket(packet);
                    }
            });
     
  6. Thanks, that's exactly what I needed. Their wiki didn't describe that at all.

    Working code:
    Code (Java):
    ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.LOGIN) {
        @Override
        public void onPacketSending(PacketEvent event) {
            PacketContainer packet = event.getPacket();
            try {
                packet.getLongs().write(0, 0L);
            } catch (FieldAccessException exception) {
                exception.printStackTrace();
            }
            event.setPacket(packet);
        }
    });
    [​IMG]
     
    • Useful Useful x 1
  7. #7 Gadse, Jul 14, 2020
    Last edited: Jul 15, 2020
    • Useful Useful x 1