fix serialization exploit (#9)

This commit is contained in:
Kolya authored and GitHub committed 2022-08-12 11:51:06 +01:00
1 parent e1778d1013
commit 68ba8bc29d
1 file changed
+11
@@ -1,5 +1,7 @@
package com.enderio.core.common.config;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import java.io.ByteArrayInputStream;
@@ -50,9 +52,18 @@ public class PacketConfigSync implements IMessage {
ByteBufUtils.writeUTF8String(buf, modid);
}
/**
* Pa4ok
* you can trick forge network system & send client packet to server
* and then use different hacks with serialization of untrusted data
*/
@SuppressWarnings("unchecked")
@Override
public void fromBytes(ByteBuf buf) {
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
return;
}
short len = buf.readShort();
byte[] compressedBody = new byte[len];