I load fresh warden module into memory, initalize it, as described in skillsecurity wiki
(in pyton with ctypes it not so hard - just need to understand, what happens under the hood)
when I feed it with current RC4 state (box1, i1, j1, box2, i2, j2, err - 520 bytes total) via GetRC4Data callback
after that I give it encrypted SEED packet, captured from stream and got encrypted SEED responce via SendPacket callback - exaclty same, as live warden sent to server.
after that I read new RC4 state with i1=0 and i2=0 (i.e not used for encryption) from warden's memory (from addr, there old state was written to).
but when I try to decrypt next warden pkt with this new RC4 state - I got nonsense result.
also when I give this pkt to module, it don't do any job - PacketHandler return 0, and no callbacks fired.
what I missed ?
Code:
Loading module AF203602B6E8414A835A10B4E3DC8EEC.raw
Allocated mem for module: 0x010b0000
Copying code sections to module.
Adjusting references to global variables...
Updating API library references...
Lib: KERNEL32.dll, offset: 0x00007000
Function: GetConsoleMode, 0x7c81ac50
Function: GetStdHandle, 0x7c812fd9
Function: Sleep, 0x7c802446
HOOKED
Function: GetModuleHandleA, 0x00f70fa4
Function: TlsAlloc, 0x7c812e3f
Function: TlsFree, 0x7c813777
Function: TlsGetValue, 0x7c8097e0
Function: TlsSetValue, 0x7c809c65
Function: RaiseException, 0x7c812aa9
HOOKED
Function: GetProcAddress, 0x00f70fdc
Function: GetSystemInfo, 0x7c812df6
Function: GetVersionExA, 0x7c812b7e
Function: VirtualQuery, 0x7c80ba71
Function: QueryDosDeviceA, 0x7c85d344
Function: GetTickCount, 0x7c80934a
Function: DuplicateHandle, 0x7c80de9e
Function: CloseHandle, 0x7c809be7
Function: FreeLibrary, 0x7c80ac7e
Function: GetCurrentProcess, 0x7c80de95
HOOKED
Function: LoadLibraryA, 0x00f70fc0
Function: GetProcessHeap, 0x7c80ac61
Function: HeapFree, 0x7c90ff2d
Function: TerminateProcess, 0x7c801e1a
Function: UnhandledExceptionFilter, 0x7c863fca
Function: SetUnhandledExceptionFilter, 0x7c84495d
Function: QueryPerformanceCounter, 0x7c80a4c7
Function: GetCurrentThreadId, 0x7c8097d0
Function: GetCurrentProcessId, 0x7c8099c0
Function: GetSystemTimeAsFileTime, 0x7c8017e9
Function: RtlUnwind, 0x7c92abc5
Lib: USER32.dll, offset: 0x0000707c
Function: CharUpperBuffA, 0x7e36ae3f
Function: CreateWindowExA, 0x7e37e4a9
Function: ScrollWindowEx, 0x7e380187
Initialize Function is mapped at 0x010b263d
<-- GetModuleHandleA('kernel32.dll') = 0x7c800000
<-- GetProcAddress(0x7c800000, 'AddVectoredExceptionHandler') = 0x7c936c2a
<-- GetProcAddress(0x7c800000, 'RemoveVectoredExceptionHandler') = 0x7c936c96
<-- AllocateMemory(2032)
<-- AllocateMemory(60)
<-- AllocateMemory(44)
<-- LoadLibraryA('kernel32.dll') = 0x7c800000
HOOKED
<-- GetProcAddress(0x7c800000, 'CreateToolhelp32Snapshot') = 0x00f70f88
<-- GetProcAddress(0x7c800000, 'Module32First') = 0x7c8653a0
<-- GetProcAddress(0x7c800000, 'Module32Next') = 0x7c865525
<-- GetModuleHandleA('kernel32.dll') = 0x7c800000
<-- GetProcAddress(0x7c800000, 'wine_get_unix_file_name') = 0x00000000
<-- AllocateMemory(92)
Module Initialized, return 0x00cd2b60
GenerateRC4Keys = 0x17512352
Unload = 0x17523824
PacketHandler = 0x17512560
Tick = 0x17504864
-> GenerateRC4Keys
<-- GetRC4Data <warden.LP_c_ubyte object at 0x019089E0> 520
-> PacketHandler
<-- SendPacket(0x01908af8, 21)
(1, 17)
encrypted responce
0000: 52 58 2e be 97 dd fe dc ad a7 87 bc 1b ca ef 56 | RX............V
0010: 7b fe 5c ce b6 | {.\..
decrypted responce
0000: 04 0e 94 81 61 d0 b6 8b fb aa d5 60 eb a0 f1 8a | ....a......`....
0010: 73 d6 5c ad ad | s.\..
AFTER SEED -> HASH
serv pkt encrypted
0000: ac 03 4d 10 f6 d2 b7 b9 dc 96 5f 9f 75 ff f4 dc | ..M......._.u...
0010: 82 25 74 8c c0 c7 da 41 eb 7d 90 c0 3a 2a c0 74 | .%t....A.}..:*.t
0020: 10 f4 d6 2f 6c 46 cb 71 5e ce 0b 22 bf b4 8b 56 | .../lF.q^.."...V
0030: 35 1e 52 af 15 3f 4e 14 b7 | 5R.?N.
serv pkt decrypted
0000: 69 b6 97 1c 52 8d 97 9a 70 c4 7f 5d f3 6e 6e df | i..R...p.].nn.
0010: a5 ff 96 72 bd f9 94 89 5c cc 18 e1 7d e8 dc d4 | ...r....\..}...
0020: 42 eb c4 80 87 77 8b 86 c0 ea ff e0 82 dc 8b b5 | B....w..........
0030: 40 42 6b ed b7 4b 4f 4e 80 | @Bk..KON.
-> PacketHandler
(0, 0)
<-- ReleaseMemory(0x00ca61d0)
<-- ReleaseMemory(0x00c207a8)
<-- ReleaseMemory(0x00aba020)
<-- SetRC4Data <warden.LP_c_ubyte object at 0x00CFCBC0> 520
<-- ReleaseMemory(0x00cd2b60)