Skip to main content

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate this misconfiguration in AWS using the AWS console:
  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/.
  2. In the navigation pane, choose Topics.
  3. Select the SNS topic that you want to remediate.
  4. Choose the Access policy tab.
  5. In the Access policy editor, locate the statement that grants global subscribe permissions. It should look like this:
  1. Remove the "Principal": "*" line from the statement to restrict subscriptions to only AWS accounts that you explicitly specify.
  2. Choose Save changes to update the access policy for the SNS topic.
That’s it! You have successfully remediated the misconfiguration by removing global subscribe permissions from the SNS topic.

To remediate the misconfiguration “SNS Topics Should Not Allow Global Subscribe” in AWS using AWS CLI, you can follow these steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to list all the SNS topics in your AWS account:
  3. Identify the SNS topic(s) that have global subscription enabled.
  4. Run the following command to update the policy of the identified SNS topic(s) to disallow global subscription:
    Replace <topic-arn> with the ARN of the identified SNS topic.
  5. Verify that the policy has been updated successfully by running the following command:
    Replace <topic-arn> with the ARN of the identified SNS topic.
  6. Repeat steps 3-5 for all the SNS topics that have global subscription enabled.
By following these steps, you can remediate the misconfiguration “SNS Topics Should Not Allow Global Subscribe” in AWS using AWS CLI.
To remediate the misconfiguration “SNS Topics Should Not Allow Global Subscribe” in AWS using Python, you can follow the below steps:
  1. First, you need to get a list of all the SNS topics in your AWS account using the boto3 library in Python. You can use the following code snippet to achieve this:
  1. Once you have the list of all SNS topics, you can iterate through each topic and check if it allows global subscriptions. To do this, you need to get the policy of the SNS topic using the get_topic_attributes method and then check if the policy allows global subscriptions. You can use the following code snippet to achieve this:
  1. Finally, you need to test the remediation by checking if the SNS topics still allow global subscriptions. You can use the same code snippet in step 2 to check the policy of each SNS topic and make sure that the “AllowEveryoneToSubscribe” parameter is set to “false”.
By following these steps, you can remediate the misconfiguration “SNS Topics Should Not Allow Global Subscribe” in AWS using Python.
Modifying aws_sns_topic_policy replaces the entire existing SNS topic policy document (logically destructive), but it does not force replacement of the SNS topic itself.For verification, terraform plan should show an update to aws_sns_topic_policy.this.policy that removes any statement where Principal is "*" (or "AWS": "*") and Action includes "sns:Subscribe", with no resource replacements.