Skip to main content

Triage and Remediation

Remediation

Using Console

Below are the exact steps to monitor “AWS Console sign-in without MFA” using CloudWatch via the AWS Management Console.

1. Make sure CloudTrail is enabled and sending logs to CloudWatch Logs

  1. In the AWS console, go to CloudTrail.
  2. In the left menu, select Trails.
  3. If you don’t have a trail:
    • Click Create trail.
    • Name it (e.g., org-trail).
    • Under Storage location, choose/create an S3 bucket.
    • Under CloudWatch Logs, check Enabled.
    • Choose/Create a Log group (e.g., /aws/cloudtrail/management).
    • Choose/Create an IAM role for CloudWatch Logs.
    • Turn on Management events (Read + Write).
    • Click Create trail.
  4. If you already have a trail:
    • Click your trail name.
    • Under CloudWatch Logs, click Edit.
    • Enable CloudWatch Logs and select/create a log group.
    • Save.
You now have CloudTrail events (including ConsoleLogin) going into a CloudWatch Logs log group.

2. Create a Metric Filter for “Console sign-in without MFA”

  1. Go to CloudWatch in the console.
  2. In the left menu, click Logs > Log groups.
  3. Click the log group used by CloudTrail (e.g., /aws/cloudtrail/management).
  4. Go to the Metric filters tab.
  5. Click Create metric filter.
  6. In Filter pattern, use:
  7. Click Next.
  8. Under Assign metric, configure:
    • Filter name: ConsoleLoginWithoutMFA
    • Metric namespace: Security/CloudTrail
    • Metric name: ConsoleLoginWithoutMFA
    • Metric value: 1
  9. Click Next, then Create metric filter.
This creates a metric that increments when there is a successful console login without MFA.

3. Create a CloudWatch Alarm on that metric

  1. Still in CloudWatch, go to Alarms > All alarms.
  2. Click Create alarm.
  3. Click Select metric.
  4. Navigate to the metric you just created:
    • Custom namespaces > Security/CloudTrail > Metrics with no dimensions > ConsoleLoginWithoutMFA.
  5. Select the metric and click Next.
  6. Set the Statistic to Sum.
  7. Define the threshold, for example:
    • Period: 5 minutes
    • Threshold type: Static
    • Whenever Sum is >= 1
  8. Click Next.
  9. Under Notification, choose or create an SNS topic:
    • E.g., Create new topic → name security-alerts → add email addresses.
    • Confirm the subscription via the email you receive.
  10. Click Next, give the alarm a name (e.g., Alert-ConsoleLogin-Without-MFA), and optionally a description.
  11. Click Create alarm.

You now have monitoring in place: any successful AWS Console login without MFA will generate a CloudTrail event, match the metric filter, increment the metric, and trigger a CloudWatch alarm that notifies you via SNS.
Below are step‑by‑step AWS CLI instructions to monitor AWS console sign‑ins without MFA using CloudWatch, based on CloudTrail logs.Assumptions:
  • You already have a CloudTrail trail delivering events to a CloudWatch Logs log group (replace names as needed).
  • Region: us-east-1 (change where appropriate).

1. Identify your CloudTrail log group

If you don’t know it, list log groups and look for the one used by CloudTrail:
Assume it is:

2. Create a CloudWatch Logs metric filter

This filter finds ConsoleLogin events where:
  • responseElements.ConsoleLogin = "Success"
  • additionalEventData.MFAUsed = "No"
Create the metric filter:
Verify it:

3. Create an SNS topic for alerts (optional but typical)

Capture the returned TopicArn, e.g.:
Subscribe an email endpoint:
Confirm the subscription from your email inbox.

4. Create a CloudWatch alarm on the metric

This example alarms if at least 1 such event occurs in a 5‑minute period:

5. Test

  1. Have a test IAM user without MFA perform a console login.
  2. Wait a few minutes for CloudTrail → CloudWatch Logs → Metric → Alarm pipeline to process.
  3. Check the alarm status and SNS email.
This fully implements “AWS Console Sign In Without MFA Should Be Monitored” using CloudWatch and AWS CLI.
To monitor AWS console sign-ins without MFA using CloudWatch + Python (boto3), you need to:
  1. Ensure CloudTrail is enabled and delivering to a CloudWatch Logs group
  2. Create a metric filter in CloudWatch Logs to detect non‑MFA console logins
  3. Create a CloudWatch alarm on that metric
Below are the steps and example Python code.

1. Prerequisites

  • AWS CloudTrail enabled (at least one trail, logging Management events)
  • Trail configured to send logs to a CloudWatch Logs log group (e.g., /aws/cloudtrail/management)
  • An IAM role/user with permissions for:
    • logs:PutMetricFilter, logs:DescribeLogGroups
    • cloudwatch:PutMetricAlarm
    • cloudtrail:DescribeTrails

2. Metric Filter Pattern for Console Sign‑In Without MFA

The relevant CloudTrail event is ConsoleLogin in signin.amazonaws.com.
Non-MFA console logins typically have "additionalEventData": {"MFAUsed":"No"} or just "MFAUsed":"No".
Use a filter pattern like:
Adjust for your environment if you also want to include failed logins.

3. Python Script (boto3) to Create Metric Filter + Alarm


4. High-Level Remediation Steps

  1. Confirm CloudTrail is sending logs to log_group_name.
  2. Run the Python script (with correct region, log group, and SNS topic).
  3. Test: perform a console login without MFA (from a test account) and confirm:
    • Metric SecurityMonitoring/ConsoleLoginsWithoutMFA increments
    • Alarm Alert-Console-Login-Without-MFA goes into ALARM state and sends a notification via SNS.
This adds new resources only; existing resources are not replaced. You still need an active CloudTrail trail in this region logging management events for the rule to match events.Verification: terraform plan should show one aws_sns_topic, one aws_cloudwatch_event_rule, one aws_cloudwatch_event_target, and one aws_sns_topic_subscription to be created.