DataDog / stratus-red-team

:cloud: :zap: Granular, Actionable Adversary Emulation for the Cloud
https://stratus-red-team.cloud
Apache License 2.0
1.83k stars 215 forks source link

New attack technique: Usage of ec2instanceconnect:SendSSHPublicKey on multiple instances #467

Closed adanalvarez closed 9 months ago

adanalvarez commented 9 months ago

What does this PR do?

Motivation

I saw that this was an open issue: https://github.com/DataDog/stratus-red-team/issues/59

From the 2023 Global Cloud Threat Report from Sysdig: "The attacker leveraged an API called SendSSHPublicKey to gain access to EC2 instances as seen in the image below. Using this API, the attacker pushed an attacker‑supplied Secure Shell (SSH) public key to the specified EC2 instances, which then allowed anyone with the corresponding private key to connect directly to the systems via SSH. Once in, an attacker could take control of the machines and move on to the next step of their operation."

This attack technique creates 3 EC2 instances (this can be changed easily as there is a variable instance_count) and its VPC in the warmup. In the attack phase, it adds a public SSH key to each instance (it lasts for 60s).

Checklist

christophetd commented 9 months ago

Thanks for the contribution! Will review it later today

christophetd commented 9 months ago

Added a few tweaks in 861e1ed, but looks great overall! Will get it merged and trigger a new release

christophetd commented 9 months ago

Now released as part of v2.13.0, thanks for the great contribution!