AWS EC2 Instance Connect SSH Public Key Uploaded
Identifies when a new SSH public key is uploaded to an AWS EC2 instance using the EC2 Instance Connect service. This action could indicate an adversary attempting to maintain access to the instance. The rule detects…
Description
Identifies when a new SSH public key is uploaded to an AWS EC2 instance using the EC2 Instance Connect service. This action could indicate an adversary attempting to maintain access to the instance. The rule detects the SendSerialConsoleSSHPublicKey or SendSSHPublicKey API actions, which are logged when manually uploading an SSH key to an EC2 instance or serial connection. It is important to know that this API call happens automatically by the EC2 Instance Connect service when a user connects to an EC2 instance using the EC2 Instance Connect service via the CLI or AWS Management Console.
Detection logic
Its licence does not clear it for publishing here
Sunturai publishes a detection's own text where the licence it arrived under has been reviewed and permits it, and Elastic License 2.0 has not. The query as its source wrote it, its canonical form and the hash that pins this revision are in the workspace record.
Detection requirements
- Platform
- ContainersESXiIaaSIdentity ProviderLinuxmacOSNetwork DevicesOffice SuiteSaaSWindows
The rule states no platform. This is derived from the 2 ATT&CK techniques it maps to.
- Log source category
- event_index
Known benign triggers
- Administrators may upload SSH public keys to EC2 instances for legitimate purposes.
MITRE ATT&CK mappings
0 exclusive techniques.This is coverage no other published rule has; it is not this rule's total technique count.
References
| Reference | Cited by |
|---|---|
| cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc | 2 |
| docs.aws.amazon.com/ec2-instance-connect/latest/APIReference/API_SendSSHPublicKey.html | Only this detection cites it |
| docs.aws.amazon.com/ec2-instance-connect/latest/APIReference/API_SendSerialConsoleSSHPublicKey.html | Only this detection cites it |
| medium.parttimepolymath.net/aws-ec2-instance-connect-a-very-neat-trick-4d2fc0c28010 | Only this detection cites it |
| stratus-red-team.cloud/attack-techniques/AWS/aws.lateral-movement.ec2-instance-connect/ | Only this detection cites it |
| unit42.paloaltonetworks.com/cloud-lateral-movement-techniques | 2 |
From the source
- At source
- Open at source
- Upstream identifier
- 873b5452-074e-11ef-852e-f661ea17fbcc
- Tagged by the source as
- Data Source: Amazon Web ServicesData Source: AWSData Source: AWS CloudTrailData Source: AWS EC2Domain: CloudNoise: LowPerformance: NormalPlatform: AWSResources: Investigation GuideRule Type: Custom Query (KQL)Service: AWS EC2Tactic: Lateral MovementTactic: Privilege EscalationUse Case: Identity and Access Audit
Licence
- Published under
- Elastic License 2.0Read the licence
- Attribution
- Required
Authorship
- Written by
- Published
- Sep 20, 2026
- Version
- 3