-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For compatibility with security patches to future game servers versions this adds a 1200 byte padding to all requests packets as defined in the following HLDS mailing list post: https://www.mail-archive.com/[email protected]/msg01194.html See koraktor/steam-condenser#331
- Loading branch information
Showing
6 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* This code is free software; you can redistribute it and/or modify it under | ||
* the terms of the new BSD License. | ||
* | ||
* Copyright (c) 2020, Sebastian Staudt | ||
* | ||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License | ||
*/ | ||
|
||
namespace SteamCondenser\Servers\Packets; | ||
|
||
/** | ||
* This is used as a wrapper to create padding of request packets to a minimum | ||
* size of 1200 bytes. This was introduced in November 2020 as a | ||
* counter-measure to DoS attacks on game servers. | ||
* | ||
* @author Sebastian Staudt | ||
* @package steam-condenser | ||
* @subpackage packets | ||
*/ | ||
abstract class QueryPacket extends SteamPacket { | ||
|
||
// The minimum package size as defined by Valve | ||
const STEAM_GAMESERVER_MIN_CONNECTIONLESS_PACKET_SIZE = 1200; | ||
|
||
/** | ||
* Creates a new query packet including data padding | ||
* | ||
* @param string $data The data of the original query | ||
*/ | ||
public function __construct($header, $data = null) { | ||
parent::__construct($header, str_pad($data, self::STEAM_GAMESERVER_MIN_CONNECTIONLESS_PACKET_SIZE, "\0")); | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
lib/SteamCondenser/Servers/Packets/RequestPacketWithChallenge.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* This code is free software; you can redistribute it and/or modify it under | ||
* the terms of the new BSD License. | ||
* | ||
* Copyright (c) 2020, Sebastian Staudt | ||
* | ||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License | ||
*/ | ||
|
||
class QueryPacketTest extends PHPUnit_Framework_TestCase { | ||
|
||
public function setUp() { | ||
$this->packet = $this->getMockForAbstractClass('\SteamCondenser\Servers\Packets\QueryPacket', array(0x61, 'test')); | ||
} | ||
|
||
public function testPadding() { | ||
$this->assertEquals(str_pad("\xFF\xFF\xFF\xFFatest", 1200, "\0"), $this->packet->__toString()); | ||
} | ||
|
||
} |