突破虛擬指針程序緩沖區(qū)溢出攻擊_第1頁
突破虛擬指針程序緩沖區(qū)溢出攻擊_第2頁
突破虛擬指針程序緩沖區(qū)溢出攻擊_第3頁
突破虛擬指針程序緩沖區(qū)溢出攻擊_第4頁
突破虛擬指針程序緩沖區(qū)溢出攻擊_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

操作系統(tǒng):RedHat6.1內(nèi)核版本:Kernel內(nèi)核補丁 Non-executablestackpatch(bySolar[[前言CC語言編程在出技術(shù)。下面以x86Linux系統(tǒng)和C++GNU編譯器為平臺進行分析。//C++#include<stdio.h>class{charBuffer[32];voidSetBuffer(char{}void{}void{MyClass}////#include<stdio.h>class{charBuffer[32];voidSetBuffer(char{ //}virtualvoid{}classMyClass1:public{void{printf("MyClass1:");}classMyClass2:public{void{printf("MyClass2:");}void{BaseClassObject[0]=newMyClass1;Object[1]=new}MyClass1:string1MyClass2:string2下面以上例中的BaseClass基類及其派生類為例,對動態(tài)綁定的機制做一些解釋。BBufferVPointer之一。每一個類都有一個VTABLE。如下圖所示:Object[0]:| |+-->VTABLE_MyClass1:Object[1]:| |+-->VTABLE_MyClass2:BBufferVVTABLE_MyClass1VPTR指針占用。WVTABLE_MyClass2VPTR指針占用。I其它用途的數(shù)據(jù)時有可能覆蓋VPTR的內(nèi)容![[VPTR[backend@isbasetest]>gcc-obo2bo2.cpp[backend@isbasetest]>gdbbo2GNUgdbCopyright1998FreeSoftwareFoundation,GDBisfreesoftware,coveredbytheGNUGeneralPublicLicense,andyouarewelcometochangeitand/ordistributecopiesofitundercertainconditions.Type"showcopying"toseetheconditions.ThereisabsolutelynowarrantyforGDB.Type"showwarranty"fordetails.ThisGDBwasconfiguredas"i386-redhat-linux"...(gdb)disassembleDumpofassemblercodeforfunction0x80494000x80494010x80494030x80494060x80494070x80494080x80494090x804940b0x804b580 0x80494100x80494130x80494150x80494170x80494180x804c90c 0x804941d0x80494200x80494220x80494300x80494240x8049c3c 0x80494290x80494300x80494330x80494350x804b580 0x804943a0x804943d0x804943f0x80494410x80494420x804c8ec 0x8049447<main+71>: 0x804944a<main+74>: 0x804944c<main+76>: 0x804944e<main+78>: mov 0x8049450<main+80>: 0x8049c3c<throw>0x8049455<main+85>: 0x8049458<main+88>: 0x804945d<main+93>: 0x8049460<main+96>: 0x8049461<main+97>: 0x804c930<SetBuffer9BaseClassPc>0x8049466<main+102>: 0x8049469 ---Type<return>tocontinue,orq<return>toquit---0x804946e<main+110>: 0x8049471<main+113>: 0x8049472<main+114>: 0x804c930<SetBuffer9BaseClassPc>0x8049477<main+119>: 0x804947a<main+122>: 0x804947d<main+125>: 0x8049480<main+128>: 0x8049483<main+131>: 0x8049486<main+134>: 0x8049487<main+135>: 0x8049489<main+137>: 0x804948b<main+139>: 0x804948e<main+142>: 0x8049491<main+145>: 0x8049494<main+148>: 0x8049497<main+151>: 0x804949a<main+154>: 0x804949b<main+155>: 0x804949d<main+157>: 0x804949f<main+159>: 0x80494a2<main+162>: 0x80494a4<main+164>:jmp0x80494d0<main+208>0x80494a6<main+166>:jmp0x80494d0<main+208>0x80494a8<main+168>:push%ebx0x80494a9<main+169>: 0x804b4f0<builtin_delete>0x80494ae<main+174>: 0x80494b1<main+177>: 0x8049424<main+36>0x80494b6<main+182>: 0x80494b7<main+183>: call 0x804b4f0<builtin_delete>0x80494bc<main+188>: 0x80494bf 0x80494500x80494c10x80494c80x80494c30x8049c3c 0x80494c80x8049fc0 0x80494cd0x80494d00x80494d30x80494d40x80494d5---Type<return>tocontinue,orq<return>toquit---0x80494d6<main+214>: 0x80494d7<main+215>: ret0x80494d8<main+216>: nop0x80494d9<main+217>: nop0x80494da<main+218>: nop0x80494db<main+219>: nop0x80494dc<main+220>: 0x80494dd<main+221>: nop0x80494de<main+222>: nop0x80494df<main+223>: Endofassemblerdump.0x80494000x80494010x80494030x80494060x80494070x8049408針存放在0xfffffff8(%ebp),Object[1]的指針存放在0fffffffc(%ebp)。接著保存寄存器。0x80494090x804940b0x804b580 0x8049410首先調(diào)用builtin_new,在堆(heap)0x24(36字節(jié))Object[0],并將其0x80494130x80494150x8049417 0x8049418<main+24>: 0x804c90c<8MyClass1>0x804941d<main+29>: 將對象的首地址壓棧,然后調(diào)用8MyClass1MyClass1對象的構(gòu)造函(constructor(gdb) Dumpofassemblercodefor 0x804c90c< 0x804c90d< 8MyClass1+1>: 0x804c90f< push %ebx0x804c910 0x804c9130x804c9140x804c958<0x804c919(gdb) Dumpofassemblercodeforfunction 0x804c958< 0x804c959< 0x804c95b 0x804c95e EDX+0x20(=EDX+32(gdb)x0x804e01c 0x804c91c VPTR(gdb)x0x804e010 返回到main()函數(shù)時寄存器EAX中存放著該對象在內(nèi)存中的指針。0x80494200x80494220x80494300x80494240x8049c3c 0x80494290x80494300x80494580x804945d0x8049460(gdb)x/s0x804cda2 可知該地址存放了將要通過基類BaseClassSetBuffer函數(shù)拷貝到Buffer"string1"0x80494610x804c930 0x8049466BaseClassSetBuff

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論