dreamstalker / rehlds

Reverse-engineered HLDS
GNU General Public License v3.0
625 stars 165 forks source link

Implemented reduction of impact caused by zip-bomb exploit #994

Closed s1lentq closed 2 months ago

s1lentq commented 7 months ago

This PR enhance security by controlling the decompression of incoming network data buffer to avoid server hangs and another potential risks associated with zip bomb attacks.

Added network security CVars:

fred0r commented 7 months ago

sv_net_incoming_decompression_punish doesnt return any value in serverconsole?!

fred0r commented 7 months ago

thx

fred0r commented 7 months ago

so when sv_allowupload 0, sv_net_incoming_* doesnt matter?

drag1c commented 7 months ago

Tested, both players were using GS Client, both got kicked with message Malformed/abnormal compressed data. Used default values for cvars.

s1lentq commented 7 months ago

Tested, both players were using GS Client, both got kicked with message Malformed/abnormal compressed data. Used default values for cvars.

Try raise value of the cvar sv_net_incoming_decompression_max_ratio by step +1.0 until false positives is gone

p.s can you capture incoming traffic into pcap format from these clients and share it to my mail?

s1lentq commented 7 months ago

so when sv_allowupload 0, sv_net_incoming_* doesnt matter?

sv_allowupload allows you to upload file fragments, but this PR coverage only normal fragments, so it doesn't matter

drag1c commented 7 months ago

Tested, both players were using GS Client, both got kicked with message Malformed/abnormal compressed data. Used default values for cvars.

Try raise value of the cvar sv_net_incoming_decompression_max_ratio by step +1.0 until false positives is gone

p.s can you capture incoming traffic into pcap format from these clients and share it to my mail?

a bit challenging but I will try, just to catch guys who had issue.

RauliTop commented 2 months ago

@s1lentq Just write you to clarify about this. The information here exposed is probably too much technical. We need more simple explanation.

When the decompression is being used? I mean, what clients use it. For example, on GSClient, is working without decompression too?

How about if I disable the main cvar. Can players enter in the server?

s1lentq commented 2 months ago

@s1lentq Just write you to clarify about this. The information here exposed is probably too much technical. We need more simple explanation.

Clients mainly use compression (and as a result, decompression on server side) when precaching resources to reduce the size of the packet. In-game stage, compression isn't used much.

When the decompression is being used? I mean, what clients use it. For example, on GSClient, is working without decompression too? How about if I disable the main cvar. Can players enter in the server?

All clients without exception, use compression. If decompression is disabled, those clients won't be able to connect to server because the server won't be able to handle them anymore It's not really a good idea to set sv_net_incoming_decompression to 0, this CVar there added for technical reasons