After a long study on Warden stuff, I finally added an anti-warden feature on my own bot.
This is how I implement:
1) Hook LoadWardenModule (using VirtualAlloc within this function)
PHP Code:
.text:00BF7CF5 push 4 ; flProtect
.text:00BF7CF7 push 1000h ; flAllocationType
.text:00BF7CFC push eax ; dwSize
.text:00BF7CFD push 0 ; lpAddress
.text:00BF7CFF call ds:VirtualAlloc
We care about two values:
A) dwSize (eax)
B) the new allocated base address, after calling VirtualAlloc, read from eax.
2) Find WardenScan
Search it from WardenBase(B), size (A), using pattern (74 02 F3 A5 B1 03 23 CA), you can simply find WardenScan, like this (only available after LoadWardenModule):
PHP Code:
0677784F - 56 - push esi
06777850 - 57 - push edi
06777851 - FC - cld
06777852 - 8B 54 24 14 - mov edx,[esp+14]
06777856 - 8B 74 24 10 - mov esi,[esp+10]
0677785A - 8B 44 24 0C - mov eax,[esp+0C]
0677785E - 8B CA - mov ecx,edx
06777860 - 8B F8 - mov edi,eax
06777862 - C1 E9 02 - shr ecx,02
06777865 - 74 02 - je 06777869 >>> we care only this part
06777867 - F3 A5 - repe movsd
06777869 - B1 03 - mov cl,03
0677786B - 23 CA - and ecx,edx
0677786D - 74 02 - je 06777871
0677786F - F3 A4 - repe movsb
06777871 - 5F - pop edi
06777872 - 5E - pop esi
06777873 - C3 - ret
Place an inline hook after (shr ecx, 02):
PHP Code:
__asm
{
// Save params
mov dwScanAddress, esi // bytes source
mov dwScanLength, edx // scan length
mov dwDest, edi // original dest
// We will copy the bytes to our own buffer
lea edi, pByteTmp
// continued from (shr ecx, 02)
je JeSingle1
repe movsd
JeSingle1:
mov cl, 03
and ecx, edx
je JeDetour
repe movsb
JeDetour:
push dwScanLength
push dwScanAddress
call WardenGetRealBytes // replace real bytes (you must save them before modifying / hooking)
add esp, 0x8
cld
// ok, fool Warden using our own buffer
lea esi, pByteTmp // set source
mov edi, dwDest // restore dest
mov edx, dwScanLength // length
mov ecx, edx
shr ecx, 02
je JeSingle2
repe movsd
JeSingle2:
mov cl,03
and ecx, edx
je JeExit
repe movsb
JeExit:
pop edi
pop esi
jmp dword ptr dwGetBack; //Jump back...
};
3) done, just log those bytes/length, and verify with WardenMon
Hmm, I'm new to bot programming, If something is wrong, please correct me, thanks in advanced.