找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 4653|回复: 2

[转帖]What are Little PatchGuards Made Of?

[复制链接]

857

主题

2632

回帖

2

精华

管理员

此生无悔入华夏,  长居日耳曼尼亚。  

积分
36130
发表于 2015-10-29 21:01:20 | 显示全部楼层 |阅读模式
FROM: http://www.alex-ionescu.com/?p=290
A number of excellent PatchGuard articles have been written around what PatchGuard is, how to bypass it, what triggers it uses, its obfuscation techniques, and more.

But for some reason, nobody has published a full list of everything that PatchGuard actually verifies. Microsoft used to have a website that listed the initial first 7 checks, but nothing beyond that.

I asked around at conferences, and the answer I got was that the code was too complex to analyze, and nobody really wanted to take the time to figure out every single check. I had my own private list of checks I knew PatchGuard does (through runtime analysis), but I was surprised to see the real reason nobody’s bothered to analyze this…

… Microsoft’s own public debugger (known as WinDBG) tells you — why bother reversing? :)

Lo’ and behold, the 39 different checks in PatchGuard Windows 8.1 Update. There’s a few more in Windows 10, I guess they’re not yet documented.
  1. CRITICAL_STRUCTURE_CORRUPTION (109)
  2. Arguments:
  3. Arg1: 00000000, Reserved
  4. Arg2: 00000000, Reserved
  5. Arg3: 00000000, Failure type dependent information
  6. Arg4: 00000000, Type of corrupted region, can be
  7. 0 : A generic data region
  8. 1 : Modification of a function or .pdata
  9. 2 : A processor IDT
  10. 3 : A processor GDT
  11. 4 : Type 1 process list corruption
  12. 5 : Type 2 process list corruption
  13. 6 : Debug routine modification
  14. 7 : Critical MSR modification
  15. 8 : Object type
  16. 9 : A processor IVT
  17. a : Modification of a system service function
  18. b : A generic session data region
  19. c : Modification of a session function or .pdata
  20. d : Modification of an import table
  21. e : Modification of a session import table
  22. f : Ps Win32 callout modification
  23. 10 : Debug switch routine modification
  24. 11 : IRP allocator modification
  25. 12 : Driver call dispatcher modification
  26. 13 : IRP completion dispatcher modification
  27. 14 : IRP deallocator modification
  28. 15 : A processor control register
  29. 16 : Critical floating point control register modification
  30. 17 : Local APIC modification
  31. 18 : Kernel notification callout modification
  32. 19 : Loaded module list modification
  33. 1a : Type 3 process list corruption
  34. 1b : Type 4 process list corruption
  35. 1c : Driver object corruption
  36. 1d : Executive callback object modification
  37. 1e : Modification of module padding
  38. 1f : Modification of a protected process
  39. 20 : A generic data region
  40. 21 : A page hash mismatch
  41. 22 : A session page hash mismatch
  42. 23 : Load config directory modification
  43. 24 : Inverted function table modification
  44. 25 : Session configuration modification
  45. 102 : Modification of win32k.sys
复制代码

I have to admit, there are some things I didn’t realize PatchGuard would actually think about protecting, such as the Local APIC. It’s also interesting to see some more esoteric hooks in the list as well, such as PsEstablishWin32Callout protection. I also did not realize PatchGuard now protects the DRIVER_OBJECT structure — indeed, hooking a major function will now give you code 0x1C. And finally, the protection of protected processes means that technically something such as Mimikatz’s “MimiDrv” may crash some machines in the wild.

I usually try to avoid talking about PatchGuard since I’m glad it’s giving AV companies hell, but I can’t have been the only person that never noticed that the checks were documented in the debugger all along, hidden behind a simple command (it makes sense that Microsoft wouldn’t want their own support engineers to be wondering what on Earth they’re looking at):

!analyze -show 109
I can’t even take credit for discovering this on my own. Reading Microsoft’s famous “NT Debugging” blog made me realize that this had been there all along.

Enjoy!
简单解释一下给看不懂英语的网友:这篇文章详细描述了PATCHGUARD检查内核的那些数据

1

主题

24

回帖

0

精华

贵宾会员

积分
677
发表于 2015-10-29 21:09:46 | 显示全部楼层
这简单解释真简单

28

主题

116

回帖

0

精华

铜牌会员

积分
273
发表于 2015-12-25 08:51:14 | 显示全部楼层
jiu63577 发表于 2015-10-30 09:28
好悲剧 花了将近20分钟 结合有道词典 才勉强看懂了

为什么不用谷歌翻译?
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表