首页
社区
课程
招聘
[原创]Windows,三环通过teb遍历进程模块,模块隐藏基础001
发表于: 2018-4-14 10:38 4501

[原创]Windows,三环通过teb遍历进程模块,模块隐藏基础001

2018-4-14 10:38
4501

废话我就不说了,按图索骥,通过fs[18]  --->  teb  ---> peb  --- 最后找模块的三张在三环的链表,在这里断链,这是模块隐藏的基础。附上源码

#include <windows.h>
typedef struct _PEB_LDR_DATA  
{
ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle; 
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList; 
PVOID EntryInProgress;
} PEB_LDR_DATA,*PPEB_LDR_DATA; 

//获得teb的地址
//fs:[18] 获得teb地址 
int GetTebAddres()
{
int TebAddres=0;
__asm{
mov eax,fs:[0x18]
mov TebAddres,eax
}
return TebAddres;
}
//获得peb地址
int GetPebAddres()
{
int PebAddres=0;
int TebAddres=GetTebAddres();

PebAddres=*(int*)(TebAddres+0x30);

return PebAddres;
}
//获得 _PEB_LDR_DATA 的地址
int GetPebLdrAddres()
{
int PebAddres=GetPebAddres();
return *(int*)(PebAddres+0x00c);
}
//获得载入模块链表
void GetInLoadOrderModuleList()
{
int PebLdrAddres=GetPebLdrAddres();
PLIST_ENTRY InLoadOrderModuleList = (PLIST_ENTRY)(PebLdrAddres+0x0c);
PLIST_ENTRY CurrentModuleList = InLoadOrderModuleList;
PPEB_LDR_DATA  CurrenPebLdrData=NULL;
while(TRUE)
{
printf("********************************************************\r\n");
CurrenPebLdrData= (PPEB_LDR_DATA)((int)CurrentModuleList - 0x0c);
if(CurrenPebLdrData->SsHandle!=0)
{
printf("Length %04x\r\n",CurrenPebLdrData->Length);
printf("Initialized %d\r\n",CurrenPebLdrData->Initialized);
printf("SsHandle %04x\r\n",CurrenPebLdrData->SsHandle); //模块的句柄
printf("EntryInProgress %04x\r\n",CurrenPebLdrData->EntryInProgress);   //模块的加载地址
}
CurrentModuleList = CurrentModuleList->Flink;
if((int)CurrentModuleList == InLoadOrderModuleList)
{
break;
}
}
}
//获得载入内存链表
void GetInMemoryModuleList()
{
int PebLdrAddres=GetPebLdrAddres();
PLIST_ENTRY InMemoryOrderModuleList = (PLIST_ENTRY)(PebLdrAddres+0x14);
}
//获得初始化链表
void GetInInitializationModuleList()
{
int PebLdrAddres=GetPebLdrAddres();
PLIST_ENTRY InInitializationModuleList = (PLIST_ENTRY)(PebLdrAddres+0x1c);
}
int main(int argc, char* argv[])
{
int TebAddres=GetTebAddres();
int PebAddres=GetPebAddres();

GetInLoadOrderModuleList();

getchar();
return 0;
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 310
活跃值: (2227)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
谢谢楼主分享
2018-4-14 17:02
0
雪    币: 20
活跃值: (26)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
这玩意,每隔几天就要发一次,而且质量参差不齐
2018-4-14 18:27
0
雪    币: 23080
活跃值: (3432)
能力值: (RANK:648 )
在线值:
发帖
回帖
粉丝
4
wx_咖啡_552099 这玩意,每隔几天就要发一次,而且质量参差不齐
这些是大家的学习成果,分享出来是一方面在不足之处可以获得论坛前辈们的指导,另一方面对自己也是一个纪念和鼓励。
2018-4-14 18:45
0
雪    币: 224
活跃值: (374)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
我想问个问题是,好多都是通过TEB来获得PEB,为什么不能直接fs:[30]来直接获取
2018-4-14 21:10
0
雪    币: 854
活跃值: (69)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
6
低手莫怪 我想问个问题是,好多都是通过TEB来获得PEB,为什么不能直接fs:[30]来直接获取
你可以去试试。我觉得可以
2018-11-22 23:17
0
游客
登录 | 注册 方可回帖
返回
//