AWS Systems Manager session or command executed from a threat intel flagged IP

Goal

Detects an accepted AWS Systems Manager StartSession or SendCommand call originating from a source IP address that Datadog Threat Intelligence flags as malicious or associated with Tor.

Strategy

This rule monitors AWS CloudTrail activity for AWS Systems Manager StartSession and SendCommand calls to ssm.amazonaws.com. These APIs provide interactive shell access through Session Manager and remote command execution through Run Command.

The rule triggers when Datadog Threat Intelligence identifies either of these conditions for the source IP (@network.client.ip):

  • @threat_intel.results.intention is malicious.
  • @threat_intel.results.category is tor.

Adversaries with valid AWS credentials can use Tor exit nodes or malicious hosting infrastructure to conceal their origin when accessing managed hosts. To trigger this rule, calls must have no recorded API error and include the returned session or command ID. An accepted API call does not confirm what activity occurred on the host.

The signal includes session or command IDs and target information for correlation with host activity. Review the triggering CloudTrail event for the access key ID, source network, account, region, and event time.

Triage and response

  • Match the returned session ID or command ID to @process.variables.ssm_session_id or @process.variables.ssm_command_id on the affected host and inspect suspicious activity in the associated process tree.
  • Determine whether the action taken by {{@userIdentity.arn}} from the flagged IP {{@network.client.ip}} is legitimate by reviewing the identity’s past activity and the type of API calls it typically makes.
  • Identify the managed node(s) or instance(s) targeted by the {{@evt.name}} call to assess the potential blast radius.
  • Examine the commands executed or the session transcript, if available, to determine whether any sensitive or destructive actions were taken.
  • Review other recent CloudTrail activity for {{@userIdentity.arn}} to check for additional signs of compromise, such as new access keys or privilege escalation attempts.
  • Use the Cloud SIEM - IP Investigation dashboard to check whether the IP {{@network.client.ip}} has been associated with other suspicious activity across the environment.
  • Begin your incident response process and rotate the credentials for {{@userIdentity.arn}} if the activity cannot be attributed to legitimate use.