Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Python installable command line utility for mitigation of instance and key compromises.


Read the full documentation on read the docs.


For more information see the quickstart.


pip install aws_ir

Or see installing.

AWS Credentials

Ensure aws credentials are configured under the user running aws_ir as documented by amazon.

Check back soon for an IAM policy featuring the minimum set of required permissions

Optional Arguments

usage: aws_ir [-h] [--version] [--verbose] [--profile PROFILE]
              [--case-number CASE_NUMBER]
              [--examiner-cidr-range EXAMINER_CIDR_RANGE]
              [--bucket-name BUCKET_NAME] [--dry-run]
              {instance-compromise,key-compromise} ...

Incident Response command line for Amazon Web Services. This command line
interface is designed to process host and key based incursions without delay
or error.

positional arguments:

optional arguments:
  -h, --help            show this help message and exit

  --version             show program's version number and exit
  --verbose             log debug messages
  --profile PROFILE     A named boto profile to use instead of the default
  --case-number CASE_NUMBER
                        The case number to use., usually of the form
  --examiner-cidr-range EXAMINER_CIDR_RANGE
                        The IP/CIDR for the examiner and/or the tool. This
                        will be added as the only allowed range in the
                        isolated security group.
  --bucket-name BUCKET_NAME
                        Optional. The id of the s3 bucket to use. This must
                        already exist
  --dry-run             Dry run. Pass dry run parameter to perform API calls
                        but will not modify any resources.

Key Compromise

The aws_ir subcommand key-compromise disables access keys in the case of a key compromise. It's single argument is the access key id, he compromised key is disabled via the AWS api.

usage: aws_ir key-compromise [-h] --access-key-id ACCESS_KEY_ID
                             [--plugins PLUGINS]

optional arguments:
  -h, --help            show this help message and exit
  --access-key-id ACCESS_KEY_ID
  --plugins PLUGINS     Run some or all of the plugins in a custom order.
                        Provided as a comma separated listSupported plugins:

Below is the output of running the key-compromise subcommand.

$ aws_ir key-compromise --access-key-id AKIAINLHPIG64YJXPK5A
2017-07-20T21:04:01 - aws_ir.cli - INFO - Initialization successful proceeding to incident plan.
2017-07-20T21:04:01 - aws_ir.plans.key - INFO - Attempting key disable.
2017-07-20T21:04:03 - aws_ir.plans.key - INFO - STS Tokens revoked issued prior to NOW.
2017-07-20T21:04:03 - aws_ir.plans.key - INFO - Disable complete.  Uploading results.
Processing complete for cr-17-072104-7d5f
Artifacts stored in s3://cloud-response-9cabd252416b4e5a893395c533f340b7

Instance Compromise

The aws_ir subcommand instance-compromise preserves forensic artifacts from a compromised instance after isolating the instance. Once all artifacts are collected and tagged the compromised instance is powered off. The instance-compromise subcommand takes three arguments, the instance-ip of the compromised instance, a user with ssh access to the target instance, and the ssh-key used for authentication.

Currently user must be capable of passwordless sudo for memory capture to complete. If user does not have passwordless sudo capabilities all artifiacts save for the memory capture will be gathered.

AWS IR saves all forensic artifacts except for disk snapshots in an s3 bucket created for each case. Disk snapshots are tagged with the same case number as the rest of the rest of the artifacts.

Below is the output of running the instance-compromise subcommand.

