🕳️
The Cyber Security Library
  • The Library
  • Offensive Security
    • Solar, Exploiting log4j
      • Reconnaissance
      • Discovery
      • Proof of Concept
      • Exploitation
    • Basic Authentication Bypass
      • Username Enumeration
      • Brute Force
      • Logic Flaw
      • Cookie Tampering
    • Insekube
      • Recon with Nmap
      • Checking out the web address
      • Creating a Reverse shell
      • Inside the Kubernetes pod
      • CVE-2021-43798
    • Snort
      • What is Snort? (For the uninitiated)
      • Task exercise
      • Traffic Generator
      • Brief overview of IDS and IPS
      • Checking Snort
      • Snort Sniffer mode
      • Packet Logger mode
    • Runtime Detection Evasion
      • Learning Objectives of AMSI
      • Runtime detections
      • AMSI Overview
      • AMSI Instrumentation
      • Powershell Downgrade
      • Powershell Reflection
      • Patching AMSI
    • Red team recon using OSINT
      • Taxonomy of Reconnaissance
      • Built-in tools
      • Advanced Searching
      • Specialized Search Engines
  • Malware
    • Introduction to Malware Analysis
      • What are the different types of malware analysis
      • Doing different types of analysis
      • Anti analysis techniques
    • Ransomeware: Maze
    • Exploring Steganography
    • Simple Trojan with Python
      • The Python Trojan
      • Breaking down the python code
  • Vulnerability Management
    • Nessus
      • Introduction
      • Nessus Essentials
      • Scans
      • Authenticated Scans
      • Results
      • Running custom scans
  • Cloud
    • AWS
      • AWS CDK: Deploy and using amazon SQS Que from Repo
        • Node modules and Bootstrapping troubleshooting
        • Sending and Receiving information from the stack
        • Destroying the stack and cleaning up
      • Using Different AWS Services with Splunk
        • AWS Config
          • How Does Config work?
          • How to enable Config
          • Settings
          • Aggregation
          • Creating Config Resource
          • Creating Aggregator
          • Adding Rules
        • CloudTrail
          • What is CloudTrail?
          • Features of CloudTrail
          • Benefits of CloudTrail
          • CloudTrail Event History
          • Securing CloudTrail
        • EventBridge
          • Configuring EventBridge and Event Patterns
          • EventBridge Targets
        • CloudWatch
          • The CloudWatch Dashboard
            • Virtual Machine
          • CloudWatch Alarms and Metric Filters
            • Searching logs using metric filters
            • CloudWatch Alarms
          • CloudWatch CIS Alarms
            • SNS
        • Configuring VPC Flow Logs
          • An introduction to VPC flow logs
        • Automating Incident Response with EventBridge
          • Creating Lambda functions
        • CloudTrail SIEM Integration (Splunk)
          • AWS architecture for integrating with Splunk
      • AWS DevOps EBS Volumes
        • CloudWatch
        • EBS Volume
        • Lambda
      • EKS Creating a deployment with AWS in the command Line
        • Setting up AWS Cloud9
        • Creating a Cluster
        • Creating Deployment
      • How to CloudShell SSH in to ec2 Instances
    • Azure
      • Worker CTF (Azure DevOps)
        • Enumeration
        • Using SVN
        • Exploring the Domain
        • Cracking Azure DevOps console
      • Software development environments and Azure DevOps pipeline abuse
        • Accessing Azure Devops
        • Exploring Project Pages
  • Splunk
    • Splunk SIEM Integration
      • AWS architecture for integrating with Splunk
    • Splunk Threat Hunting Ep.6 Credential Access
  • DevOps
    • Using AWS, Docker, Jenkins and SonarQube to improve code quality
      • Updating the Cloud Instance and Getting Docker
      • Installing SonarQube
      • Creating Jenkins Server
      • Manaing SonarQube and Jenkins
    • Creating a Codebuild project and getting the output with CloudWatch Logs
      • IAM
      • CodeBuild
  • CTF's
    • THM Wonderland
      • Nmap and Gobuster
      • Entering Wonderland
      • Privilege Escalation
    • Healthcare OpenEMR system -THM Plotted EMR
      • Recon with Nmap
      • Exploring the ports found
      • Gobuster
      • Searchsploit Open emr
    • Steam Cloud CTF Exploiting Kubernetes
      • SteamCloud Privilege Escalation
    • THM Flatline CTF
      • Recon with Nmap
      • Searchsploit for freeswitch
      • Using the exploit
      • Escalating my privileges
      • Gaining access inside the Windows RDP
    • Biteme CTF
      • Recon
      • Looking into the PHP code and decoding hexadecimal
      • Python script and Bash script
      • Bruteforcing MFA Code
      • Trying to gain access via SSH
      • Inside SSH
      • Fail2ban Privilege Escalation
    • Devoops CTF
      • Enumeration
      • Exploiting Web Page
      • Creating Python exploit
    • GoBox CTF
      • Enumeration
      • Using Burpsuite and creating Reverse shell
    • Explore: Android Box
      • Enumeration
      • Initial foothold
      • Privilege escalation
