Doug’s Projects

Source code for some of these projects is available at https://bitbucket.org/Douggem just log in with the credentials given in the resume!

ObRegisterCallbacks research

I reversedObRegisterCallbacks and the structures it creates in order to research a solution to Anti-cheat kernel modules protecting game processes.  You can see the results here:

https://douggemhax.wordpress.com/2015/05/27/obregistercallbacks-and-countermeasures/

SKiDE

SKiDE is a script development tool targeted at Arma 3.  It has common IDE features such as syntax highlighting and auto completion, but it also has some Arma specific features like enumeration of script threads and script variables.  It will also, if connected to the game, show the value of variables in a script if the user hovers the mouse over the variable.  SKiDE is still early in development but is already complete enough to be a very strong tool for script development as it offers the user a real-time glimpse into the execution of their scripts.

Peacekeeper Drone

Peacekeeper is an application that acts as a radar for Real Virtuality games.  It reads memory from the target game, finds and parses data structures in the game’s memory, and presents it to the user in the form of a map.  It also allows a small degree of object manipulation, such as changing the user’s weapon properties.  For example, the user can increase the damage his weapon does, eliminate the weapon’s recoil, or make his handgun shoot missiles.

Source available at https://bitbucket.org/Douggem/peacekeeper by logging in with the credentials included in the resume.

Continue reading →

Fallout76 server anti-cheat check strings

These are dumped from the binary that launched with the game.  They are unreferenced in the client and appear to be optimized out of later versions, but they may give some insight into the checks the FO76 server does on client data.

At least *some* of these checks were not implemented or not enforced in early versions of the game, as I was able to teleport with impunity up through early this year when I quit playing the game.  But it appears that they at least had a framework available to do these checks.  When I first started hacking FO76 I was actually impressed by the client/server architecture, as I was unable to do things like edit inventory, stamina, health, etc. as the server would send an entity snapshot and reset my changes.  Editing things like storage space in those crates you can put down appeared to work on the client, but the server would reject putting things into the stash that was full even though my client believed it was not full.

The only interesting things I was able to do before I quit trying were teleport/flying, stupid aimbot, infinite ammo, and adjusting the size of the magazine loaded into the current weapon.  The magazine thing was most useful, as I could fire things like the double barrel shotgun without having to reload, but it only worked some of the time.  I’m guessing that there’s peer to peer functionality in the game and the handling of NPCs is offloaded to clients, so if I was in an area by myself the infinite ammo would work, but if another PC was nearby it sometimes wouldn’t, I think because their client became authoritative over the area.

The strings appear to be in the form of:

Check name
Check class name or something
Check description
Check relevant values

Continue reading →

How to get caught by Fallout’s anti-cheat

You probably aren’t hacking Fallout 76 because you probably aren’t playing it at all.  But if the new Battle Royale seems attractive to you here are a few easy and simple ways to get caught by their anti-cheat.

EnumWindowsTask

What it does:

Looks for windows with titles that contain ‘bad word’ substrings

How it does it:

download (1)

Each of the three primary anti-cheat scans are implemented as IOTasks, created, dispatched, and destructed with each iteration of the anti-cheat scanning loop.  The EnumWindowsTask is the first.  The scan is started by IOManager::ExecuteIOTask, which looks something like this:

Continue reading →

ObRegisterCallbacks and countermeasures

Because anti-virus softwares were hardhooking the Windows kernel to intercept WinAPI calls when processes were opening files and stuff, Microsoft implemented official and supported methods for receiving notifications for certain events and acting on them.  For instance, when a user launches an executable file, an anti-virus software can be alerted and can scan the file for malicious signatures before launching it.  Or, as is the case in the context of the research that led to this posting, an anti-cheat software can be alerted when a process is attempting to open a handle to the protected game and deny that handle privileges.

This is achieved by registering a callback function for a given event in the kernel using the function ObRegisterCallbacks.  You can see its MSDN article here https://msdn.microsoft.com/en-us/library/windows/hardware/ff558692%28v=vs.85%29.aspx

The short of it is, if you fill out some information regarding what you want to watch and what function you want called when the kernel needs to alert you and pass it to that function, your callback will be called at the appropriate time and you can take appropriate action.  The function returns a handle that you can later use to unregister the callback using ObUnRegisterCallbacks.  This is necessary if your driver unloads because if you left your callback in place and unloaded your driver the callback would probably cause a nice big bugcheck.

This is very annoying when anti-cheats such as Battleye and EasyAntiCheat leverage the callback system to lock down a process and prevent cheaters from reading or manipulating the process memory.  There already exist numerous ways  of countering the callbacks, such as implementing reading/writing functions in your own driver that don’t rely on the standard Windows method of reading from a file.  I wanted to do something a little cleaner, though, and hopefully enable non-modified software access to the protected process.

