New attack technique: Usage of ec2instanceconnect:SendSSHPublicKey on multiple instances #467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Motivation
I saw that this was an open issue: #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