- 帖子
- 957
- 积分
- 4938
- 技术
- 72
- 捐助
- 0
- 注册时间
- 2008-10-31
|
17楼
发表于 2011-8-24 16:50
| 只看该作者
这些是刚刚注入CMD进行API HOOK获得的数据
下了钩子的API有CreateFileW(用于打开文件),SetFilePointer(用于设置文件指针),ReadFileW(用于读取文件内容)
被注入的批处理代码为- InlineHook
- set "a=^"
- echo a%a%
- b
- pause
复制代码 运行的结果为
E:\Batch\InjectCMD>InlineHook
//CreateFileW, FileName:E:\Batch\InjectCMD\a.bat, Return:68
//SetFilePointer, Handle:68, Distance:0xc, Method:0, Return:0xc
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0xc
//ReadFileW, Handle:68, ToRead:8191
//SetFilePointer, Handle:68, Distance:0x17, Method:0, Return:0x17
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x17
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x17
E:\Batch\InjectCMD>set "a=^"
//CreateFileW, FileName:E:\Batch\InjectCMD\a.bat, Return:68
//SetFilePointer, Handle:68, Distance:0x17, Method:0, Return:0x17
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x17
//ReadFileW, Handle:68, ToRead:8191
//SetFilePointer, Handle:68, Distance:0x22, Method:0, Return:0x22
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x22
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x22
//ReadFileW, Handle:68, ToRead:8191
//SetFilePointer, Handle:68, Distance:0x25, Method:0, Return:0x25
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x25
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x25
E:\Batch\InjectCMD>echo ab
ab
//CreateFileW, FileName:E:\Batch\InjectCMD\a.bat, Return:68
//SetFilePointer, Handle:68, Distance:0x25, Method:0, Return:0x25
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x25
//ReadFileW, Handle:68, ToRead:8191
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x2a
//ReadFileW, Handle:68, ToRead:8191
//SetFilePointer, Handle:68, Distance:0x0, Method:2, Return:0x2a
//SetFilePointer, Handle:68, Distance:0x0, Method:1, Return:0x2a
E:\Batch\InjectCMD>pause
请按任意键继续. . . //CreateFileW, FileName:CONIN$, Return:15
分析数据可以获得以下的事实(或者是猜想?):
1、每次执行一句批处理前都会重新打开文件
2、读取不是以行为单位读取的
3、每次读取的最大长度是8191(除去\0结尾)
4、可以看到echo a%a%[回车换行]b这一句的时候读取了两次批处理,说明CMD已经发现了回车换行符被转义
5、似乎CMD的执行过程与我们想象的都不同
希望大家继续分析这些结果,如果有需要这个注入程序的可以找我要 |
-
1
评分人数
-
-
CrLf:
好!追根溯源的新方向。PB + 10
技术 + 2
|