蓝队技巧:查找被隐藏的Windows服务项
时间:2020-10-23 19:13 作者:admin 分类: 渗透测试
在上篇,我们说过红队技巧:隐藏windows服务,今天抽空来更新下,如何查找这类隐藏的Windows服务项。 首先看下效果,使用powershell远程下载执行直接获得隐藏的Windows服务名称:
powershell -c "IEX (New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/Mr-xn/9ee8f18a57cc1e74fdabd98b6c5dd016/raw/ccf2c78c9d7071c8589af2ae57c3caa7433c18c9/find_hide_svc.ps1')"
如果觉得链接太长影响你发挥,可以使用缩短网址:
powershell -c "IEX (New-Object Net.WebClient).DownloadString('https://u.nu/1o-e3')"
Compare-Object -ReferenceObject ` (Get-Service | Select-Object -ExpandProperty Name | % { $_ -replace "_[0-9a-f]{2,8}$" })` -DifferenceObject (gci -path hklm:\system\currentcontrolset\services | % { $_.Name -Replace "HKEY_LOCAL_MACHINE\\","HKLM:\" } | ? { Get-ItemProperty -Path "$_" -name objectname -erroraction 'ignore' } | % { $_.substring(40) }) -PassThru | ?{$_.sideIndicator -eq "=>"}
上图有分析ps语句,其实就是查找视图里的Windows服务和系统里的服务进行对比,筛选处不同的即为隐藏的windows服务。
查询出隐藏服务后,我们就可以查询隐藏服务的详细进程,近而去排查是否正常,是否需要立即停止或者删除等待操作:
sc qc mrxn
另外,根据原文中提到的 DeepBlue.ps1 我并没有复现成功,但是可以用来辅助分析Windows事件日志还是不错的。
参考:https://www.sans.org/blog/defense-spotlight-finding-hidden-windows-services/
扫描二维码,在手机上阅读