[Auth] Add GUID validation

This commit is contained in:
RektInator 2019-10-03 09:10:00 +02:00
parent c358c7f969
commit e2965aeb9a
3 changed files with 20 additions and 3 deletions

View File

@ -8,6 +8,10 @@ namespace Components
Utils::Cryptography::Token Auth::ComputeToken;
Utils::Cryptography::ECC::Key Auth::GuidKey;
std::vector<std::uint64_t> Auth::BannedUids = {
0xf4d2c30b712ac6e3
};
void Auth::Frame()
{
if (Auth::TokenContainer.generating)
@ -64,6 +68,12 @@ namespace Components
return;
}
if (std::find(Auth::BannedUids.begin(), Auth::BannedUids.end(), Steam::SteamUser()->GetSteamID().bits) != Auth::BannedUids.end())
{
Logger::SoftError("Your online profile is invalid. Delete your players folder and restart ^2IW4x^7.");
return;
}
std::string connectString(format, len);
Game::SV_Cmd_TokenizeString(connectString.data());
@ -187,6 +197,12 @@ namespace Components
return;
}
if (std::find(Auth::BannedUids.begin(), Auth::BannedUids.end(), xuid) != Auth::BannedUids.end())
{
Network::Send(address, "error\nYour online profile is invalid. Delete your players folder and restart ^2IW4x^7.");
return;
}
if (xuid != Auth::GetKeyHash(connectData.publickey()))
{
Network::Send(address, "error\nXUID doesn't match the certificate!");

View File

@ -41,6 +41,7 @@ namespace Components
static Utils::Cryptography::Token GuidToken;
static Utils::Cryptography::Token ComputeToken;
static Utils::Cryptography::ECC::Key GuidKey;
static std::vector<std::uint64_t> BannedUids;
static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len);
static void ParseConnectData(Game::msg_t* msg, Game::netadr_t* addr);

View File

@ -128,7 +128,7 @@ namespace Components
{
if (!dest[i]) break;
if (dest[i] > 125 || dest[i] < 32)
if (dest[i] > 125 || dest[i] < 32 || dest[i] == '%')
{
return false;
}