$  aws_ir --examiner-cidr-range '' instance-compromise --target --user ec2-user --ssh-key ~/Downloads/testing-041.pem
   2017-07-20T21:10:50 - aws_ir.cli - INFO - Initialization successful proceeding to incident plan.
   2017-07-20T21:10:50 - - INFO - Initial connection to AmazonWebServices made.
   2017-07-20T21:11:03 - - INFO - Inventory AWS Regions Complete 14 found.
   2017-07-20T21:11:03 - - INFO - Inventory Availability Zones Complete 37 found.
   2017-07-20T21:11:03 - - INFO - Beginning inventory of resources world wide.  This might take a minute...
   2017-07-20T21:11:03 - aws_ir.libs.inventory - INFO - Searching ap-south-1 for instance.
   2017-07-20T21:11:05 - aws_ir.libs.inventory - INFO - Searching eu-west-2 for instance.
   2017-07-20T21:11:05 - aws_ir.libs.inventory - INFO - Searching eu-west-1 for instance.
   2017-07-20T21:11:06 - aws_ir.libs.inventory - INFO - Searching ap-northeast-2 for instance.
   2017-07-20T21:11:07 - aws_ir.libs.inventory - INFO - Searching ap-northeast-1 for instance.
   2017-07-20T21:11:08 - aws_ir.libs.inventory - INFO - Searching sa-east-1 for instance.
   2017-07-20T21:11:09 - aws_ir.libs.inventory - INFO - Searching ca-central-1 for instance.
   2017-07-20T21:11:09 - aws_ir.libs.inventory - INFO - Searching ap-southeast-1 for instance.
   2017-07-20T21:11:10 - aws_ir.libs.inventory - INFO - Searching ap-southeast-2 for instance.
   2017-07-20T21:11:11 - aws_ir.libs.inventory - INFO - Searching eu-central-1 for instance.
   2017-07-20T21:11:12 - aws_ir.libs.inventory - INFO - Searching us-east-1 for instance.
   2017-07-20T21:11:13 - aws_ir.libs.inventory - INFO - Searching us-east-2 for instance.
   2017-07-20T21:11:13 - aws_ir.libs.inventory - INFO - Searching us-west-1 for instance.
   2017-07-20T21:11:13 - aws_ir.libs.inventory - INFO - Searching us-west-2 for instance.
   2017-07-20T21:11:14 - - INFO - Inventory complete.  Proceeding to resource identification.
   2017-07-20T21:11:14 - - INFO - Proceeding with incident plan steps included are ['gather_host', 'isolate_host', 'tag_host', 'snapshotdisks_host', 'examineracl_host', 'get_memory', 'stop_host']
   2017-07-20T21:11:14 - - INFO - Executing step gather_host.
   2017-07-20T21:11:15 - - INFO - Executing step isolate_host.
   2017-07-20T21:11:16 - - INFO - Executing step tag_host.
   2017-07-20T21:11:17 - - INFO - Executing step snapshotdisks_host.
   2017-07-20T21:11:17 - - INFO - Executing step examineracl_host.
   2017-07-20T21:11:19 - - INFO - Executing step get_memory.
   2017-07-20T21:11:19 - - INFO - attempting memory run
   2017-07-20T21:11:19 - - INFO - Attempting run margarita shotgun for ec2-user on with /Users/akrug/Downloads/testing-041.pem
   2017-07-20T21:11:21 - margaritashotgun.repository - INFO - downloading as lime-2017-07-21T04:11:21-4.9.32-15.41.amzn1.x86_64.ko
   2017-07-20T21:11:25 - margaritashotgun.memory - INFO - dumping memory to s3://cloud-response-a0f2d7e68ef44c36a79ccfe4dcef205a/
   2017-07-20T21:15:43 - margaritashotgun.memory - INFO - capture 10% complete
   2017-07-20T21:19:37 - margaritashotgun.memory - INFO - capture 20% complete
   2017-07-20T21:23:41 - margaritashotgun.memory - INFO - capture 30% complete
   2017-07-20T21:28:17 - margaritashotgun.memory - INFO - capture 40% complete
   2017-07-20T21:32:42 - margaritashotgun.memory - INFO - capture 50% complete
   2017-07-20T21:37:18 - margaritashotgun.memory - INFO - capture 60% complete
   2017-07-20T21:39:18 - margaritashotgun.memory - INFO - capture 70% complete
   2017-07-20T22:00:13 - margaritashotgun.memory - INFO - capture 80% complete
   2017-07-20T22:04:19 - margaritashotgun.memory - INFO - capture 90% complete
   2017-07-20T22:17:32 - margaritashotgun.memory - INFO - capture 100% complete
   2017-07-20T21:41:52 - - INFO - memory capture completed for: [''], failed for: []
   2017-07-20T21:41:52 - - INFO - Executing step stop_host.

Processing complete for cr-17-072104-7d5f
Artifacts stored in s3://cloud-response-a0f2d7e68ef44c36a79ccfe4dcef205a

Instance Compromise -- Isolation Achieved

See below that I've connected to the compromised workstation from my examiner IP address. SSH is all that is permitted due to the NACL and Security Group additions.

[root@ip-172-31-9-119 ec2-user]# yum install iotop
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package iotop.noarch 0:0.3.2-7.6.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

iotop-0.3.2-7.6.amzn1.noarch.r FAILED [Errno 12] Timeout on (28, 'Connection timed out after 10000 milliseconds')
Trying other mirror.

Exiting on user cancel
[root@ip-172-31-9-119 ec2-user]# ping
PING ( 56(84) bytes of data.
--- ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3076ms

[root@ip-172-31-9-119 ec2-user]#

User Guide

Read more about each subcommand in our user guide.


Python installable command line utiltity for mitigation of host and key compromises.







No packages published