20 Commits

Author SHA1 Message Date
Kawe Mazidjatari
7e247d9943 Create separate cvar to enable Base_CmdKeyValues netmsg's
The server can exploit the client with these netmessages, therefore, sv_cheats shouldn't be used to toggle it. Create a cvar that the server and client have to enable individually to enable the system.
2023-09-04 09:48:47 +02:00
Kawe Mazidjatari
71b0781715 Utilize 'DevMsg()' for uncertain builds only
Only uncertain builds will contain DevMsg()/DevWarning() prints. For retail, Msg() and Warning() should be used instead.
2023-08-21 19:12:29 +02:00
Kawe Mazidjatari
f6650df951 Remove 'SVC_PlaylistOverrides' patch
Only block 'CLC_SetPlaylistVarOverride' messages when cheats are disabled. The server still needs to be able to override client playlist vars (using 'SVC_PlaylistOverrides'). This isn't a problem, as on any disconnect, the client will reload its own bundled copy.
2023-07-08 03:07:19 +02:00
Amos
e9335d062f Fix playlist overrides exploit
Only allow playlist overrides when cheats are enabled on the server.
2023-07-07 09:14:39 +02:00
Kawe Mazidjatari
c874b7c4d8 Implement 'SVC_UserMessage' print handler properly
Check if the actual message type is 'TextMsg' before printing, since other data is binary and could be read as 'HUD_PRINTCONSOLE', 'HUD_PRINTCENTER', etc.. resulting in printing binary data. This fix permanently solves that problem. The check has also been applied to the 'ShouldReplayMessage' function.
2023-06-12 02:02:29 +02:00
Kawe Mazidjatari
b65e06a390 Make const
Make const.
2023-05-31 22:07:54 +02:00
Kawe Mazidjatari
619bbd161c Fix stringcmd replay exploit
This commit fixes an engine bug where netmessages are getting copied into the replay buffer, while these messages should never be replayed. The engine performs an internal check on 'CNetMessage::m_nGroup', and if its NOT 2, the message is getting copied into the replay buffer. All messages returning false in 'ShouldReplayMessage' are not getting copied into the replay buffer anymore. This exploit has been used in the past to route clients that were watching a replay to an arbitrary server, which essentially forms an info leak as the client attempts to connect to the arbitrary server on its own. The exploit also allows for some form of remote code execution, depending on if the client was launched in developer mode or not.
2023-05-30 23:01:46 +02:00
Kawe Mazidjatari
7870f1557a Fix 'CLC_CmdKeyValues' exploit
Fix exploitation vector that could be performed on the game client to submit commands to other game clients connected to the same server, specifically the 'OnPlayerAward' command. Base_CmdKeyValues now only works when sv_cheats is enabled. SVC/CLC_CmdKeyValues subclass 'Base_CmdKeyValues', so these messages are 'fixed' as well.
2023-04-15 02:13:29 +02:00
Kawe Mazidjatari
bd8b9e8c77 Improve server print messages
Always format with a newline if one is missing.
Calculate string size directly from 'ReadString' in 'SVC_UserMessage::ProcessImpl'.
Added additional asserts to detect code errors.
2023-04-09 22:22:06 +02:00
rexx
7a4358800d Fix potential crash from server prints 2023-04-08 16:07:43 +01:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
bb6a05cb81 More mapped out network interface classes
More interface classes directly usable with the engine.
2022-08-15 14:44:54 +02:00
Kawe Mazidjatari
e6f45aaa9b CBitBuf improvements
* Use proper types reflecting assembly from the engine in 'CBitRead::Seek' (some values are 64bit, either changed by Respawn or the compiler used by Respawn).
* Confirmed changes made to NETMSG_TYPE_BITS (now 511 instead of 255) and NETMSG_LENGTH_BITS (now 12 which is 511 max instead of 255).
* Confirmed msg HUD types.
* Enforce NET_MIN_MESSAGE on 'SVC_UserMessage::Process'.
* Remove unnecessary padding and add proper symbols where padding was actually used.
2022-08-15 02:59:41 +02:00
PixieCore
7eb6952df0 Use const in memaddr.cpp where its supposed to be. 2022-06-29 16:32:40 +02:00
Kawe Mazidjatari
1b6f40d941 Fix for SVC_UserMessage
Removed padding that was causing the structure to misalign with the game's one.
Enabled 'SVC_UserMessage::Process()' hook (function works properly after the structure alignment).
2022-06-23 18:20:17 +02:00
Kawe Mazidjatari
4b72afb74f Light refactor for logging
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.
2022-05-25 14:18:29 +02:00
PixieCore
73dd49e8d1 Start processing of unknown commands print.
* UserMessages need to be properly read like in sub_14028E890
* Started building bf_read
* Clean up will follow later.
2022-04-30 03:00:24 +02:00
PixieCore
1ea4dd6163 Moved SVC_Print::Process to a class method.
* Virtual Method Swap also points to the class method now with some dodgy memory dereferencing.
2022-04-27 18:42:49 +02:00
PixieCore
867072e814 SVC_Print::Process will print the server message to console now.
* Added new function to CMemory allowing you to hook a virtual method from a virtual method table.
* Added SVC_Print Class
* Hooked SVC_Print::Process and print the messages the server sends.
*!! Still needs verification for earlier seasons.
2022-04-27 16:29:14 +02:00