您好,欢迎访问三七文档
mallocfree:linxerARK相关技术(一)目录进程线程进程模块进程其他项目驱动模块SSDTShadowSSDTFSD一.进程1.进程枚举2.EPROCESS识别3.TerminateProcess1.进程枚举A.Ring3枚举进程1.CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS)/Process32First/Process32NextZwQuerySystemInformation(SystemProcessesAndThreadsInformation)EnumWindows/GetWindowThreadProcessIdfor(;;)OpenProcess……B.PspCidTable查找PspCidTableExEnumHandleTable解析PspCidTableHANDLE_TABLEHANDLE_TABLE_ENTRYKPCR.KdVersionBlock-PspCidTable(wdbgexts.h)2000_HANDLE_TABLEtypedefstruct_HANDLE_TABLE{ULONGFlags;LONGHandleCount;PHANDLE_TABLE_ENTRY**Table;================================PEPROCESSQuotaProcess;HANDLEUniqueProcessId;LONGFirstFreeTableEntry;LONGNextIndexNeedingPool;ERESOURCEHandleTableLock;LIST_ENTRYHandleTableList;KEVENTHandleContentionEvent;}_HANDLE_TABLE,*PHANDLE_TABLE;XP~Win7HANDLE_TABLEnt!_HANDLE_TABLE+0x000TableCode:Uint8B=====================================+0x008QuotaProcess:Ptr64_EPROCESS+0x010UniqueProcessId:Ptr64Void+0x018HandleLock:_EX_PUSH_LOCK+0x020HandleTableList:_LIST_ENTRY+0x030HandleContentionEvent:_EX_PUSH_LOCK+0x038DebugInfo:Ptr64_HANDLE_TRACE_DEBUG_INFO+0x040ExtraInfoPages:Int4B+0x044Flags:Uint4B+0x044StrictFIFO:Pos0,1Bit+0x048FirstFreeHandle:Uint4B+0x050LastFreeHandleEntry:Ptr64_HANDLE_TABLE_ENTRY+0x058HandleCount:Uint4B+0x05cNextHandleNeedingPool:Uint4B+0x060HandleCountHighWatermark:Uint4BWin8_HANDLE_TABLEnt!_HANDLE_TABLE+0x000NextHandleNeedingPool:Uint4B+0x004ExtraInfoPages:Int4B+0x008TableCode:Uint4B==================================================+0x00cQuotaProcess:Ptr32_EPROCESS+0x010HandleTableList:_LIST_ENTRY+0x018UniqueProcessId:Uint4B+0x01cFlags:Uint4B+0x01cStrictFIFO:Pos0,1Bit+0x01cEnableHandleExceptions:Pos1,1Bit+0x01cRundown:Pos2,1Bit+0x01cDuplicated:Pos3,1Bit+0x020HandleContentionEvent:_EX_PUSH_LOCK+0x024HandleTableLock:_EX_PUSH_LOCK+0x028FreeLists:[1]_HANDLE_TABLE_FREE_LIST+0x028ActualEntry:[20]UChar+0x03cDebugInfo:Ptr32_HANDLE_TRACE_DEBUG_INFO2k~Win7nt!_HANDLE_TABLE_ENTRY+0x000Object:Ptr64去掉最低位,Object合法?+0x000ObAttributes:Uint4B+0x000InfoTable:Ptr64+0x000Value:Uint8B+0x008GrantedAccess:Uint4B+0x008GrantedAccessIndex:Uint2B+0x00aCreatorBackTraceIndex:Uint2B+0x008NextFreeTableEntry:Uint4BWin8nt!_HANDLE_TABLE_ENTRY+0x000VolatileLowValue:Int4B+0x000LowValue:Int4B去掉低位,合法Object?+0x000InfoTable:Ptr32_HANDLE_TABLE_ENTRY_INFO+0x000Unlocked:Pos0,1Bit+0x000Attributes:Pos1,2Bits+0x000ObjectPointerBits:Pos3,29Bits+0x004HighValue:Int4B+0x004NextFreeHandleEntry:Ptr32_HANDLE_TABLE_ENTRY+0x004LeafHandleValue:_EXHANDLE+0x004GrantedAccessBits:Pos0,25Bits+0x004ProtectFromClose:Pos25,1Bit+0x004RefCnt:Pos26,6BitsWin8X86ExpLookupHandleTableEntryWin8X64ExpLookupHandleTableEntryC.PsActiveProcessHeadSystem进程ActiveProcessLinks.BlinkKPCR.KdVersionBlock-PsActiveProcessHeadD.KiWaitInListHead/KiWaitOutListHead/KiDispatcherReadyListHead前2者是链表,通过ETHREAD.WaitListEntry串联后者是在非2000系统中是LIST_ENTRY[32],也是通过ETHREAD.WaitListEntry串联查找三个列表XP:KeDelayExecutionThreadKiWaitInListHeadKiWaitOutListHead2600:KeGetCurrentPrcb()-KiWaitInListHeadXP:KiReadyThread-KiDispatcherReadyListHead2600:KeGetCurrentPrcb()-KiDispatcherReadyListHeadE.搜索内存搜索范围EPROCESS识别F.CSRSS.EXE句柄csrss.exe识别(\Windows\ApiPort)NtQuerySystemInformation(SystemHandleInformation)收集句柄对象EPROCESS识别(或ObjectTypeNumber)G.SwapContext查找SwapContextKiDispatchInterruptInlinehook上下文保护、EDI/ESI是ETHREAD,=DPCH.EPROCESS中其它链表I……2.EPROCESS识别ObjectTypePEBVADRootObjectTable几个ThreadListHead结合ETHREAD信息……?3.TerminateProcessA.NtTerminateProcessB.涂改内存C.卸载模块D.窗口攻击E.CreateJobObject/AssignProcessToJobObject/TerminateJobObjectF.注入代码,ExitProcessG.SetThreadContextH.调试器吸附,退出I.对每个线程(GetNextProcessThread)PspTerminateThreadByPointerJ…….二.线程1.线程枚举2.ETHREAD识别3.TerminateThread1.线程枚举A.PspCidTableB.SwapContextC.搜索内存搜索范围ETHREAD识别D.ThreadListEntryEPROCESS.ThreadListEntryKPROCESS.ThreadListEntryE……2.ETHREAD识别ObjectTypeTEBETHREAD.ThreadListHeadKTHREAD.ThreadListHead定位EPROCESS,检测EPROCESS的一些信息……3.TerminateThreadNtTerminateThreadPspTerminateThreadByPointerInsertAPC杀线程三.进程模块1.PEB枚举进程模块X86情况X64情况X64程序X86程序Ring3路径重定位问题2.LdrpHashTable枚举进程模块(LIST_ENTRY[32])X86情况X64情况X64程序X86程序路径问题3.Vad枚举进程模块避免误报?lkddt_CONTROL_AREA-bnt!_CONTROL_AREA+0x000Segment:Ptr32+0x004DereferenceList:_LIST_ENTRY+0x000Flink:Ptr32+0x004Blink:Ptr32+0x00cNumberOfSectionReferences:Uint4B+0x010NumberOfPfnReferences:Uint4B+0x014NumberOfMappedViews:Uint4B+0x018NumberOfSubsections:Uint2B+0x01aFlushInProgressCount:Uint2B+0x01cNumberOfUserReferences:Uint4B+0x020u:__unnamed+0x000LongFlags:Uint4B+0x000Flags:_MMSECTION_FLAGS+0x000BeingDeleted:Pos0,1Bit+0x000BeingCreated:Pos1,1Bit+0x000BeingPurged:Pos2,1Bit+0x000NoModifiedWriting:Pos3,1Bit+0x000FailAllIo:Pos4,1Bit+0x000Image:Pos5,1Bit+0x000Based:Pos6,1Bit+0x000File:Pos7,1Bit4.搜索内存枚举进程模块搜索范围PE识别5.模块卸载远线程FreeLibraryNtUnmapViewOfSection不足:通过PEB、LdrpHashTable还可枚举到四.进程其他项目1.进程快捷键枚举NtUserRegisterHo
本文标题:ARK相关技术
链接地址:https://www.777doc.com/doc-2898491 .html