VAC Emulator

On viernes, 24 de septiembre de 2010 0 comentarios

VAC Emulator

The assembler may be lame, but frankly I don't care and if anything is wrong or needs improvement suck it down.

Code:
unsigned char g_szVACPacket[28][180] = 
{
 0x2F,0x0,0x0,0x0,0xD4,0x4E,0x0,0x0,0xD,0x0,0x0,0x0,0x57,0x1A,0x90,0xA,0xEA,0xBE,0xDF,0x61,0x62,0xB2,0x77,0x11,0xDA,0x4F,0x43,0x78,0xF4,0x57,0x39,0x5A,0x4D,0x5B,0x6D,0xE7,0x49,0x56,0x8,0x53,0x3E,0xC1,0x1,0xC2,0x27,0x78,0xB,0x61,0xD0,0xF1,0xA,0x78,0xFE,0x87,0xB7,0x32,0x89,0x2F,0xB1,0x63,0x90,0xD7,0xA6,0x90,0x67,0x18,0xA2,0xD9,0x63,0x25,0xC0,0xAD,0x14,0x8C,0xC6,0xFC,0xD,0xB5,0xCD,0x3F,0xFA,0x3E,0xC4,0xA6,0x68,0x9B,0xFC,0xA6,0x25,0x52,0x7E,0x6A,0x10,0xC5,0x78,0x37,0xCB,0xFD,0x73,0x70,0xFA,0x75,0xA,0x6D,0xB8,0xB,0x6D,0xD5,0x8D,0xA3,0x6C,0x58,0x56,0x5B,0x64,0xEF,0x5F,0x14,0x61,0xC2,0x6F,0xA1,0xD0,0xB4,0x1A,0x8,0xD4,0xE9,0x1,0xB1,0xDB,0xE,0xF0,0x3A,0xDD,0x53,0xF2,0xC6,0xBB,0x2B,0x87,0x6E,0xA2,0x6,0x9C,0x98,0xA8,0xB1,0x65,0x41,0xA9,0x3C,0xF9,0xB5,0x93,0x20,0xB6,0x8F,0x15,0xE0,0x81,0x27,0x1C,0x49,0x5C,0xDF,0x16,0xFA,0x6B,0x10,0x17,0xEB,0x2B,0x2D,0x72,0x4F,0xBC,0x2F,0xD,0x0,
 0x2F,0x0,0x0,0x0,0xCE,0x4D,0x0,0x0,0xF,0x0,0x0,0x0,0x48,0x3F,0x3B,0xA,0xB,0x16,0xD5,0xE4,0x76,0x5B,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31,0x34,0x7D,0x55,0xBB,0xF4,0x48,0xCC,0xBF,0xA5,0x13,0xE5,0xB0,0xC6,0x22,0x7E,0xB5,0x9F,0xE0,0x72,0xD0,0x5B,0xD5,0xAA,0x29,0xCB,0x8E,0x44,0x23,0x78,0xB7,0x1C,0x22,0x71,0x47,0x98,0x9F,0xCB,0x72,0x3,0x99,0x5A,0x29,0xAA,0x9E,0x99,0x18,0x33,0x9A,0xC0,0xDA,0xC1,0xF8,0xA4,0xEF,0x69,0xFD,0xF5,0xB4,0x91,0xF5,0x6,0x9D,0x59,0xEC,0xAF,0xC1,0xBE,0xD4,0xBF,0xCE,0x76,0x56,0x73,0xB9,0x2E,0x53,0x3E,0xA4,0xC0,0x5B,0x49,0x53,0x19,0x52,0x64,0x53,0x14,0x35,0xDC,0x24,0x8F,0x34,0x41,0x22,0x4B,0xD,0x0
};







