waliedassar

InstrumentationCallback Anti-Debug+Redirection

Apr 19th, 2013
1,542
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //http://waleedassar.blogspot.com
  2. //https://twitter.com/waleedassar
  3. //Thanks to https://twitter.com/nickeverdox
  4. //------64-Bit---------------
  5. #define ProcessInstrumentationCallback 0x28
  6. extern "C"
  7. {
  8.         void DbgBreakPoint();
  9.         int __stdcall ZwSetInformationProcess(HANDLE,unsigned long long,unsigned long long*,unsigned long long);
  10. }
  11.  
  12. void* BeingDebugged()
  13. {
  14.     unsigned long long Cano= 0;
  15.     ZwSetInformationProcess(GetCurrentProcess(),ProcessInstrumentationCallback,&Cano,0x8);
  16.     MessageBox(0,L"Being Debugged\r\n",L"waliedassar",0);
  17.     ExitProcess(0);
  18. }
  19. int main()
  20. {
  21.         unsigned long long Cano= (unsigned long long)&BeingDebugged;
  22.         int ret=ZwSetInformationProcess(GetCurrentProcess(),ProcessInstrumentationCallback,&Cano,0x8);
  23.         if(ret==0xC0000061) printf("Expected\r\n");
  24.         return 0;
  25. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×