Windows安全中心(病毒和威胁防护)的注册
本文我们来分析一下Windows安全中心(Windows Security Center简称WSC)的注册原理,以及其中的一些比较有意思的技术性问题。
1. 简介
通常情况下,如果我们安装了一些第三方的安全软件之后,就会接管Windows的安全服务(Windows Defender);这里主要的原因大概是防止系统安全软件太多,导致Windows性能下降。可以看到如下:
以火绒为例,可以看到当系统安装了火绒安全软件之后,在Windows 安全中心的病毒和威胁防护就可以看到注册的安全软件信息了。
当系统注册了第三方安全软件之后,Windows Defender防病毒服务就停止了;这是Windows为第三方安全软件提供的一个入口,但是目前市面上很大安全软件还比不上Windows自带的Defender,也是比较讽刺。
那么怎么样才能将自己的安全软件注册到Windows安全中心呢?大致的步骤如下:
- 成为MVI会员。
- 微软提供一个内部的私有接口。
- 提供相关签名证书。
通过上面流程,我们就可以开发自己的安全软件,并且将自己的安全软件注册到WSC种。那么有没有办法可以绕过上面这些呢?这就是本文需要分析的技术性知识点。
2. WSC注册初探
WSC如果被注册成功之后,可以通过命令get-wmiObject -namespace root\SecurityCenter2 -class AntiVirusProduct
来查询相关信息,结果如下:
> get-wmiObject -namespace root\SecurityCenter2 -class AntiVirusProduct
__GENUS : 2
__CLASS : AntiVirusProduct
__SUPERCLASS :
__DYNASTY : AntiVirusProduct
__RELPATH : AntiVirusProduct.instanceGuid="{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"
__PROPERTY_COUNT : 6
__DERIVATION : {}
__SERVER : DESKTOP-1SIKOAK
__NAMESPACE : ROOT\SecurityCenter2
__PATH : \\DESKTOP-1SIKOAK\ROOT\SecurityCenter2:AntiVirusProduct.instanceGuid="{D68DDC3A-831F-4fae-9E
44-DA132C1ACF46}"
displayName : Windows Defender
instanceGuid : {D68DDC3A-831F-4fae-9E44-DA132C1ACF46}
pathToSignedProductExe : windowsdefender://
pathToSignedReportingExe : %ProgramFiles%\Windows Defender\MsMpeng.exe
productState : 393472
timestamp : Tue, 17 Dec 2024 02:37:41 GMT
PSComputerName : DESKTOP-1SIKOAK
__GENUS : 2
__CLASS : AntiVirusProduct
__SUPERCLASS :
__DYNASTY : AntiVirusProduct
__RELPATH : AntiVirusProduct.instanceGuid="{4C17E7AE-043A-D732-91B8-D139C9EB6B26}"
__PROPERTY_COUNT : 6
__DERIVATION : {}
__SERVER : DESKTOP-1SIKOAK
__NAMESPACE : ROOT\SecurityCenter2
__PATH : \\DESKTOP-1SIKOAK\ROOT\SecurityCenter2:AntiVirusProduct.instanceGuid="{4C17E7AE-043A-D732-91
B8-D139C9EB6B26}"
displayName : 火绒安全软件
instanceGuid : {4C17E7AE-043A-D732-91B8-D139C9EB6B26}
pathToSignedProductExe : C:\Program Files\Huorong\Sysdiag\bin\wsctrlsvc.exe
pathToSignedReportingExe : C:\Program Files\Huorong\Sysdiag\bin\wsctrlsvc.exe
productState : 266240
timestamp : Tue, 17 Dec 2024 02:37:36 GMT
PSComputerName : DESKTOP-1SIKOAK
在这里可以看到有两个类信息:
- Windows Defender表示默认的Windows Defender。
- 火绒安全软件表示火绒。
这里可以看到一个非常重要的信息,WSC注册的进程为C:\Program Files\Huorong\Sysdiag\bin\wsctrlsvc.exe
。
那么我们就可以请出IDA和调试神器WINDBG来分析和调试一下WSC注册的原理。
3. WSC注册原理分析
由于我们需要成为MVI会员之后,才能有相关私有SDK文档,这里我们就分析一下wsctrlsvc.exe
这个程序,大致看一下私有SDK是怎么使用的。
我们可以看到WSC相关的主要文件有如下几个: