当前位置:网站首页>(18)[系统调用]追踪系统调用(服务表)
(18)[系统调用]追踪系统调用(服务表)
2022-07-30 16:56:00 【一口一个橘子】
前情回顾
反汇编
上次我们分析到KiFastCallEntry和KiSystemService交汇的地方,但是由于篇幅过长,所以截断了
系统服务表

继续分析
00407781 loc_407781: ; CODE XREF: _KiBBTUnexpectedRange+18↑j
.text:00407781 ; _KiSystemService+6E↑j
.text:00407781 mov edi, eax ; eax没有动过,所以还是 服务号
.text:00407783 shr edi, 8
.text:00407786 and edi, 30h ; edi = 系统服务表 ? 0x00 : 0x10
.text:00407786 ; 0x00: 普通服务函数
.text:00407786 ; 0x10: 图形界面函数
.text:00407789 mov ecx, edi ; ecx记录使用什么表
.text:0040778B add edi, [esi+0E0h] ; edi = _KThread.ServiceTable + 系统服务表项(0x00 or 0x10)
.text:0040778B ; 一个表四个项,刚好0x10,真是好算计
.text:00407791 mov ebx, eax ; ebx = 服务号
.text:00407793 and eax, 0FFFh ; 服务号.bit_12 = 0 (第十二位置零)
.text:00407798 cmp eax, [edi+8]
.text:0040779B jnb _KiBBTUnexpectedRange ; if (服务表.ServiceLimit < 服务号) 跳走(没有这个服务)
.text:004077A1 cmp ecx, 10h
.text:004077A4 jnz short loc_4077C0 ; if (ecx == 0 (普通函数表)) 跳转
.text:004077A6 mov ecx, ds:0FFDFF018h ; ecx = _KPCR._NT_TIB(异常链表).self
.text:004077A6 ; 这个结构体是嵌在_KPCR里的,所以刚好也指向了_KPCR的头部
.text:004077AC xor ebx, ebx
.text:004077AE
.text:004077AE loc_4077AE: ; DATA XREF: _KiTrap0E+110↓o
.text:004077AE or ebx, [ecx+0F70h]
.text:004077B4 jz short loc_4077C0 ; _KPCR._KPRCB.KeSystemCalls += 1;
.text:004077B6 push edx ; 3环参数头部
.text:004077B7 push eax ; 第几个 系统服务表
.text:004077B8 call ds:_KeGdiFlushUserBatch
.text:004077BE pop eax
.text:004077BF pop edx
.text:004077C0
.text:004077C0 loc_4077C0: ; CODE XREF: _KiFastCallEntry+B4↑j
.text:004077C0 ; _KiFastCallEntry+C4↑j
.text:004077C0 inc dword ptr ds:0FFDFF638h ; _KPCR._KPRCB.KeSystemCalls += 1;
.text:004077C6 mov esi, edx ; esi = 3环参数头部
.text:004077C8 mov ebx, [edi+0Ch] ; ebx = 系统服务表.ArgmentTable(参数表首地址)
.text:004077CB xor ecx, ecx
.text:004077CD mov cl, [eax+ebx] ; eax = 服务号 & 0xFFF (往上看)
.text:004077CD ; cl = ((BYTE*)参数表)[服务号]
.text:004077D0 mov edi, [edi] ; edi = 系统服务表.ServiceTable (函数地址表)
.text:004077D2 mov ebx, [edi+eax*4] ; ebx = *(DWORD*)(函数地址表(首地址) + 服务号 * 4)
.text:004077D2 ; //或者 ebx = ((DWORD*)函数地址表)[服务号]
.text:004077D2 ; 其中 服务号 * 4 是 地址偏移
.text:004077D5 sub esp, ecx ; 预留 压入参数 的空间
.text:004077D7 shr ecx, 2 ; ecx = 参数个数
.text:004077DA mov edi, esp ; edi = 参数首地址
.text:004077DC cmp esi, ds:_MmUserProbeAddress ; 检查 C0000005
.text:004077E2 jnb loc_407990
.text:004077E8
.text:004077E8 loc_4077E8: ; CODE XREF: _KiFastCallEntry+2A4↓j
.text:004077E8 ; DATA XREF: _KiTrap0E+106↓o
.text:004077E8 rep movsd ; 参数复制,一次一个DWORD
.text:004077E8 ; 这里base都一样,es ds可以忽略
.text:004077E8 ; while (ecx != 0){
.text:004077E8 ; step = Eflags.D ? -sizeof(dowrd) : sizeof(dword);
.text:004077E8 ; mov dword ptr es:[edi], dword ptr ds:[esi];
.text:004077E8 ; edi += step, esi += step;
.text:004077E8 ; ecx--;
.text:004077E8 ; }
.text:004077EA call ebx ; 要么C0000005,要么执行这个
.text:004077EA ; 这个就是之前找到的 服务函数,也就是最终的目标
.text:004077EC
.text:004077EC loc_4077EC: ; CODE XREF: _KiFastCallEntry+2AF↓j
.text:004077EC ; DATA XREF: _KiTrap0E+126↓o ...
.text:004077EC mov esp, ebp
.text:004077EE
好吧,这就算跟踪完了,但是返回怎么回呢,只能继续保持好奇心等学完APC再来看咯
学习没有好奇心哪来的动力,就好像小说不挖坑怎么吸引人
边栏推荐
- 浅谈在线编辑器中增量编译技术的应用
- Lotus 1.16.0 minimum snapshot export import
- How to connect redis in node.js?
- Win11如何把d盘空间分给c盘?Win11d盘分盘出来给c盘的方法
- 如何注册域名、备案以及解析
- The first time I used debug query and found that this was empty, does it mean that the database has not been obtained yet?please help.
- 登录模块调试-软件调试入门
- MySQL超详细安装教程 手把手教你安装MySQL到使用MySQL 最简单的MySQL安装方式,这种方式装,卸载也简单
- 向量检索基础方法总结
- KDD 2020 | 深入浅出优势特征蒸馏在淘宝推荐中的应用
猜你喜欢