Continue reading →

How to make a DayZ Standalone admin menu

Hey fellow DayZ admins!  Keeping cheaters out of your servers can be hard, and we don’t have a lot of official admin tools yet, so I’m releasing info on creating your own admin tool!

Back in November when the BE Kernel Module for SA was going to be in the “next patch”, I said I was going to release admin menu and injector source when it went live. At the time I expected “next patch” to be in a few weeks, not months. In the time since I made that promise the kernel module has improved, breaking the user mode methods I was using to inject (including a really slick modified PBO that callextensioned your admin menu which hid the modified PBO – I was pretty proud of it even if it was stupid!). It’s all kernel now. Since things have changed, I’m having to alter my release. Instead of admin menu source and injector source, I’m going to release basic admin menu source with detailed explanations of how to flesh it out into your own personal admin menu.

The reason for this is because I’d rather enable people to make their own admin menus than just give them admin menus, and also because there are about a hundred 12 year olds waiting for me to release something so they can start selling it on Skype. This way they’ll actually have to do some work themselves to get a working sellable admin menu which I don’t expect any of them to do.

1 – Introduction

Well shit dawg, the Battleye kernel module just went live (at the time when I started writing this)! It’s blocking access to the DayZ process from our external admin menus. What ever will we do guys? In the words of Eugen Harton, no admin menuers anymore

This image has been resized. Click this bar to view the full image. The original image is sized 638×360.


Continue reading →

Simple script injection – OnEachFrame

So I learned about OnEachFrame the other day https://community.bistudio.com/wiki/onEachFrame and thought I’d take a look at it.


As you can see, all it does is take the ArmaString pointer from the argument object and put it in a global GameValue object. That’s it – that’s all OnEachFrame is. It’s a global GameValue object that has its text, if there is any, executed on each frame. So I figured, why not make a really simple executor from it?

</div>
<div>// A2 allocator.  Not used for everything.</div>
<div class="alt2" dir="ltr">typedef void *(WINAPI* A2Malloc)(SIZE_T);
typedef void (WINAPI* A2Free)(void*);
A2Malloc MemAlloc = *(A2Malloc*)0xDBF2A0;
A2Free MemFree = *(A2Free*)0xDBF2A4;
// To get with sig:
/*
DWORD mallocObject = DUtils::findPatternPlusBytes((DWORD)a2oaModule, (DWORD)a2LastModuleByte, "FF 15 ? ? ? ? 8B F8 85 FF 75 54", 2);
MemAlloc = *(A2Malloc*)mallocObject;
MemFree = *(A2Free*)(mallocObject + 4);*/


class ArmaString {
public:
int References;
int StringLength;
char AString[1];

// Call this to create a new ArmaString.  We're basically using it as a constructor without setting up an actual Allocator for A2Malloc
static ArmaString* CreateArmaString(const char* text) {
if (!text) return 0; // you're retarded

int length = strlen(text);
ArmaString *newArmaString = (ArmaString*)MemAlloc(length + 9);
if (!newArmaString) return nullptr;        // Shouldn't happen, if your MemAlloc pointer is wrong you'll crash on the call unless you get REALLY lucky
newArmaString->References = 1;
newArmaString->StringLength = length;
memcpy(&newArmaString->AString, text, length + 1);

return newArmaString;
}
};
// Kept the inheritance model in case you guys want to do things with scalars or some shit.
class GameData {
public:
void* GameDataTypeVTable;
int References;
void* DebugValueVTable;
};

class GameDataString : public GameData {
public:
ArmaString* Data;

// Calling the engine's constructor is going to be easier than manually doing our own.
typedef GameData* (__thiscall* GDConstructor)(GameData* thisptr, ArmaString* initialValue);
static GDConstructor Constructor;
GameDataString(ArmaString* initialValue) {
if (Constructor != nullptr) // If your constructor pointer is null, your object is going to be empty and you're going to crash
Constructor(this, initialValue);
References++;
}
};
// 0x9D51CB.  No unique sig, other ways to find it programatically at runtime
GameDataString::GDConstructor GameDataString::Constructor = (GameDataString::GDConstructor)0x9D51CB;

class GameValue {
public:
void* GameValueVTable;
GameData* Value;
};

GameValue* OnEachFrame = (GameValue*)0xDB0614;

void InjectScript(const char* scriptText) {
ArmaString* script = ArmaString::CreateArmaString(scriptText);
GameDataString* data = new GameDataString(script);
OnEachFrame->Value = data;
}

void ExecuteScriptFile(std::string filePath) {
// execVM "filePath"; onEachFrame{};
// gotta clear the onEachFrame event since I know you tards won't do it yourselves
std::string scriptText = "execVM \"" + filePath + "\"; onEachFrame{};";
InjectScript(scriptText.c_str());
} 


