经常在r3 下调试经常会看到
mov eax,fs:[18h] ;获取TEP 其实就只指向自己fs:[0]
mov eax,[eax+30h] ;获取PEB
这样的语句。
fs段在用户模式(R3)和系统模式(R0)分别指向两个最重要的系统结 构:
Ring3:
fs --> TEB (Thread Environment Block)结 构表 --> 7FFDE000即“线程环境块”。
Ring0:
fs --> KPCR (Kernel Processor Control Region) 结构表 --> FFFDF000 即“内核处理器控制域”。
通常在其r3 下fs被用于获取kernel32.dll的基地址 或者其他有关于程序线程和进程的信息。
以下是一些参考资料
FS:[0x00] Win9x and NT Current SEH frame
FS:[0x04] Win9x and NT Top of stack
FS:[0x08] Win9x and NT Current bottom of stack
FS:[0x10] NT Fiber data
FS:[0x14] Win9x and NT Arbitrary data slot
FS:[0x18] Win9x and NT Linear address of TIB(TEB— 也叫做线程信息块 TIB)
FS:[0x20] NT Process ID
FS:[0x24] NT Current thread ID
FS:[0x2C] Win9x and NT Linear address of the thread local storage array
FS:[0x30] Pointer to PEB