华为云数据治理生产线DataArts,让“数据'慧'说话”

【综合类型第 34 篇】喜讯!喜讯!!喜讯!!!,我在 CSDN 的第一个实体铭牌

The first time I used debug query and found that this was empty, does it mean that the database has not been obtained yet?please help.

MySQL索引常见面试题(2022版)

Discuz magazine/news report template (jeavi_line) UTF8-GBK template

Tensorflow模型量化(Quantization)原理及其实现方法

.NET 6.0中使用Identity框架实现JWT身份认证与授权

Public Key Retrieval is not allowed error solution

LeetCode318:单词长度的最大乘积

LeetCode167: Sum of two numbers in sorted array
随机推荐
【AAAI2020】阿里DMR:融合Matching思想的深度排序模型
[NCTF2019] Fake XML cookbook-1|XXE vulnerability|XXE information introduction
第一次用debug查询,发现这个为空,是不是代表还没获得数据库的意思?求帮助。
Google Cloud Spanner的实践经验
大厂面试官眼中的好简历到底长啥样
Public Key Retrieval is not allowed error solution
Large-scale integrated office management system source code (OA+HR+CRM) source code sharing for free
Invalid or corrupt jarfile xxx.jar
Login Module Debugging - Getting Started with Software Debugging
KDD‘21推荐系统离散特征表征无embedding table Learning to Embed Categorical Features without Embedding Tables for
No qualifying bean of type问题解决
论文阅读 (63):Get To The Point: Summarization with Pointer-Generator Networks
Lotus 1.16.0 minimum snapshot export import
DTSE Tech Talk丨第2期:1小时深度解读SaaS应用系统设计
Paper reading (63): Get To The Point: Summarization with Pointer-Generator Networks
Test Management and Specification
MySQL索引常见面试题(2022版)
Discuz magazine/news report template (jeavi_line) UTF8-GBK template
Navisworks切换语言
OpenCV形状检测