Overriding password checks (by hooking ConnectClient) used for Discord integration #834
Replies: 5 comments 10 replies
-
|
neat stuff here, thanks for sharing! here are the windows signatures:
I'd suggest to use a proper gamedata file instead of hardcoding these in production code |
Beta Was this translation helpful? Give feedback.
-
|
instead of // var netAddr = Marshal.PtrToStructure<Netadr>(hook.GetParam<nint>(2));
public struct Netadr
{
public enum NetadrType : int
{
NA_NULL = 0,
NA_LOOPBACK,
NA_BROADCAST,
NA_IP
}
private readonly NetadrType _type;
private readonly int _ip;
private readonly ushort _port;
public readonly NetadrType Type => _type;
public readonly string Ip => $"{_ip & 0xFF}.{(_ip >> 8) & 0xFF}.{(_ip >> 16) & 0xFF}.{(_ip >> 24) & 0xFF}";
public readonly ushort Port => BinaryPrimitives.ReverseEndianness(_port);
public override readonly string ToString() => _type switch
{
NetadrType.NA_LOOPBACK => "loopback",
NetadrType.NA_BROADCAST => "broadcast",
NetadrType.NA_IP => Ip,
_ => "unknown"
};
public readonly string ToString(bool onlyBase)
{
var @base = ToString();
if ( !onlyBase && _type == NetadrType.NA_IP )
{
return $"{@base}:{Port}";
}
return @base;
}
} |
Beta Was this translation helpful? Give feedback.
-
|
@AshleighAdams thanks for the code! Here is my impetration of it https://github.com/5stackgg/game-server/blob/main/src/FiveStack.Events/InitConnect.cs |
Beta Was this translation helpful? Give feedback.
-
|
Updated the Linux signatures, I'm guessing the Windows ones changed too? But maybe not though as I think most the breakages here are from updating the compiler. If anyone wants to take a look at the Windows's sigs, feel free. New Linux signatures are: |
Beta Was this translation helpful? Give feedback.
-
|
07/12/2025 cs2 update: CNetworkGameServerBase::ConnectClient: |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone, I help run some CS2 servers for the CS:GALS community, for which I've been working on Discord integration, and I'd like to share the crucial parts of the CounterStrikeSharp plugin that allowed this to happen.
In short, when a player from our Discord wants to connnect, things follow this flow:
On the supporting web server:
steam://connect/ip:port/passwordwhere the password is the generated cookieIn the CS# plugin:
Interesting parts of code, minus specific integrations (e.g. webhooks, role granting):
Those signatures could maybe do with some improvement, the comments have some unique strings to help you find them again in Ghidra/IDA Pro, I didn't feel like grabbing the Windows binaries either to get the Windows function signatures, but it shouldn't be too hard to find
Update
Thanks to @Cruze03 and @Vauff, you can get the unsafe and unauthenticated steam id like so:
Beta Was this translation helpful? Give feedback.
All reactions