Code:
int main ( int argc, char *argv[ ], char *envp[ ] )
{
 BOOL iReturn;

 char szDirectory[256];

 DWORD dwBytesRead, dwBytesWritten, dwFileSize, dwReturnValue;

 DWORD dwOldProtect, dwVACBase, dwVACScan, dwVACSize;
 
 FARPROC ( __cdecl* Startup3 )( HANDLE, HANDLE, HANDLE, HANDLE );

 FARPROC ( __cdecl* StartupData )( HANDLE );

 FARPROC Enter3;

 HANDLE hFindFileHandle, hHeap, hReadPipeChild, hReadPipeParent, hTargetHandle, hWritePipeChild, hWritePipeParent,
  hVACFile, hVACThread;

 HMODULE hVAC;

 int i, iErrorCode;

 LPVOID lpHeap;

 SECURITY_ATTRIBUTES PipeAttributes;

 PIMAGE_DOS_HEADER lpImageDosHeader;
 PIMAGE_NT_HEADERS lpImageNtHeaders;
 PIMAGE_SECTION_HEADER lpSectionHeader;

 SIZE_T sHeapSize;

 TCHAR szTempFileName[MAX_PATH];  
 TCHAR lpTempPathBuffer[MAX_PATH];

 UINT uiReturnValue;

 WIN32_FIND_DATA finddata;
 
 hHeap = HeapCreate ( HEAP_NO_SERIALIZE, 0x40000, 0x40000 );

 iErrorCode = GetLastError();

 // TODO: Translate error codes into messages using FormatMessage, see MSDN

 if ( hHeap == NULL )
 {
  printf ( "HeapCreate failed with errorcode %i.\n", iErrorCode );

  return 0;
 }
 else
 {
  lpHeap = HeapAlloc ( hHeap, HEAP_NO_SERIALIZE, 0x30000 );

  iErrorCode = GetLastError();

  if ( lpHeap == NULL )
  {
   printf ( "HeapAlloc failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  memset ( ( LPVOID )lpHeap, 0, 0x30000 );
 }
 if ( GetCurrentDirectoryA ( 256, szDirectory ) != 0 )
 {
  strcpy_s ( g_szDirectory, 256, szDirectory );

  strcat_s ( szDirectory, 256, "\\" );

  strcat_s ( szDirectory, 256, "SourceInit.dat" );

  hFindFileHandle = FindFirstFileA ( "SourceInit.dat", &finddata );

  iErrorCode = GetLastError();

  if ( hFindFileHandle == NULL )
  {
   printf ( "FindFirstFileA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }
  
  hVACFile = CreateFileA ( szDirectory, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );

  iErrorCode = GetLastError();

  if ( hVACFile == INVALID_HANDLE_VALUE )
  {
   printf ( "CreateFileA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  dwFileSize = GetFileSize ( hVACFile, NULL );

  iErrorCode = GetLastError();

  if ( dwFileSize == -1 )
  {   
   printf ( "Error code %i.\n", iErrorCode );

   return 0;
  }

  g_dwFileSize = dwFileSize;

  sHeapSize = HeapSize ( hHeap, HEAP_NO_SERIALIZE, lpHeap );

  iErrorCode = GetLastError();

  if ( sHeapSize == 0 || sHeapSize == -1 )
  {
   printf ( "HeapSize failed with errorcode %i.\n", GetLastError() );

   return 0;
  }
  if ( dwFileSize > sHeapSize )
  {
   printf ( "VAC file is larger than heap.\n" );

   printf ( "Attempting to reallocate heap to read the file to continue normally.\n" );

   printf ( "If this fails then the application will attempt again with VirtualAlloc.\n" );

   lpHeap = HeapReAlloc ( hHeap, HEAP_NO_SERIALIZE, lpHeap, dwFileSize );

   iErrorCode = GetLastError();

   if ( lpHeap == NULL )
   {
    printf ( "HeapReAlloc failed with errorcode %i.\n", iErrorCode );

    printf ( "Attempting to allocate memory with VirtualAlloc.\n" );

    // Implement this if you fail hard
   }
  }

  iReturn = ReadFile ( hVACFile, lpHeap, dwFileSize, &dwBytesRead, NULL );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "ReadFile failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = CloseHandle ( hVACFile );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CloseHandle failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  dwReturnValue = GetTempPathA ( 0x104, lpTempPathBuffer );
 
  iErrorCode = GetLastError();

  if ( dwReturnValue > 0x104 || dwReturnValue == 0 )
  {
   printf ( "GetTempPathA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  uiReturnValue = GetTempFileNameA ( lpTempPathBuffer, "~", 0, szTempFileName );

  iErrorCode = GetLastError();

  if ( uiReturnValue == 0 )
  {
   printf ( "GetTempFileNameA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  hVACFile = CreateFileA ( szTempFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

  iErrorCode = GetLastError();

  if ( hVACFile == INVALID_HANDLE_VALUE )
  {
   printf ( "CreateFileA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = WriteFile ( hVACFile, lpHeap, dwFileSize, &dwBytesWritten, NULL );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "WriteFile failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = CloseHandle ( hVACFile );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CloseHandle failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  hVAC = LoadLibraryA ( szTempFileName );

  iErrorCode = GetLastError();

  if ( hVAC == NULL )
  {
   printf ( "LoadLibraryA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  PipeAttributes.lpSecurityDescriptor = NULL;
  PipeAttributes.nLength = sizeof ( SECURITY_ATTRIBUTES );
  PipeAttributes.bInheritHandle = TRUE;

  iReturn = CreatePipe ( &hReadPipeChild, &hWritePipeChild, &PipeAttributes, 0 );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CreatePipe failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = DuplicateHandle ( GetCurrentProcess(), hReadPipeChild, GetCurrentProcess(), &hTargetHandle, 0, 1, 2 );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "DuplicateHandle failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iErrorCode = CloseHandle ( hReadPipeChild );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CloseHandle failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  hReadPipeChild = hTargetHandle;

  hReadPipeChild = CreateEventA ( &PipeAttributes, 0, 0, 0 );

  iErrorCode = GetLastError();

  if ( hReadPipeChild == NULL )
  {
   printf ( "CreateEventA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = CreatePipe ( &hReadPipeParent, &hWritePipeParent, &PipeAttributes, 0 );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CreatePipe failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iReturn = DuplicateHandle ( GetCurrentProcess(), hWritePipeParent, GetCurrentProcess(), &hTargetHandle, 0, 1, 2 );
   
  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "DuplicateHandle failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  iErrorCode = CloseHandle ( hWritePipeParent );

  iErrorCode = GetLastError();

  if ( iReturn != 1 )
  {
   printf ( "CloseHandle failed with errorcode %i.\n", iErrorCode );
   
   return 0;
  }

  hWritePipeParent = hTargetHandle;

  hWritePipeParent = CreateEventA ( &PipeAttributes, 0, 0, 0 );

  iErrorCode = GetLastError();

  if ( hWritePipeParent == NULL )
  {
   printf ( "CreateEventA failed with errorcode %i.\n", iErrorCode );

   return 0;
  }

  Startup3 = ( FARPROC ( __cdecl* )( HANDLE, HANDLE, HANDLE, HANDLE ) )GetProcAddress ( hVAC, "Startup3" );

  if ( Startup3 == NULL )
   return 0;

  Enter3 = GetProcAddress ( hVAC, "Enter3" );

  if ( Enter3 == NULL )
   return 0;

  StartupData = ( FARPROC ( __cdecl* )( HANDLE ) )GetProcAddress ( hVAC, "StartupData" );

  if ( StartupData == NULL )
   return 0;

  if ( Startup3 ( hReadPipeParent, hWritePipeChild, hWritePipeParent, hReadPipeChild ) )
  {
   hVACThread = CreateThread ( NULL, 0, ( LPTHREAD_START_ROUTINE )Enter3, NULL, 0, NULL ); // they create a thread for tier0 minidump with enter3 as parameter, but let's just be lazy here
                         // and say GIAP DE PHUC DAT
   iErrorCode = GetLastError();

   if ( iReturn != 1 )
   {
    printf ( "CreateThread failed with errorcode %i.\n", iErrorCode );

    system ( "pause" );

    return 0;
   }

   StartupData ( hVACThread ); // pass in thread handle
     
   lpImageDosHeader = ( PIMAGE_DOS_HEADER )( ( DWORD )hVAC );

   dwVACBase = ( DWORD )hVAC;

   if ( lpImageDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
   {
    lpImageNtHeaders = ( PIMAGE_NT_HEADERS )( ( DWORD )hVAC + lpImageDosHeader->e_lfanew );

    dwVACSize = lpImageNtHeaders->OptionalHeader.SizeOfImage;

    if ( lpImageNtHeaders->Signature == IMAGE_NT_SIGNATURE )
    {
     lpSectionHeader = IMAGE_FIRST_SECTION ( lpImageNtHeaders );
                    
     for ( i = 0; i < lpImageNtHeaders->FileHeader.NumberOfSections; i++ )
     {
      if ( !strcmp ( ( PCHAR )lpSectionHeader->Name, ".text" ) )
      {
       g_dwVACCodeBase = lpSectionHeader->VirtualAddress;
       g_dwVACCodeSize = lpSectionHeader->SizeOfRawData;
      }
      
      if ( g_dwVACCodeBase && g_dwVACCodeSize )
       break;

      lpSectionHeader++;
     }
    }
   }

   iReturn = HeapFree ( hHeap, HEAP_NO_SERIALIZE, lpHeap );

   iErrorCode = GetLastError();

   if ( iReturn != 1 )
   {
    printf ( "HeapFree failed with errorcode %i.\n", iErrorCode );

    return 0;
   }
  }
 }
 else
 {
  printf ( "GetCurrentDirectoryA failed with errorcode %i.\n", iErrorCode );

  return 0;
 }

 iReturn = VirtualProtect ( ( LPVOID )( dwVACBase + 0x106FE ), 0x5, PAGE_EXECUTE_READWRITE, &dwOldProtect );
 
 iErrorCode = GetLastError();

 if ( iReturn != 1 )
 {
  printf ( "VirtualProtect failed with errorcode %i\n", iErrorCode );

  return 0;
 }

 *( PBYTE )( dwVACBase + 0x106FE ) = 0xC3; // patch the code to encrypt the scan results
 *( PBYTE )( dwVACBase + 0x106FF ) = 0x0;
 *( PBYTE )( dwVACBase + 0x10700 ) = 0x0;
 *( PBYTE )( dwVACBase + 0x10701 ) = 0x0;
 *( PBYTE )( dwVACBase + 0x10702 ) = 0x0;

 // if you don't care to patch and bother to decrypt it, the packet encrypt ice key is right after the function decrypt ice key
 // but you will need to shift the bits around a bit, and I haven't bothered with reversing it
 // so this is clearly the easier solution

 iReturn = VirtualProtect ( ( LPVOID )( dwVACBase + 0x106FE ), 0x5, dwOldProtect, &dwOldProtect );
 
 iErrorCode = GetLastError();

 if ( iReturn != 1 )
 {
  printf ( "VirtualProtect failed with errorcode %i\n", iErrorCode );

  return 0;
 }

 int iResponseSize, iRemainingPacketSize;

 iRemainingPacketSize = 0xA0;

 for ( i = 0; i < 28; i++ )
 { 
  memcpy ( g_szCopiedVACPacket, g_szVACPacket[i], 180 );

  switch ( g_szVACPacket[i][8] )
  {
   case 0xB:
   {
    dwVACScan = 0x100072A9;

    __asm
    {
     LEA EAX, iResponseSize
     PUSH EAX
     LEA EAX, g_szResponsePacket
     PUSH EAX
     LEA EAX, iRemainingPacketSize
     PUSH EAX
     LEA EAX, g_szCopiedVACPacket[0x10]
     PUSH EAX
     CALL dwVACScan
     ADD ESP, 0x10
    }

   }
   break;

   case 0xC:
   {
    dwVACScan = 0x100044DC;

    __asm
    {
     LEA EAX, iResponseSize
     PUSH EAX
     LEA EAX, g_szResponsePacket
     PUSH EAX
     LEA EAX, iRemainingPacketSize
     PUSH EAX
     LEA EAX, g_szCopiedVACPacket[0x10]
     PUSH EAX
     CALL dwVACScan
     ADD ESP, 0x10
    }

   }
   break;

   case 0xD:
   {
    dwVACScan = 0x10003535;

    __asm
    {
     LEA EAX, iResponseSize
     PUSH EAX
     LEA EAX, g_szResponsePacket
     PUSH EAX
     PUSH 4
     LEA EAX, iRemainingPacketSize
     PUSH EAX
     LEA EAX, g_szCopiedVACPacket[0x10]
     PUSH EAX
     CALL dwVACScan
     ADD ESP, 0x10
    }

   }
   break;

   case 0xE:
   {
    dwVACScan = 0x1000295F;

    __asm
    {
     LEA EAX, iResponseSize
     PUSH EAX
     LEA EAX, g_szResponsePacket
     PUSH EAX
     LEA EAX, iRemainingPacketSize
     PUSH EAX
     LEA EAX, g_szCopiedVACPacket[0x10]
     PUSH EAX
     CALL dwVACScan
     ADD ESP, 0x10
    }

   }
   break;

   case 0xF:
   {
    dwVACScan = 0x100057F5;

    __asm
    {
     LEA EAX, iResponseSize
     PUSH EAX
     LEA EAX, g_szResponsePacket
     PUSH EAX
     LEA EAX, iRemainingPacketSize
     PUSH EAX
     LEA EAX, g_szCopiedVACPacket[0x10]
     PUSH EAX
     CALL dwVACScan
     ADD ESP, 0x10
    }

   }
   break;
  }

  if ( iResponseSize <= 4  )
   printf ( "Fucking fail faggot goddamn you son of a bitch go choke and die on horse cum you dumbass shitface.\n" );
  else
   LogScan();
 }

 iReturn = CloseHandle ( hVAC );

 iErrorCode = GetLastError();

 if ( iReturn != 1 )
 {
  printf ( "CloseHandle failed with errorcode %i.\n", iErrorCode );

  return 0;
 }

 return 0;
}

Read more ...»

Finding the Directory of your DLL

On 0 comentarios

OK this is gonna be a simple one.

Firstly we need to make a function. I called mine GetModulePath.

        
hInst is the Handler for your Dll
pszBuffer is the variable that you want to set as the File Directory.
dwSize is the size of pszBuffer

Now we will add the line that actuall gets the filepath.

        

Most paths in C++ require that there be 2 \'s. Although the next 4 lines are optional, it is recommended that you do them.

        

Now what that does is converts / ---> //...

Now we return and close the function

        

Now to call the function...

I call the function in DllMain because it already has the handle attached.

NOTE: Make sure you only do this once....


CREDITS:

Uknown Origional auther
Thanks to Azo for code...
Read more ...»

Mouse Support without Engine Funcs

On 0 comentarios

Credits go to:
Crusader, LanceVorgin, Xnient

Well, after being unsatisfied with my previous mouse making crap, I decided to find a new way to do a mouse in my Tool...
My friend(Xnient) kinda also wanted a mouse in his Tool, so that just made me want to make a new style of mouse, that will work with an opengl hook, I'm not sure about wrapper though, it might...
Without further adu, lets get started...

For making a mouse, we have to know what Half-Life(or any other game for that matter) uses to do a mouse. I figured out that it uses SetCursorPos, and GetCursorPos.

So, add hooks to these, so my_GetCursorPos and my_SetCursorPos for simplicity's sake...

        

That's a mighty fine looking hook if you ask me :)...

Now, some theory:
-Half-Life calls SetCursorPos at least once a frame to set cursor in middle.
-Half-Life reads where the mouse is by GetCursorPos.
-We do not want Half-Life to move the cursor around when were using it
-We want HL to believe its still in the middle to make your character not changes its view

So, what I have is a bool to say when my menu is open (cvar.menu), should be easy to understand...

        

Plz note, Viewport[4] is the variable that changes depending on how big your screen is, its OpenGL so it shouldn't be that hard to find out...
int Viewport[4] = {0, 0, 1024, 768}; My res is at 1024x768
int mousepos[2] = Saved crap for where we want to save the mouse's info

Ok, so that blocks HL from changing the mouse, and makes HL think its still in the middle of the screen, now we have to make a menu toggler...
This is my code in glViewPort:

        

That just toggles my friggin menu when I press F1... When the menu is un activated, it will send the mouse back to the middle of the screen, it isn't really important, just at the end your characters view will move for 1 frame... I just did that so I didn't get seizures, you can fuck around with it and not mess it up I suppose...

Now, it came to my attention that HL still reads mouse clicks, and if your in the menu you don't want to start shooting wildly do you?
So, Crusader pretty much gave me all of this (/me thanks).
It is just a keyboard/mouse hook, it prevents the key info being sent to HL, but our Tool will still be able to read it.

        

And, whenever you initialize stuff in your Tool, like for glPrint or something, just call HookKBD(); and it should work, if not then PM me on irc.rizenet.org #cheat-network

So, what's a good mouse when you cannot see it, Ill give you this mouse drawing code if you are really stupid and cannot figure out to do with it
(btw, its just a crosshair mouse, you can figure out how to draw a good mouse)

        

Now in glEnable, call DrawMouse(mousepos[0], mousepos[1]); to draw your mouse crosshair...


That is the end, my only friend the end...
«Azorbix»

Copyright© 2003 Azorbix

This may not appear elsewhere without permission(but may be linked to)

BTW:
Get the song Ordinary by the The Buzzhorn
Read more ...»

Function Detouring and Class Detouring

On martes, 21 de septiembre de 2010 0 comentarios

Function Detouring and Class Detouring

These two files provide functions for detouring regular functions as well as class methods.

Readme in ZIP.

Please don't post any "How do I use this" posts, if you can't figure it out then it will probably be no use to you anyway.

Azorbix

http://www.ziddu.com/download/11766332/detours.zip.html
Read more ...»

Ring0 ADetours

On 0 comentarios

Ring0 ADetours

Being a big fan of ADetours, created by Azorbix, I've ported it to ring0 a while ago & now i've enhanced it a bit to make a release.

What it does now:

ADetourKernelFunc:
- auto-detect opcode size
- lock pages in memory before accessing them (needed for detours over pageable memory like win32k.sys)

ARetourKernelFunc:
- you can now decide wheter to free or redirect the trampoline.

Usage:
at the top of your .cpp/.c file:
PHP Code:
#include "adetours.h"

// define Example1 functions and init the Org_Example1 address to 0x101010
// > 1st arg: use page locking before hooking (boolean) TRUE/FALSE
// >             set to TRUE if hooking pageable memory
// > 2nd arg: function name
// > 3rd arg: return type
// > 4th arg: arguments with "( )"
// > 5th arg: original function address
// > 6th arg: calling convention (this is optional)
ADETOUR_DEFINE_AND_INIT(TRUE,Example1BOOLEAN, (IN LONG arg1), 0x101010NTAPI);
// define Example2 functions and don't init Org_Example2
// > we could also add a ", NTAPI" here,
// > but as it is optional, we don't do it this time,
// > attention: callconvention will default to your compilers default setting doing so
ADETOUR_DEFINE(FALSE,Example2VOID, (IN LONG arg1) ); 

in your .cpp/.c file:
PHP Code:
void AddDetours() {
   
// set detour & auto-detect opcode size
   
ADETOUR_HOOK(Example1);
   
// init Org_Example2
   
Org_Example2 = (Example2_Func)0x202020;
   
// set detour & use 8 as opcode length (minimal value is 5)
   
ADETOUR_HOOK_LEN(Example28);
}
void RemoveDetours() {
    
// remove detour & don't free trampoline and redirect it to Org_Example1
     
ADETOUR_UNHOOK(Example1false);
     
// remove detour with given opcode length & free trampoline
     
ADETOUR_UNHOOK_LEN(Example28true);
}
BOOLEAN NTAPI My_Example1(IN LONG arg1)
{
  return 
Trmp_Example1(arg1);
}
VOID NTAPI My_Example2(IN LONG arg1)
{
  return 
Trmp_Example2(arg1);
About Hooking
- don't enable any sti/cli/cr0 asm tricks before hooking/unhooking, adetours will do this for you


Hooking Win32k.sys
- make sure to use page locking
- before hooking/unhooking make sure you are in a GUI-process context,
either attach to one ( check Sheppard's Ring 0 Hack for Diablo 2 ), or better send an IOCTL to your driver and do it from there , cause attaching sometimes causes problems during hooking



Credits
Matthew L (Azorbix)
Dom1n1k
LanceVorgin
P47R!CK
rain
Ms-Rem

Changelog
2.1
- converted to C
- better names for the function arguments

2.0
- can now choose to use page locking or not
- added cr0 / cli / sti tricks
- fixed callconvention macros
- general improvements

1.1
- rewrote page locking functions

1.0
- first release
 Credit by Michael87
http://www.ziddu.com/download/11766317/adetours_ring0_2.1.zip.html
Read more ...»

Parcheo de memoria en Drivers Externos

On lunes, 20 de septiembre de 2010 0 comentarios

Parcheo de memoria en Drivers Externos

¿Que se pretende conseguir?


Lo que pretendo conseguir es la modificación de memoria en drivers externos, es decir, conseguir modificar el comportamiento de un driver externo sin que este se entere de que está siendo modificado.

Herramientas a usar:

Yo e usado las siguientes:

  • DDk (obviamente)
  • WinDbg
  • OSR Drive Loader
  • DebugView
  • VMWare

Por si a alguien le interesa, que sepa que puede desensamblar el driver con un programa llamado Syser, el cual permite debuggear drivers  ;)

Driver Objetivo:

El driver que vamos a "destripar" es un driver que programé yo mismo, el cual nos bloquea  la eliminación del fichero C:\prueba.txt. El código del mismo será publicado al final.

Manos a la obra:


Bien, ya que es un entorno emulado, controlamos la ejecución del driver y conocemos la API que va a hookear, podemos sacar la dirección real de dicha API con el WinDbg. Para ello lo abrimos, Kernel Debug --> Local.

Una vez echo esto, escribimos u nt!NtOpenFile y nos da lo siguiente:

Citar
lkd> u nt!NtOpenFile
nt!NtOpenFile:
8056f41a 8bff             mov     edi,edi
8056f41c 55               push    ebp
8056f41d 8bec             mov     ebp,esp
8056f41f 33c0             xor     eax,eax
8056f421 50               push    eax
8056f422 50               push    eax
8056f423 50               push    eax
8056f424 50               push    eax

La dirección que está en negrita es la dirección en la SSDT de dicha API

Nota: Aunque nosotros hookeemos la API ZwOpenFile, en el WinDbg tenemos que escribir NtOpenFile, para obtener la dirección real.

Bien, nos anotamos en el notepad dicha dirección. (En el programa "parcheador", e harcodeado las direcciones para una mayor comodidad y para no complicar la cosa, aunque todas se pueden obtener automáticamente programando dichos módulos (por ejemplo, para sacar la dirección real de la API, etc.)).

Una vez tenemos esto, ya podemos cargar nuestro driver, y como vemos, hookea perfectamente y nos impide la eliminación del archivo antes mencionado:


Bien, ahora lo que tenemos que hacer es empezar a desensamblar la función que nos bloquea el acceso al fichero. Si buscamos su dirección en el IceSword la encontraremos rápidamente, aunque no hace falta, ya que lo e incluido yo mismo en el output del driver (lo veos con DebugView), para mayor comodidad.

La dirección de la función es:

Citar
Dirección después del Hook: 0xf7bcc4ce

Esto es en mi maquina virtual, en la suya puede ser diferente  ;)

Una vez tenemos la dirección, vamos a desensamblarla con el WinDbg, para ello escribimos: u 0xf7bcc4ce l40 nos da esto:

Citar
lkd> u 0xf7bcc4ce l40
f7bcc4ce 6a10             push    0x10
f7bcc4d0 6860c8bcf7       push    0xf7bcc860
f7bcc4d5 e88e020000       call    f7bcc768
f7bcc4da ff751c           push    dword ptr [ebp+0x1c]
f7bcc4dd ff7518           push    dword ptr [ebp+0x18]
f7bcc4e0 ff7514           push    dword ptr [ebp+0x14]
f7bcc4e3 8b7510           mov     esi,[ebp+0x10]
f7bcc4e6 56               push    esi
f7bcc4e7 ff750c           push    dword ptr [ebp+0xc]
f7bcc4ea 8b7d08           mov     edi,[ebp+0x8]
f7bcc4ed 57               push    edi
f7bcc4ee ff15a0c9bcf7     call    dword ptr [f7bcc9a0]
f7bcc4f4 85c0             test    eax,eax
f7bcc4f6 0f8583000000     jne     f7bcc57f
f7bcc4fc 2145fc           and     [ebp-0x4],eax
f7bcc4ff 6a01             push    0x1
f7bcc501 ff7608           push    dword ptr [esi+0x8]
f7bcc504 8d45e0           lea     eax,[ebp-0x20]
f7bcc507 50               push    eax
f7bcc508 ff1508c8bcf7     call    dword ptr [f7bcc808]
f7bcc50e 8b45e4           mov     eax,[ebp-0x1c]
f7bcc511 be80c9bcf7       mov     esi,0xf7bcc980
f7bcc516 8a16             mov     dl,[esi]
f7bcc518 8aca             mov     cl,dl
f7bcc51a 3a10             cmp     dl,[eax]
f7bcc51c 751a             jnz     f7bcc538
f7bcc51e 84c9             test    cl,cl
f7bcc520 7412             jz      f7bcc534
f7bcc522 8a5601           mov     dl,[esi+0x1]
f7bcc525 8aca             mov     cl,dl
f7bcc527 3a5001           cmp     dl,[eax+0x1]
f7bcc52a 750c             jnz     f7bcc538
f7bcc52c 46               inc     esi
f7bcc52d 46               inc     esi
f7bcc52e 40               inc     eax
f7bcc52f 40               inc     eax
f7bcc530 84c9             test    cl,cl
f7bcc532 75e2             jnz     f7bcc516
f7bcc534 33c0             xor     eax,eax
f7bcc536 eb05             jmp     f7bcc53d
f7bcc538 1bc0             sbb     eax,eax
f7bcc53a 83d8ff           sbb     eax,0xffffffff
f7bcc53d 85c0             test    eax,eax
f7bcc53f 7538             jnz     f7bcc579
f7bcc541 f6450e01         test    byte ptr [ebp+0xe],0x1
f7bcc545 7432             jz      f7bcc579
f7bcc547 6880c4bcf7       push    0xf7bcc480
f7bcc54c e809020000       call    f7bcc75a
f7bcc551 59               pop     ecx
f7bcc552 57               push    edi
f7bcc553 ff1500c8bcf7     call    dword ptr [f7bcc800]
f7bcc559 832700           and     dword ptr [edi],0x0
f7bcc55c 834dfcff         or      dword ptr [ebp-0x4],0xffffffff
f7bcc560 b8080000c0       mov     eax,0xc0000008
f7bcc565 eb18             jmp     f7bcc57f
f7bcc567 33c0             xor     eax,eax
f7bcc569 40               inc     eax
f7bcc56a c3               ret
f7bcc56b 8b65e8           mov     esp,[ebp-0x18]
f7bcc56e 68a4c4bcf7       push    0xf7bcc4a4
f7bcc573 e8e2010000       call    f7bcc75a
f7bcc578 59               pop     ecx
f7bcc579 834dfcff         or      dword ptr [ebp-0x4],0xffffffff
f7bcc57d 33c0             xor     eax,eax

Como vemos nos muestra un montón de información, aunque, rápidamente, vemos lo que nos interesa, concretamente esto:

Citar
f7bcc4da ff751c           push    dword ptr [ebp+0x1c]
f7bcc4dd ff7518           push    dword ptr [ebp+0x18]
f7bcc4e0 ff7514           push    dword ptr [ebp+0x14]
f7bcc4e3 8b7510           mov     esi,[ebp+0x10]
f7bcc4e6 56               push    esi
f7bcc4e7 ff750c           push    dword ptr [ebp+0xc]
f7bcc4ea 8b7d08           mov     edi,[ebp+0x8]
f7bcc4ed 57               push    edi
f7bcc4ee ff15a0c9bcf7     call    dword ptr [f7bcc9a0]

Como vemos, hay unos cuantos push, y luego un call a la dirección almacenada en 0xf7c5caa0. Humm, esto suena a variable!!, vamos a ver que hay dentro, para ello: dd 0xf7bcc9a0:

Citar
dd f7bcc9a0
f7bcc9a0  8056f41a f7abbb9c 00000000 00000000
f7bcc9b0  00000000 00000000 00000000 00000000
f7bcc9c0  00000000 00000000 00000000 00000000
f7bcc9d0  00000000 00000000 00000000 00000000
f7bcc9e0  00000000 00000000 00000000 00000000
f7bcc9f0  00000000 00000000 00000000 00000000
f7bcca00  00000000 55ff8b00 98a1ec8b 85f7bcc9
f7bcca10  bb40b9c0 04740000 2375c13b c82c158b

Bingo!! les suena de algo la dirección subrayada? Exacto, es la dirección real de la api ZwOpenFile (Si no están seguros, escriban u 0x8056f41a y automáticamente el WinDbg les va a resolver el nombre  ;))

Bien, ya sabemos que en la dirección 0xf7c5caa0 se encuentra almacenada la dirección real a la API. Por lo que podemos interpretar el siguiente código en ensamblador:

Código
Push ArgumentoX
Push ArgumentoX-1
...
...
...
Push Argumento2
Push Argumento1
Push Argumento0
Call Api

Que, efectivamente, es la llamada a la API, bien, lo que tenemos que hacer, es que en lugar de saltar a la API real, nos salte a una función nuestra, la cual estará formada por los argumentos correspondientes a ZwOpenFile, así que no quedará la siguiente función:

Código:
NTSTATUS ZwOpenFileRep(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions)

Bien, pensemos la jugada, lo que vamos a hacer es escribir la dirección de nuestra función dentro de la variable del otro driver, el cual se cree que dicha variable contiene la variable real y, sin verificar nada, salta directamente hacia la función, en la cual nosotros tomaremos el control y lo que vamos a hacer será, llamar a la API real, le pasaremos los parámetros adecuados y ejecutará la acción pertinente, una vez ejecutado, lo que vamos a hacer será limpiar los datos de un argumento (el que contiene la ruta del archivo a eliminar), lo que lograremos así será saltarnos el filtro del driver, ya que como no tiene ningún dato, no puede aplicar su filtro.

Bien, si leíste el post que publiqué sobre la introducción a la programación de drivers, te acordarás que no podemos modificar la memoria "al tun tun", ya que esta protegida y lo único que conseguiríamos seria un bonito BSOD. Para ello, me e servido del siguiente código:

Antes de modificar la memoria:

Código
__asm
 {
  cli
  push eax
  mov eax, cr0
  and eax, 0xFFFEFFFF
  mov cr0, eax
  pop eax
 }

Después de modificar la memoria:

Código
__asm
 {
  push eax
  mov eax, cr0
  or eax, not 0xFFFEFFFF
  mov cr0, eax
  pop eax
  sti
 }

Bien, antes de seguir trabajando definiremos las variables que usaremos, yo e usado las siguiente:

Código
DWORD det;
DWORD dir;
DWORD MyDir;
 
det = (DWORD) 0xf7c80aa0;
dir = (DWORD) 0x8056f41a;
MyDir = (DWORD) ZwOpenFileRep;

En la variable det está la dirección de la variable del driver en la cual está guardada la variable (Se puede obtener esta dirección con un código en ensamblador en el que, con un bucle, recorramos la memoria del driver en busca de datos que empiecen por 8056 (los primeros dígitos de la dirección real de la API), yo no me e querido complicar tanto y lo e harcodeado).
En dir esta la dirección real de la API y en MyDir la dirección de mi función, donde recibiré la llamada del driver "victima".

El código que e usado para sobrescribir la memoria del driver no es muy "elegante", pero bueno, aquí esta:

Código
__try
    {
  //Parcheamos la variable del programa victima con la dirección de nuestra función
  *(DWORD*)det = MyDir;
 
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }

Escribo el Try & Catch porque sirve de mucho para evitar alguna que otra BSOD, así que recomiendo su uso.

Dicho esto, el DriverEntry de nuestro driver nos quedaría así:

Código
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING theRegistryPath)
{
    NTSTATUS s = STATUS_SUCCESS;
 
 det = (DWORD) 0xf7c80aa0;
 dir = (DWORD) 0x8056f41a;
 MyDir = (DWORD) ZwOpenFileRep;
 
 DriverObject->DriverUnload=OnUnload;
 
 DbgPrint("Modificado de memoria. Por Hendrix");
 
 
   ZwOpenFileIni =(typeZwOpenFile)dir;
 
   __asm
 {
  cli
  push eax
  mov eax, cr0
  and eax, 0xFFFEFFFF
  mov cr0, eax
  pop eax
 }
 
   __try
    {
  //Parcheamos la variable del programa victima con la dirección de nuestra función
  *(DWORD*)det = MyDir;
 
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   __asm
 {
  push eax
  mov eax, cr0
  or eax, not 0xFFFEFFFF
  mov cr0, eax
  pop eax
  sti
 }
 
   DbgPrint("Hook inyectado!!");
   return s;
}

En el evento UnLoad del driver tenemos que acordarnos a restaurar la variable del driver "victima", ya que de lo contrario, va a llamar a una dirección de memoria invalida y provocará BSOD  ;) Así que dejamos el evento UnLoad de la siguiente manera:

Código
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
   DbgPrint("Descargando driver...");
 
   __asm
 {
  cli
  push eax
  mov eax, cr0
  and eax, 0xFFFEFFFF
  mov cr0, eax
  pop eax
 }
 
   __try
    {
  //Reparamos la variable del driver victima con la dirección real de la API.
  *(DWORD*)det = (DWORD)ZwOpenFileIni;
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   __asm
 {
  push eax
  mov eax, cr0
  or eax, not 0xFFFEFFFF
  mov cr0, eax
  pop eax
  sti
 }
}

Como vemos, es exactamente el mismo código que el del DriverEntry, pero esta vez escribimos la dirección real en lugar de la dirección de nuestra función.

Vamos al siguiente paso, la función que recibirá la llamada.

Esta función es la misma que utilizaríamos si quisiéramos hookear a ZwOpenFile (de echo, yo e reciclado la función del driver "victima" y la e pegado tal cual en el "envenenador").

Pego la función aquí y explicare el único punto importante que hay:

Código
NTSTATUS ZwOpenFileRep(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions)
{
 
   NTSTATUS ntStatus;
   OBJECT_ATTRIBUTES oa;
 
 
   ntStatus = ((typeZwOpenFile)(ZwOpenFileIni)) (FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock,  ShareAccess, OpenOptions);
   if (ntStatus!=STATUS_SUCCESS) return ntStatus;
 
 __try
    {
  //Limpiamos toda la información de la estructura para que no nos pillen el nombre del fichero
  RtlZeroMemory(ObjectAttributes,sizeof(ObjectAttributes));
  InitializeObjectAttributes(ObjectAttributes,NULL,0,NULL,NULL);
 
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   return ntStatus;
}

Como ven en los comentarios, el punto importante es el uso de la función InitializeObjectAttributes para resetear la estructura ObjectAttributes, ya que en esta estructura, entre otras cosas, se almacena la ruta del archivo con el que se va a tratar. Si lo reseteamos, el driver "victima" nunca podrá saber el nombre del archivo, y como no esta en su filtro, dejará ejecutar la acción.

Una vez tenemos esto, podemos probar nuestro código. Ejecutamos primero el driver victima y miramos lo que contiene su variable en la que tiene que haber la dirección real de la API ZwOpenFile, esto es lo que nos muestra:

Citar
lkd> dd f7bcc9a0
f7bcc9a0  8056f41a f7abbb9c 00000000 00000000
f7bcc9b0  00000000 00000000 00000000 00000000
f7bcc9c0  00000000 00000000 00000000 00000000
f7bcc9d0  00000000 00000000 00000000 00000000
f7bcc9e0  00000000 00000000 00000000 00000000
f7bcc9f0  00000000 00000000 00000000 00000000
f7bcca00  00000000 55ff8b00 98a1ec8b 85f7bcc9
f7bcca10  bb40b9c0 04740000 2375c13b c82c158b

Como ven, esta la dirección correcta de la API, vamos a ejecutar nuestro "envenenador", a ver que pasa:

Citar
lkd> dd f7bcc9a0
f7bcc9a0  f7c944aa f7abbb9c 00000000 00000000
f7bcc9b0  00000000 00000000 00000000 00000000
f7bcc9c0  00000000 00000000 00000000 00000000
f7bcc9d0  00000000 00000000 00000000 00000000
f7bcc9e0  00000000 00000000 00000000 00000000
f7bcc9f0  00000000 00000000 00000000 00000000
f7bcca00  00000000 55ff8b00 98a1ec8b 85f7bcc9
f7bcca10  bb40b9c0 04740000 2375c13b c82c158b

Juas Juas, se lo a tragado (y si han podido ver esto, es porque no les ha dado BSOD  :xD) Si todo a funcionado bien, nuestra función debe de recibir ya la llamada del driver victima (lo hace, para ello pueden poner un simple DbgPrint("Me llaman"); en la función del driver de "envenenamiento").

Si echamos un ojo en el DbgView, vamos a ver que sale un montón de mensajes de "Error en el procesamiento del driver", esto sale desde el driver victima, ya que al no verificar que el ObjectAttributes esta vació, provoca error (esto lo e echo a propósito para que aprendas que, aparte de validar las variables que llamamos, siempre se tienen que validar este tipo de cosas, un error en modo Kernel puede ser muy grave  ;)).

Ahora si intentamos eliminar el archivo prueba.txt situado en C:\ veremos como no nos da ninun tipo de problema, ya que el driver de filtrado no puede saber que archivo queremos eliminar.

Si cerramos el driver "envenenador" se restablecerá la dirección real de la API en dentro de la variable del driver de filtrado, y si cerramos este, eliminara en hook que había puesto en la SSDT, y va a creer que ha echo bien su trabajo, pero nosotros sabemos que no  :D

Creo que no me e dejado nada en el tintero, espero que este texto sirva para animaros a programar algo en modo kernel, os aseguro que si estos temas (de modo Kernel) se trataran más en este subforo la gente participaría un 300% más de lo que se participa en este foro, estoy seguro  ;) Yo e dado el primer paso, ahora os toca a vosotros dar el vuestro, para poder charlar de un tema que personalmente me apasiona, no creen que lo de los troyanos y joiners ya esta muy visto? demos un paso al frente y progresemos  ;)

Por último, quiero dar las gracias a Mek, ya que parte de este concepto lo desarrollamos el y yo en el driver con el que "combatíamos" al sXe  :D

Un Saludo  :)



Código completo del Driver de filtrado:

Código
#include "ntddk.h"
#include 
 
#pragma pack(1)
typedef struct ServiceDescriptorEntry {
        unsigned int *ServiceTableBase;
        unsigned int *ServiceCounterTableBase;
        unsigned int NumberOfServices;
        unsigned char *ParamTableBase;
} ServiceDescriptorTableEntry_t, *PServiceDescriptorTableEntry_t;
#pragma pack()
 
__declspec(dllimport)  ServiceDescriptorTableEntry_t KeServiceDescriptorTable;
#define SYSTEMSERVICE(_function)  KeServiceDescriptorTable.ServiceTableBase[ *(PULONG)((PUCHAR)_function+1)]
 
PMDL  g_pmdlSystemCall;
PVOID *MappedSystemCallTable;
#define SYSCALL_INDEX(_Function) *(PULONG)((PUCHAR)_Function+1)
#define HOOK_SYSCALL(_Function, _Hook, _Orig )  \
       _Orig = (PVOID) InterlockedExchange( (PLONG) &MappedSystemCallTable[SYSCALL_INDEX(_Function)], (LONG) _Hook)
 
#define UNHOOK_SYSCALL(_Function, _Hook, _Orig )  \
       InterlockedExchange( (PLONG) &MappedSystemCallTable[SYSCALL_INDEX(_Function)], (LONG) _Hook)
 
static char archivo[] = "\\??\\C:\\prueba.txt";
 
NTSYSAPI
NTSTATUS
NTAPI ZwOpenFile(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions);
 
typedef NTSTATUS (*typeZwOpenFile)(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions);
typeZwOpenFile ZwOpenFileIni;
 
 
NTSTATUS ZwOpenFileRep(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions)
{
 
   NTSTATUS ntStatus;
   ANSI_STRING strf;
 
 
   ntStatus = ((typeZwOpenFile)(ZwOpenFileIni)) (FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock,  ShareAccess, OpenOptions);
   if (ntStatus!=STATUS_SUCCESS) return ntStatus;
 
 __try
    {
    RtlUnicodeStringToAnsiString(&strf,ObjectAttributes->ObjectName,TRUE);
    if (strcmp(archivo,strf.Buffer)==0)
    {
   if (DesiredAccess & DELETE)
   {
    DbgPrint("Se intentó eliminar el archivo...");
    ZwClose(FileHandle);
    *FileHandle=NULL;
    return STATUS_INVALID_HANDLE;
   }
    }
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   return ntStatus;
}
 
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
   DbgPrint("Descargando driver...");
 
   UNHOOK_SYSCALL(ZwOpenFile, ZwOpenFileIni, ZwOpenFileRep);
 
   if(g_pmdlSystemCall)
   {
      MmUnmapLockedPages(MappedSystemCallTable, g_pmdlSystemCall);
      IoFreeMdl(g_pmdlSystemCall);
   }
}
 
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING theRegistryPath)
{
    NTSTATUS s = STATUS_SUCCESS;
 
 DriverObject->DriverUnload=OnUnload;
 
    DbgPrint("*** Programa de control de archivos. Por Hendrix ***");
 DbgPrint(" ");
 DbgPrint("Driver cargado.");
 
 
   ZwOpenFileIni =(typeZwOpenFile)(SYSTEMSERVICE(ZwOpenFile));
 
   DbgPrint("Direccion actual: 0x%x",(int)(SYSTEMSERVICE(ZwOpenFile)));
 
   g_pmdlSystemCall = MmCreateMdl(NULL, KeServiceDescriptorTable.ServiceTableBase, KeServiceDescriptorTable.NumberOfServices*4);
   if(!g_pmdlSystemCall)
      return STATUS_UNSUCCESSFUL;
 
   MmBuildMdlForNonPagedPool(g_pmdlSystemCall);
 
   g_pmdlSystemCall->MdlFlags = g_pmdlSystemCall->MdlFlags | MDL_MAPPED_TO_SYSTEM_VA;
 
   MappedSystemCallTable = MmMapLockedPages(g_pmdlSystemCall, KernelMode);
 
   HOOK_SYSCALL(ZwOpenFile, ZwOpenFileRep, ZwOpenFileIni);
 
   DbgPrint("Direccion despues del Hook: 0x%x",(int)(SYSTEMSERVICE(ZwOpenFile)));
   return s;
}

Código completo del Envenenador:

Código
#include 
#include 
#include 
#include 
 
#pragma pack(1)
 
 
NTSYSAPI
NTSTATUS
NTAPI ZwOpenFile(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions);
 
typedef NTSTATUS (*typeZwOpenFile)(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions);
typeZwOpenFile ZwOpenFileIni;
 
DWORD det;
DWORD dir;
DWORD MyDir;
 
 
 
NTSTATUS ZwOpenFileRep(OUT PHANDLE FileHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,OUT PIO_STATUS_BLOCK IoStatusBlock,IN ULONG  ShareAccess,IN ULONG OpenOptions)
{
 
   NTSTATUS ntStatus;
   ANSI_STRING strf;
   OBJECT_ATTRIBUTES oa;
 
 
   ntStatus = ((typeZwOpenFile)(ZwOpenFileIni)) (FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock,  ShareAccess, OpenOptions);
   if (ntStatus!=STATUS_SUCCESS) return ntStatus;
 
 __try
    {
  //Limpiamos toda la información de la estructura para que no nos pillen el nombre del fichero
  RtlZeroMemory(ObjectAttributes,sizeof(ObjectAttributes));
  InitializeObjectAttributes(ObjectAttributes,NULL,0,NULL,NULL);
 
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   return ntStatus;
}
 
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
   DbgPrint("Descargando driver...");
 
   __asm
 {
  cli
  push eax
  mov eax, cr0
  and eax, 0xFFFEFFFF
  mov cr0, eax
  pop eax
 }
 
   __try
    {
  //Reparamos la variable del driver victima con la dirección real de la API.
  *(DWORD*)det = (DWORD)ZwOpenFileIni;
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   __asm
 {
  push eax
  mov eax, cr0
  or eax, not 0xFFFEFFFF
  mov cr0, eax
  pop eax
  sti
 }
}
 
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING theRegistryPath)
{
    NTSTATUS s = STATUS_SUCCESS;
 
 det = (DWORD) 0xf7bcc9a0;
 dir = (DWORD) 0x8056f41a;
 MyDir = (DWORD) ZwOpenFileRep;
 
 DriverObject->DriverUnload=OnUnload;
 
 DbgPrint("Modificado de memoria. Por Hendrix");
 
 
   ZwOpenFileIni =(typeZwOpenFile)0x8056f41a;
 
   __asm
 {
  cli
  push eax
  mov eax, cr0
  and eax, 0xFFFEFFFF
  mov cr0, eax
  pop eax
 }
 
   __try
    {
  //Parcheamos la variable del programa victima con la dirección de nuestra función
  *(DWORD*)det = MyDir;
 
   }
 
    __except(EXCEPTION_EXECUTE_HANDLER) 
   {
  DbgPrint("Error en el procesamiento del Driver");
   }
 
   __asm
 {
  push eax
  mov eax, cr0
  or eax, not 0xFFFEFFFF
  mov cr0, eax
  pop eax
  sti
 }
 
   DbgPrint("Hook inyectado!!");
   return s;
}

Read more ...»