日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

KiFastCallEntry簡(jiǎn)單呀簡(jiǎn)單呀分析呀分析

 昵稱2034962 2010-07-06

WinXP系統(tǒng)調(diào)用的步驟

sysenter指令:從sysenter_CS_MSR、sysenter_ESP_MSR、sysenter_EIP_MSR寄存器讀取數(shù)據(jù), 填寫cs、ss(cs+8)esp、eip。進(jìn)入ring0特權(quán)級(jí)

步驟:
0. 進(jìn)入時(shí)eax = 服務(wù)號(hào),edx = 當(dāng)前棧頂 (+0x08為用戶參數(shù)) sysenter 進(jìn)入ring0
1. 初始化ds、es為0x23,fs 0x30
2. PCR+0x40(0FFDFF040h)處取得TSS,TSS+0x04取得當(dāng)前線程內(nèi)核棧地址,賦值給esp。所以sysenter_ESP_MSR 沒有意義。
esp = pcr->TSS->Esp0
3. 關(guān)中斷,建立ThTrapFrame
ntdll!_KTRAP_FRAME
   +0x000 DbgEbp           : Uint4B
   +0x004 DbgEip           : Uint4B
   +0x008 DbgArgMark       : Uint4B
   +0x00c DbgArgPointer    : Uint4B
   +0x010 TempSegCs        : Uint4B
   +0x014 TempEsp          : Uint4B
   +0x018 Dr0              : Uint4B
   +0x01c Dr1              : Uint4B
   +0x020 Dr2              : Uint4B
   +0x024 Dr3              : Uint4B
   +0x028 Dr6              : Uint4B ;如果KTHREAD中DebugActive被置位 則填寫上面的值
   +0x02c Dr7              : Uint4B ;置0
   +0x030 SegGs            : Uint4B
   +0x034 SegEs            : Uint4B
   +0x038 SegDs            : Uint4B
   +0x03c Edx              : Uint4B
   +0x040 Ecx              : Uint4B
   +0x044 Eax              : Uint4B
   +0x048 PreviousPreviousMode : Uint4B     ;設(shè)置為USERMODE (1), 并設(shè)置KTHREAD中的對(duì)應(yīng)字段為USERMODE  

   +0x04c ExceptionList    : Ptr32 _EXCEPTION_REGISTRATION_RECORD ;從PCR獲得,并且設(shè)置更新PCR中的ExceptionList為-1
   +0x050 SegFs            : Uint4B
   +0x054 Edi              : Uint4B
   +0x058 Esi              : Uint4B
   +0x05c Ebx              : Uint4B
   +0x060 Ebp              : Uint4B
   +0x064 ErrCode          : Uint4B
   +0x068 Eip              : Uint4B   ;返回地址 從USER_SHARED_DATA+UsSystemCallReturn取得,我的系統(tǒng)上是0x7c92eb94,只是一個(gè)ret,所以返回用戶態(tài)時(shí) 直接可以返回Zw.....函數(shù)
   +0x06c SegCs            : Uint4B
   +0x070 EFlags           : Uint4B
   +0x074 HardwareEsp      : Uint4B
   +0x078 HardwareSegSs    : Uint4B
   +0x07c V86Es            : Uint4B
   +0x080 V86Ds            : Uint4B
   +0x084 V86Fs            : Uint4B
   +0x088 V86Gs            : Uint4B
更新KTHREAD中的TrapFrame

4. 從KTHREAD中取出服務(wù)表ServiceTable
   將用戶堆棧中的參數(shù)復(fù)制到內(nèi)核堆棧中,如果service no & 0x1000 為ssdtShadow服務(wù),否則為ssdt服務(wù)。
   如果是ssdtShadow服務(wù)則先Call _KeGdiFlushUserBatch
   call相應(yīng)服務(wù)
5. 取出_KTRAP_FRAME 恢復(fù)ExceptionList 等。。。。沒看下去。。。

疑問:
恢復(fù)ExceptionList 時(shí)
        mov     edx, [ebp].TsEdx        ; restore previous trap frame address
        mov     [ecx].ThTrapFrame, edx ;
   [ebp].TsEdx填了么??不應(yīng)該是[ebp].ExceptionList??


    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多