This is a placeholder page for analysis of TF2 and SRCDS
Contents |
I think inetmsghandler.h in /public contains all the info that could be in a packet. But it doesn't really go in to packet construction. I think that must be handled somewhere else, and may not be included in the source distribution.
http://www.teamfurry.com/wordpress/2007/02/25/avoiding-debugger-detection/
Turns out Valve is really, really open source minded with their resume writing code. w00t. We like this, but it also makes it super easy to hook it. Here I followed a tutorial written over at the somethingawful forums (back in 2008 - and you can't even go directly to it, thanks google cache) and combined that with Valve's SDK wiki and got a TF2 hook up and running. I've run through steps 1, 2, & 3. All work perfectly. Now what to do....
Unfortunately, it looks like Valve doesn't provide header files for all of the source so we'll probably have to do some additional debugging/reversing to get everything we want.
You can find the seperate parts of the tutorial on the following pages, as well as the assembler source for the dll injector:
Using the Darkstorm cheat source I was able to get the following cheats working:
Found the line that's causing the aimbot to die:
QAngle qPlayerAngle( 0, gPlayers[iIndex].BaseEnt( )->EyeAngles( ).y, 0 );
FCVAR_CHEAT, recommended by developer wiki to be added to any new console commands added to your mod (unless it's a legitimate console command to be executed by the player). The game server's setting 'sv_cheats' decides if cheats are enabled or not.
If a client connects to a server where 'sv_cheats 1' then any command with FCVAR_CHEAT enabled cannot be executed.
There's some good stuff about creating your own hooks here: http://forum.gamedeception.net/forumdisplay.php?f=266
There are so many forums out there dedicated to cheats and hacks. Their job is made easier with access to the SDK. One of the only stopping points for them are functions that aren't declared virtual, thereby not allowing them to be called by any inherited classes (i.e. dll hooks). This is really just a speedbump however, it doesn't truly stop someone from calling a function that they want to call.
How they go about getting over the speedbump: The general rule is to open up hl2.exe in IDA and look for the address of the function they wish to call, then just call the offset address directly. Apparently 'networked vars' (networkvar.h - http://developer.valvesoftware.com/wiki/Networking_Entities) contains a wealth of info. Need to take a peek at that file. According to one poster, what you can't find in there you can find by downloading the Linux binary. Lots of debug info is left in that file compared to the windows one.
Found a couple more good utilities on that site:
Since Valve is so open with their source they need a way to provide some sort of security for their source games. Enter VAC2 (Valve Anti-Cheat). VAC2 implies there was a VAC1, but from everything I read it was really just there to give you a warm fuzzy secure blanket feeling rather than securing anything. Apparently VAC2 isn't far off from it.
What are the challenges that VAC2 faces? First and foremost, the technical aspects of detecting a cheater isn't easy. Then, also in order to do its job effectively it needs to run in ring0 and/or scan your entire address space. Will that ever happen? Nope. Why not? Two reasons, cash and privacy. Ring0 code aint cheap. period. Ethics, Remember a little game called WoW? Ever heard of Warden? While Warden doesn't run in ring0, it does hide (really well) what it's doing from the user. In addition it scans your entire memory space for malicious code and suspect text (grabbing the titlebar of each open window). These activities brought about a slew of blog postings and remarks from privacy experts (EFF) about how WoW could be reading your emails and stealing your passwords.
How does VAC2 work? The VAC2 dll is loaded into the steam.exe process space. VAC2 sits there and looks for loaded modules in the hl2.exe process space, takes a hash of the module in memory and checks that against a signature file for known malicious hashes. That's right, signature based detection...solution: keep your cheats private.
As it turns out, hiding from VAC is much like hiding a userland rootkit. Cheaters are hackers. And some of them are good. One of these game hackers proposed the following to defeat VAC:
Everyone else on the forum agreed...overkill, but that's the level of sophistication these games are up against when it comes to protecting the quality of the game. There are a few more ways you can defeat VAC: module unlinking and removing the PE header.
Last year around August there was a (unverified) bug where a client could crash the server by entering '_resetgamestats' into the development console.