Open In App

AWS CLI for Security Investigations

Last Updated : 18 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The AWS Command Line Interface (AWS CLI) is a powerful tool that provides a uniform method for managing your AWS resources. It acts as a connecting point for interacting with various AWS services, allowing users to perform tasks quickly and efficiently from the command line. With the AWS CLI, you have a single, comprehensive tool that simplifies the management of your cloud infrastructure.

With the AWS CLI, you only need to download and configure one tool to control and automate multiple AWS services. Whether you want to deploy applications, manage resources, or gather information, the AWS CLI allows you to run commands and scripts effortlessly. This not only saves you time but also minimizes the chance of errors, letting you focus on building and maintaining your cloud applications.

What is AWS CLI?

The AWS CLI is a command-line tool for AWS services. After installing and configuring the AWS CLI program with your AWS, you may operate AWS services from the command line and automate tasks using scripts. Because it supports scripting into a range of development and operational settings, it is an adaptable option for AWS Users.

Prerequisites of AWS CLI for Security Investigations

  • AWS Account: All security-related services, including CloudTrail, GuardDuty, and IAM, require an active AWS account with permissions.
  • AWS CLI Installed: After that you need to check the computer will have the AWS Command Line Interface, or CLI
  • AWS CLI Configured: Configure AWS CLI with your credentials and default region after installation.
  • IAM permission: Ensure the role or AWS user you are logging in with has the necessary permissions to view security events. The most common services utilized when storing evidence in a security investigation.

Step-by-Step Guide to AWS CLI for Security Investigations

Here is the step-by-step implementation of AWS CLI for Security Investigations:

Step 1: Enable AWS CloudTrail and Query Logs

To get started, CloudTrail logs every AWS API call. Use it to discover specifics about what users or services have done.

aws cloudtrail create-trail --name my-trail --s3-bucket-name my-bucket
aws cloudtrail start-logging --name my-trail

Output:

AWS_CLI1

Step 2: Monitor IAM Activity

Confirming that unknown activities are present, like permissions or unauthorized access changes- View the last user actions performed and the user roles.

aws iam list-users

Output:

AWS_CLI2

Step 3: Monitor S3 Bucket Activity

Next, Unauthorized S3 access may indicate a security breach.

aws s3 ls

Output:

AWS_CLI3

Step 4: Investigate Security Groups

It is, therefore important, that you have a review of your settings in your security group before you access the VPC flow log to detect any unusual configuration of the network or rules set up to be too lenient.

aws ec2 describe-security-groups

Output:

AWS_CLI8-

Step 5: Query VPC Flow Logs

VPC Flow Logs keep track of all IP traffic entering and leaving your VPC's network interfaces.

aws ec2 describe-flow-logs

Output:

AWS_CLI4

Step 6: Check GuardDuty Findings

In the next step, GuardDuty analyzes DNS logs, VPC Flow Logs, and AWS CloudTrail to assist find any security risks.

aws guardduty create-detector --enable

Output:

AWS_CLI5

Step 7: Review AWS Config for Policy Violations

Finally, AWS Config keeps track of changes made to AWS useful things/valuable supply setups. It helps in locating useful things/valuable supplies that are not cooperative.

aws configservice describe-compliance-by-config-rule

Output:

AWS_CLI6

Best Practices of AWS CLI for Security Investigations

  • Use Amazon GuardDuty: Amazon GuardDuty is a threat detection service that protects your accounts, containers, workloads, and data in your AWS (surrounding conditions).
  • Automate and Centralize Security Monitoring: Manual research can make mistakes. Centralized monitoring helps find security issues
  • Enable CloudTrail's log file integrity: Validated log files are very useful for security and forensic investigations. For example, a validated log file allows you to confidently state that the log file has not changed or that specific IAM identity credentials conducted a specific API activity.
  • Use the AWS Security Hub: Using AWS Security Hub, you may monitor how you use CloudTrail about security best practices. Security Hub employs detective security controls to examine useful things/valuable supply setups and security needed things, helping you in obeying multiple.

Conclusion

In conclusion, the AWS Command Line Interface (AWS CLI) runs the start-investigation command using this. Detective connects with Amazon Security Lake, which allows you to query and obtain raw log data stored in Security Lake.


Next Article
Article Tags :

Similar Reads