forked from zonde306/l4d2sc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSendFileExploitFixV2.sp
81 lines (68 loc) · 1.71 KB
/
SendFileExploitFixV2.sp
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
74
75
76
77
78
79
80
81
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "SendFile Exploit Fix",
author = "backwards",
description = "Prevents Clients From Exploiting The Un-Patched SRCDS SendFile Command. (HackerOne.com Report #472858 (Thanks For Ignoring My 8 Month Old Report!))",
version = SOURCEMOD_VERSION,
url = "http://www.steamcommunity.com/id/mypassword"
}
#define MAX_FILES_ALLOWED_WHILE_ACTIVE_PER_MAP 256
bool InLevel[MAXPLAYERS+1] = {false, ...};
int RequestCount[MAXPLAYERS+1] = {0, ...};
public OnPluginStart()
{
CreateTimer(5.0, DecrementThread, _, TIMER_REPEAT);
}
public Action:DecrementThread(Handle:timer, any:unused)
{
for (new client = 0; client <= MaxClients; client++)
{
RequestCount[client] -= 32;
if(RequestCount[client] < 0)
RequestCount[client] = 0;
}
return Plugin_Continue;
}
public OnMapStart()
{
for (new client = 1; client <= MaxClients; client++)
if(IsClientConnected(client))
if(IsClientInGame(client))
{
InLevel[client] = true;
RequestCount[client] = 0;
}
}
public OnMapEnd()
{
for (new client = 1; client <= MaxClients; client++)
{
InLevel[client] = false;
RequestCount[client] = 0;
}
}
public OnClientPutInServer(client)
{
InLevel[client] = true;
RequestCount[client] = 0;
}
public OnClientDisconnect(client)
{
RequestCount[client] = 0;
}
public Action OnFileSend(int client, const char[] sFile)
{
if(InLevel[client])
{
RequestCount[client]++;
if(RequestCount[client] > MAX_FILES_ALLOWED_WHILE_ACTIVE_PER_MAP)
{
if(!IsClientInKickQueue(client))
KickClient(client, "ServerCrashExploitAttempt.");
return Plugin_Stop;
}
}
return Plugin_Continue;
}