垃圾堆——windowssky
人生就象一场旅行 不必在乎目的地 在乎的是沿途的风景以及看风景的心情
<
2008年6月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
留言簿(8)
给我留言
查看公开留言
查看私人留言
随笔分类
naked/dos/boot/ldr/fsf (1)
(rss)
安全之Exploit/Shellcode (2)
(rss)
安全之Rootkits/Virus (7)
(rss)
windows驱动(IFS/NDIS) (4)
(rss)
windows内核 (8)
(rss)
随笔档案
2008年6月 (2)
2007年11月 (1)
2007年9月 (1)
2007年8月 (3)
2007年7月 (3)
2007年6月 (2)
2007年5月 (3)
2007年4月 (6)
文章档案
相册
test (12)
NDIS IFS
Insecure
NDIS
Pcausa
Winpcap
内核研究
Internals
NtKernel
Undocumented
基础知识
C CPP learner
EliCZ(PE Research)
安全技术
Blackhat
Exploit
He4dev(来自俄罗斯的黑客技术)
Kernel develop link web
RootKit
Securiteam
中国信息安全研究小组
国外安全焦点
安全焦点
邪恶八进制
操作系统
FreeBSD Org
MenuetOS
Osbase
ReactOs(研究Windows Nt的好东东)
病毒技术
29A
CVC电脑病毒论坛
Phrack
网络技术
RFC Home
Sourcecode
Windows network services internals
中国协议分析网(有中文的RFC文档)
逆向工程
Crackserver
CrackZ's
IDA Home
Woodmann
看雪论坛
驱动开发
DriverDevelop
Electronicstalk
Osronline
搜索
最新评论
1. ????????????????????????-unlocker????????????
????????????????????????-unlocker????????????
--
2. re: (转)Hooking into NDIS and TDI
link:blog.vckbase.com
--PTFE, Teflon
3. re: PE加载器的实现
兄弟,你哪来的Windows NT的源代码?
--afu
4. re: 游戏保护之乱谈
TesSafe.sys。。。。
--cooc
5. snowless
The gem cannot be polished without friction, nor man perfected without trials.
--snowless
6. thalassotherapy
I'm moving, but don't worry! [Someone once] told me we're all on the same planet, so I'll be okay!
--thalassotherapy
7. skyline
Truth has beauty, power and necessity.
--skyline
8. airiness
The dead might as well try to speak to the living as the old to the young.
--airiness
9. grab
You can't deny laughter. When it comes, it plops down in your favorite chair and stays as long as it wants.
--grab
10. amimia
Our patience will achieve more than our force.
--amimia
阅读排行榜
1. PE加载器的实现(5994)
2. Smss.exe进程分析(4915)
3. 绕过杀毒软件之一(实时监控篇)续(4678)
4. 游戏保护之乱谈(4549)
5. Zw*与Nt*的区别(4243)
6. 小议文件保护和锁定技术(4216)
7. FAT32文件系统格式浅析(4128)
8. 线程调度的部分资料(乱)(4118)
9. Code Inject的新技术(3985)
10. Rootkit 1: Detection Hide Process(3846)
评论排行榜
1. FAT32文件系统格式浅析(50)
2. AVP主动防御之隐藏进程(9)
3. 游戏保护之乱谈(8)
4. PE加载器的实现(4)
5. 小议文件保护和锁定技术(4)
6. Smss.exe进程分析(3)
7. Zw*与Nt*的区别(2)
8. 绕过杀毒软件之一(实时监控篇)续(2)
9. Code Inject的新技术(1)
10. (转)Hooking into NDIS and TDI(1)
VC知识库BLOG
首页
新随笔
联系
聚合
登录
随笔-21 文章-0 评论-85 Trackbacks-1
2008年6月1日
游戏保护之乱谈
前段时间无聊时,简单逆向了XX游戏保护的驱动;本来不准备写这篇文章,但搜索资料看到类似代码,想做个简单的比较,纯属娱乐,各位看官见笑
一 xx游戏保护驱动的实现:
TSDeviceControl()
IOCTL_TS_INIT(初始化游戏保护器):
1) Irp->AssociatedIrp.SystemBuffer输入参数格式
struct{dword dwMajorVersion;
dword dwMinorVersion;
dword dwServicePackMajor;
dword dwServicePackMinor;
dword dwNum; //需保护进程数目
dword dwPID[32]; //需保护进程列表
dword decode; //密钥
}InitParam;
2)TSDecodeControlParam();//对输入参数进行解密
3)TSInitGuardProcess();//初始化需保护的进程列表
{
if (InitParam.dwNum <= 0)
{
return;
}
for(int i=0; i<InitParam.dwNum && i<LIMIT_GUARD_PROCESS_NUM; i++)
{
if (PsLookupProcessByProcessId(InitParam.dwPID[i], g_GuardEProcess[g_GuardEProcessNum]) == STATUS_SUCCESS)
{
g_GuardEProcessNum++;
}
}
}
#define LIMIT_GUARD_PROCESS_NUM 32
dword g_GuardEProcessNum;
EPROCESS g_GuardEProcess[LIMIT_GUARD_PROCESS_NUM];
4)TSInitINTNumber();
(1)初始化GDI(win32k.sys)中要detour的服务中断号
(2)动态加载PsGetProcessImageFileName
5)TSSetKernelHook();
(1)动态加载ObOpenObjectByPointer和NtOpenProcess
(2)查找NtOpenProcess中调用ObOpenObjectByPointer的地址(内置了一个小的反汇编引擎)
mov ecx, g_NtOpenProcess ;
cmp al, 0E8h ; is relative call
jnz short Loc_NoRelativeCall ;
mov eax, [ecx+1] ;
mov g_CallObOpenObjectByPointerAddr, eax ;
lea eax, [eax+ecx+5]; ; 相对转跳的位置
cmp eax, g_ObOpenObjectByPointer ; 是否是ObOpenObjectByPointer的地址
如果成功找到;detour后NtOpenProcess的实现就是:
NTSTATUS NtOpenProcess(...)
{
...
call NewObOpenObjectByPointer();
test eax, eax
jz Loc_exit;
...
}
(3)如果上述任何(1)/(2)步骤失败:
(a)从ntoskrnel.exe文件中读取KeServiceDescriptorTable的service列表(服务的地址)
(b)根据不同版本的os版本,获得NtReadVirtualMemory/NtWriteVirtualMemory的服务中断号
(c)并分析出NtReadVirtualMemory/NtWriteVirtualMemory的地址([文件偏移->内存偏移]+ntoskrnel baseAddr)
上述步骤成功;detour NtReadVirtualMemory/NtWriteVirtualMemorydetour后的实现就是:
NTSTATUS NtReadVirtualMemory/NtWriteVirtualMemorydetour()
{
mov eax, NewFunAddr;
jmp eax;
.....
}
6)TSSetGDIHook()
(1)查找KeServiceDescriptorTableShadow的地址(KeAddSystemServiceTable和KeServiceDescriptorTable匹配法)
代码到处都有就不贴了
(PS 方法一:GUI KTHREAD.ServiceTable; 方法二:上下空间内搜索-2k上xp下; 方法三:KeAddSystemServiceTable法)
(2)根据TSInitINTNumber()获得要detour的GDI(win32k.sys中)函数地址
(1) NtUserGetDCIndex
(2) NtUserGetDCExIndex
(3) NtUserBuildHwndListIndex
(4) NtUserFindWindowExIndex
(5) NtUserGetForegroundWindowIndex
(6) NtUserWindowFromPointIndex
(7) NtUserQueryWindow(此函数不detour,只为了在NewNtUserxxx中使用)
(3)ssdt hook 上述GDI(win32k.sys中)函数
7)附加一些保护和检查机制就不说了
TSAntiWindbg()
二 Cheat Engine
困了,明天再说~
发表于
2008-06-01 04:18
垃圾一堆 阅读(4549) |
评论 (8)
|
编辑
收藏