Powered by GitBook
On this page
  1. Cloud
  2. AWS
  3. Using Different AWS Services with Splunk
  4. CloudWatch
  5. CloudWatch CIS Alarms

SNS

PreviousCloudWatch CIS AlarmsNextConfiguring VPC Flow Logs

Last updated 1 year ago

When creating effective Cloudwatch security alarms, it's important to ensure you've created an SNS topic that notifies when an alert is triggered – for example, via email. This means if a CloudWatch alarm event is triggered, you'll get feedback via a channel that you monitor, as you likely won't have the CloudWatch alarms dashboard open at all times). The CIS benchmark for AWS documents this well as it's part of their alarm guidance. However, it's out of scope for the purposes of this lab.

Investigating alerts

When a CloudWatch alarm is triggered, it doesn't actually give any visibility into what triggered it. For example, take CIS Benchmark 3.2 – Ensure a log metric filter and alarm exist for AWS Management Console sign-in without MFA. The metric filter for this event to trigger an alarm is the following:

//{ ($.eventName = "ConsoleLogin") && ($.additionalEventData.MFAUsed != "Yes") && ($.userIdentity.type = "IAMUser") && ($.responseElements.ConsoleLogin = "Success") }

This triggers the alarm, but the alarm has no understanding of which user actually triggered it. it only knows that a log event has appeared that matches the metric filter.

A mature organization would likely send all of its CloudTrail logs to a central SIEM to be processed (such as Splunk). If an alert was triggered in this scenario, you'd use Splunk to search the logs, investigate what caused the event, work out whether the event needs to be escalated, and determine if triage is required.

Now to Create the following metric filter using the Metrolio-LG log group.

  • Filter pattern: { ($.eventName = "ConsoleLogin") && ($.additionalEventData.MFAUsed != "Yes") && ($.userIdentity.type = "IAMUser") && ($.responseElements.ConsoleLogin = "Success") }

  • Filter name: CIS-NO-MFA-FILTER

  • Namespace: Enter LogMetrics for the namespace

  • Metric name: CIS-NO-MFA-METRIC

  • Metric value: 1

Leave the other settings as default.

Now to Create an alarm based on the metric filter in Part 1 above that meets the following criteria:

  • In the Metric section, leave the default values

  • Under Conditions, for Threshold, choose Static

  • For Define the alarm condition, choose Greater/Equal

  • For Define the threshold value, enter 1

  • Ensure you remove the Alarm Trigger state

  • Set a name of CIS-NO-MFA-ALARM

Now to create an alarm based on CIS Benchmark 3.6 – Ensure a log metric filter and alarm exist for AWS Management Console authentication failures

Create the following metric filter using the Metrolio-LG log group.

  • Filter pattern: {($.eventName=ConsoleLogin) && ($.errorMessage="Failed authentication")}

  • Filter name: CIS-CONSOLE-AUTH-FAILURE-FILTER

  • Namespace: Enter LogMetrics for the namespace

  • Metric name: CIS-CONSOLE-AUTH-FAILURE-METRIC

  • Metric value: 1

Leave the other settings as default.

Create an alarm based on the metric filter in Part 1 above that meets the following criteria:

  • In the Metric section, leave the default values

  • Under Conditions, for Threshold, choose Static

  • For Define the alarm condition, choose Greater/Equal

  • For Define the threshold value, enter 1

  • Ensure you remove the Alarm Trigger state

  • Set a name of CIS-CONSOLE-AUTH-FAILURE-ALARM

Leave the other settings as default.

Now create an alarm based on CIS Benchmark 3.8 – Ensure a log metric filter and alarm exist for S3 bucket policy changes

An IAM user will shortly log in to the AWS console a number of times with MFA disabled. Using the Log Events page in the Metrolio-LG log group and the MFA failure filter pattern, what is name of the IAM user?

A number of IAM user login failures will shortly occur for the same IAM user. Using the Log Events page in the Metrolio-LG log group and the filter pattern for login failure, what is name of the IAM user that these failures relate to?

An S3 bucket policy will shortly change and trigger the alarm. Using the Log Events page in the Metrolio-LG log group and the Bucket Policy Changed filter pattern, what is the name of the IAM user who changed the S3 bucket policy on the bucket with the prefix metrolio-sensitive-data-*