Super simple, able to be done externally without any nasty CreateThread function calls from the outside (pump up the reference count on your strings and GameData objects so they don’t get freed by Arma), and very stable.  Will port to A3 and SA very soon.

DayZ Standalone script function descriptions and addresses

The Real Virtuality engine keeps a sort of catalog of script engine functions, descriptions, and examples in memory while it’s running.  This catalog is walked by the script VM when searching for a script function, and it can be dumped to easily get an enumeration of script engine functions.  This is a dump of the latest catalog for the DayZ Standalone, and can be used to easily find script function addresses to reverse them.  It’s linked as a private paste because it’s so massive and WordPress is weird about formatting: http://privatepaste.com/325702e386/Douggem

Battleye script bypass through object manipulation

This is going to be a little messy. There are better ways (multiple vtables you can hook, also you can change a pointer in a script VM context to stop an individual thread from reporting to BE, etc.) but this has the advantage of not requiring any hooks, whether hard hooks or vtable hooks, which makes it considerably less detectable by Battleye, which currently checks a couple locations to check for BE Callback function VTable modifications. The giant disadvantage is you have to predict how the script engine will parse your scripts, which could be difficult.

Every time your client executes a script, it’s broken into expressions that are executed by the script engine. These expressions are pushed through a series of functions that eventually end up at Battleye’s callback function if you are in a multiplayer game with Battleye enabled. After it runs through Battleye’s callback function, it’s added to an AutoArray of recently run script expressions. Then, the next time a script is run, it’s checked against the array of recent expressions and if it matches one of these expressions perfectly (a map exists a few bytes earlier in the function, if the key for that expression exists in the map, it isn’t sent to Battleye for processing)

This image has been resized. Click this bar to view the full image. The original image is sized 1274×772.

I’m sure you all see where this is going.

The script expressions are just regular c strings – they’re pointers to character arrays with ascii strings of the expression.

This image has been resized. Click this bar to view the full image. The original image is sized 1446×816.

It’s in the NetworkClient class, the same place that links to your scoreboard. It’s at 0xDEEAE8 + 0x24] + 0x1DC. It contains a max of 200 expressions, and is a FIFO queue. So if you know you need to run a couple of expressions that will get you kicked, you could add these expressions to the end of the queue and run these expressions and these expressions would not be run through Battleye’s callback function, bypassing the server side script restriction filters in many cases and bypassing Battleye’s client side script detections entirely.

Engine rendering with object manipulation in A2OA

This image has been resized. Click this bar to view the full image. The original image is sized 1900×1002.

D3D is hard.

With Battleye hook scanning D3D Endscene and Present and apparently being very liberal about deciding what is and is not a hack, I had to find some alternative to hardhooking Present. I could have made an overlay or something, but since I’m a masochist I decided instead to investigate how the Arma engine draws on the screen.

Continue reading →

Controlling other players in A2OA

Scripters take control of people with three script functions:

  • RemoteControl
  • changeCamera
  • SelectPlayer

Only one of those is necessary. SelectPlayer actually does changeCamera on its own, and remoteControl is for controlling turrets, not players.

This image has been resized. Click this bar to view the full image. The original image is sized 1027×765.

Code:
Name: 		selectPlayer
Name (Long): 	selectplayer
Arg1: 		unit
Description: 	Switch player to given unit.
Example Use: 	selectPlayer aP
Category: 	General
Function: 	0x7ADF17

That’s selectPlayer. It does a lot. It messes with the AIBrain in the entities, then does things with the network managers and network clients if you’re in multiplayer, and sends a message to the server in one of those networkManager functions. That message is important, because it tells the server to give your client locality over the target. This is why if you set your local player pointer to the entity of another player, nothing you do to them ‘sticks’. If you move, you get pulled back. If you fire, their ammo goes down but no bullet comes out. All you can do is things on the scroll wheel, and that’s why: you don’t have locality of that entity, so the server doesn’t accept your changes to it.

So by calling selectPlayer, we can get locality of the target. Then, any changes we make ‘stick’, and the previous owner of the entity’s changes don’t ‘stick’. So when you take control of someone, whenever they move, they get pulled back. When they fire, the ammo count goes down but no bullet comes out. Sounds familiar, right?

Calling selectPlayer is easy. The first argument is a buffer in which it can build a gameValue object, just make an 8 byte buffer for that. The second argument is sometimes the GameState object, and sometimes 0. selectPlayer never actually uses this argument, so passing it 0 is safe. The third argument is what I call unitInfo, it’s the link object that points to an entity. Like dfcdd8] + 13a8].

And that’s all there is to it. Give it a second or two and you’ll be controlling your target completely.

PHP Code:
selectPlayer( buffer, 0, target );