More Info:
Your SNS topics should have subscribers. Corrective action must be taken about topics that have no subscribers.Risk Level
LowAddress
Operational MaturityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- 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
- Remediation
Remediation
Using Console
Using Console
Sure, here are the step by step instructions to remediate the misconfiguration of SNS topics not having subscriptions in AWS:
- Open the AWS Management Console and navigate to the SNS service.
- Select the SNS topic which is not having any subscription.
- Click on the “Create Subscription” button.
- Choose the protocol for the subscription. For example, you can choose email, SMS, or HTTP/HTTPS.
- Enter the endpoint details based on the protocol you have selected. For example, if you have chosen email, then enter the email address of the recipient.
- Click on the “Create Subscription” button to create the subscription.
- Once the subscription is created, you will receive a confirmation message on the endpoint you have specified.
- Repeat the above steps for all the SNS topics which do not have any subscription.
Using CLI
Using CLI
To remediate the misconfiguration “SNS Topics Should Have Subscription” for AWS using AWS CLI, follow these steps:
- Open the AWS CLI on your local machine.
-
Run the following command to list all the SNS topics in your AWS account:
- Identify the SNS topic that does not have any subscription.
-
Run the following command to list all the subscriptions for that SNS topic:
Replace
<topic_arn>with the ARN of the SNS topic that you identified in step 3. - If the output of the above command is empty, it means that the SNS topic does not have any subscription.
-
Run the following command to create a subscription for the SNS topic:
Replace
<topic_arn>with the ARN of the SNS topic that you identified in step 3. Replace<protocol>with the protocol that you want to use for the subscription (e.g. email, SMS, etc.). Replace<endpoint>with the endpoint that you want to use for the subscription (e.g. email address, phone number, etc.). -
Verify that the subscription was created successfully by running the following command:
Replace
<topic_arn>with the ARN of the SNS topic that you identified in step 3. - Repeat steps 3 to 7 for any other SNS topics that do not have any subscription.
Using Python
Using Python
To remediate the misconfiguration where SNS topics should have a subscription, you can use the following steps in Python:
- Import the necessary libraries:
- Create a boto3 client for SNS:
- Use the
list_topics()method to get a list of all topics:
- Loop through the list of topics and check if each topic has at least one subscription:
- Run the script to create subscriptions for all SNS topics that do not have any subscriptions.
Using Terraform
Using Terraform
aws_sns_topic (and any aws_sns_topic_subscription) resources from Terraform; this is a destructive change that will permanently delete the topic and cannot be undone—ensure nothing publishes to it before doing so.For protocols that require confirmation (e.g., email, http, https), the subscription will be created in a pending state and must be confirmed by the endpoint owner outside Terraform.Verification: terraform plan should show either creation of aws_sns_topic_subscription.THIS_TOPIC_SUBSCRIPTION (adding a subscriber) or - (destroy) for the aws_sns_topic (and its subscriptions) if you chose deletion.
