You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is a bit nasty because RakNet's protocol is poorly designed, but it does the job.
A CRC32 is computed from the remote IP, port, and a cryptographically secure random salt
which is known only to the server and is rotated every 5 seconds.
This is similar to the approach taken by gophertunnel.
This approach is preferred over completely random cookies because we
don't have to keep a map of client address -> cookie for verification
this way, which means that spoofed IPs can't flood the server memory
with useless cookies.
This feature may be disabled by setting the rotation interval to 0 in the Server constructor.
Notably, OVH has their own anti-spoofing measure that uses a fake random MTU size, and their
defences are known to not work with these cookie checks as seen with
other projects.
$this->logger->warning("Mismatched cookies detected $mismatches times since last rotation - RakLib may be experiencing an attack from spoofed IP addresses");
//don't log this by default, we don't want to let an attacker LogDoS us
140
+
//we also don't block the IP since this is probably coming from a spoofed IP
141
+
//$this->server->getLogger()->debug("Not creating session for $address due to cookie mismatch (expected $cookie1 or $cookie2, but got $packet->cookie)");
142
+
returntrue;
143
+
}else{
144
+
$this->server->getLogger()->debug("Cookie check succeeded for $address with cookie $packet->cookie (cookie1: $cookie1, cookie2: $cookie2)");
145
+
}
146
+
}else{
147
+
$this->server->getLogger()->debug("No cookie check performed for $address");
148
+
}
149
+
88
150
if($packet->serverAddress->getPort() === $this->server->getPort() or !$this->server->portChecking){
89
151
if($packet->mtuSize < Session::MIN_MTU_SIZE){
90
152
$this->server->getLogger()->debug("Not creating session for $address due to bad MTU size $packet->mtuSize");
0 commit comments