Skip to main content

More Info:

Checks inactivity of any user on a service. Those privileges should be removed for better security posture.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AWS
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

How to Prevent

Using Console

To prevent User Account Service Inactivity in IAM using the AWS Management Console, follow these steps:
  1. Enable IAM Access Analyzer:
    • Navigate to the IAM dashboard in the AWS Management Console.
    • In the left-hand navigation pane, select “Access Analyzer.”
    • Click on “Create analyzer” and follow the prompts to enable IAM Access Analyzer. This tool helps you identify inactive IAM users and roles.
  2. Set Up Password Policy:
    • In the IAM dashboard, select “Account settings” from the left-hand navigation pane.
    • Under “Password policy,” configure settings such as password expiration and password reuse prevention. This ensures that users must periodically update their passwords, reducing the risk of inactive accounts.
  3. Enable CloudTrail Logging:
    • Go to the CloudTrail dashboard in the AWS Management Console.
    • Click on “Create trail” and follow the prompts to enable logging for all regions.
    • Ensure that CloudTrail is configured to log IAM actions. This helps you monitor user activity and identify inactive accounts.
  4. Set Up Automated Notifications:
    • Navigate to the CloudWatch dashboard in the AWS Management Console.
    • Create a new rule to monitor IAM user activity.
    • Set up an alarm to trigger an SNS (Simple Notification Service) notification if a user account has been inactive for a specified period. This allows you to take proactive measures to address inactivity.
By following these steps, you can effectively monitor and manage user account activity in AWS IAM, reducing the risk of inactive accounts.
To prevent User Account Service Inactivity in IAM using AWS CLI, you can follow these steps:
  1. Create an IAM Policy to Enforce Password Rotation: Ensure that users are required to change their passwords regularly to prevent inactivity. Create a policy that enforces password rotation.
  2. Enable MFA for IAM Users: Require Multi-Factor Authentication (MFA) for all IAM users to ensure that accounts are actively used and secured.
  3. Set Up CloudWatch Alarms for Inactive Users: Create CloudWatch alarms to monitor and alert you when users have not logged in for a specified period.
  4. Automate Inactive User Deactivation: Use a Lambda function to automatically deactivate users who have been inactive for a specified period. This requires setting up a Lambda function and a CloudWatch event rule to trigger it.
These steps will help you prevent user account service inactivity by enforcing password policies, enabling MFA, monitoring user activity, and automating the deactivation of inactive users.
To prevent User Account Service Inactivity in IAM using Python scripts, you can follow these steps:

1. Set Up AWS SDK (Boto3)

First, ensure you have the AWS SDK for Python (Boto3) installed. You can install it using pip if you haven’t already:

2. Create a Script to List Inactive Users

Create a Python script to list users who have been inactive for a specified period. This script will help you identify inactive users.

3. Automate Deactivation of Inactive Users

Modify the script to deactivate users who have been inactive for the specified period. This can be done by disabling their login profile and access keys.

4. Schedule the Script to Run Periodically

Use a scheduling tool like cron (on Unix-based systems) or Task Scheduler (on Windows) to run the script periodically. This ensures that inactive users are regularly identified and deactivated.

Example Cron Job (Unix-based systems):

By following these steps, you can automate the process of identifying and deactivating inactive IAM users using Python scripts, thereby preventing user account service inactivity in AWS IAM.

Additional Reading: