Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “SNS Topics Should Not Have Cross Account Access” in AWS, you can follow the below steps:
  1. Open the AWS SNS console at https://console.aws.amazon.com/sns/.
  2. Select the SNS topic that you want to remediate.
  3. Click on the “Access Policy” button under the “Permissions” section on the left side of the console.
  4. Review the access policy to ensure that there is no cross-account access granted to the SNS topic.
  5. If there is cross-account access granted, click on the “Edit” button to modify the access policy.
  6. Remove any statements that grant cross-account access to the SNS topic.
  7. Click on the “Save Changes” button to save the modified access policy.
After following these steps, the SNS topic will no longer have cross-account access and the misconfiguration will be remediated.

To remediate the misconfiguration “SNS Topics Should Not Have Cross Account Access” in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine.
  2. Run the following command to list all the SNS topics in your AWS account:
  1. Identify the SNS topic that has cross-account access.
  2. Run the following command to remove cross-account access from the SNS topic:
Replace <topic-arn> with the ARN of the SNS topic that has cross-account access. Replace <permission-label> with the label of the permission that you want to remove.
  1. Run the following command to verify that the cross-account access has been removed:
Replace <topic-arn> with the ARN of the SNS topic that you want to verify.
  1. If the output of the above command shows that the policy for the SNS topic still has cross-account access, then you need to update the policy for the SNS topic.
  2. Run the following command to update the policy for the SNS topic:
Replace <topic-arn> with the ARN of the SNS topic that you want to update.
  1. Run the following command to verify that the policy for the SNS topic has been updated:
Replace <topic-arn> with the ARN of the SNS topic that you want to verify.
  1. Repeat steps 3 to 8 for all the SNS topics in your AWS account that have cross-account access.
By following these steps, you can remediate the misconfiguration “SNS Topics Should Not Have Cross Account Access” in AWS using AWS CLI.
To remediate the misconfiguration of SNS Topics having cross-account access in AWS using python, you can follow the below steps:
  1. Identify the SNS Topics that have cross-account access.
  2. Revoke the cross-account access for those SNS Topics.
  3. Verify that the cross-account access has been revoked successfully.
Here is the python code to remediate the misconfiguration:
Note: This code will revoke cross-account access for all SNS Topics that have a policy allowing it. It is important to review the policy before revoking access to ensure that it is not needed for any legitimate use case.
This aws_sns_topic_policy resource completely replaces any existing SNS topic policy; Terraform will remove prior statements (including cross-account ones) and keep only the trusted principals you define.Verification: terraform plan should show an update (or create/replace) for aws_sns_topic_policy.example with the old policy removed and the new, restricted policy JSON applied, and no other resources changed.