Skip to main content

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the SNS topic global publishing misconfiguration in AWS:
  1. Open the AWS Management Console and navigate to the SNS service.
  2. Click on the SNS topic that needs to be remediated.
  3. In the topic details page, click on the “Access Policy” tab.
  4. Click on the “Edit” button to modify the access policy.
  5. In the access policy editor, remove the following statement:
  1. Click on the “Save Changes” button to save the updated access policy.
  2. Verify that the access policy no longer allows global publishing by checking that the Principal is no longer set to "*".
  3. Repeat these steps for any other SNS topics that need to be remediated.
That’s it! By following these steps, you have successfully remediated the SNS topic global publishing misconfiguration in AWS.

To remediate the misconfiguration of SNS Topics allowing global publishing in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your system.
  2. Run the following command to list all the SNS topics in your AWS account:
  3. Identify the ARN of the SNS topic that needs to be remediated.
  4. Run the following command to update the SNS topic policy to disallow global publishing:
    Replace <topic-arn> with the ARN of the SNS topic identified in step 3 and <aws-account-id> with your AWS account ID.
  5. Verify that the SNS topic policy has been updated successfully by running the following command:
    This command should return the updated policy that disallows global publishing.
  6. Repeat steps 3-5 for all the SNS topics in your AWS account that allow global publishing.
By following these steps, you can remediate the misconfiguration of SNS topics allowing global publishing in AWS using AWS CLI.
To remediate the misconfiguration in AWS where SNS Topics should not allow global publishing, you can follow the below steps using Python:
  1. Create an AWS SNS client using the Boto3 library in Python.
  1. Get the list of all SNS topics using the list_topics() method.
  1. For each topic, check if it has the Policy attribute set. If it does, retrieve the policy using the get_topic_attributes() method.
  1. If the policy exists, parse it using the json module and check if it allows global publishing. If it does, update the policy to disallow global publishing using the set_topic_attributes() method.
  1. Once all the policies have been updated, the misconfiguration has been remediated.
Note: Make sure to have the appropriate AWS credentials and permissions set up for the Python script to access and modify SNS topics.
This replaces the entire existing topic policy with one that no longer has any "Principal": "*" or "AWS": "*" statements while still allowing explicitly listed principals to publish. Updating aws_sns_topic_policy does not replace the SNS topic itself, only the policy document will be updated in place.Verification: terraform plan should show an update to aws_sns_topic_policy.this (old policy JSON replaced with the new policy) and no other changes.