forked from projectdiscovery/nuclei-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SNS Topic Subscription access publicly Template
- Loading branch information
1 parent
262b446
commit 1847bc8
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
id: sns-topic-subscribe-public-access | ||
|
||
info: | ||
name: Public Subscription Access of SNS Topics via Policy | ||
author: Ritesh_Gohil(#L4stPL4Y3R) | ||
severity: High | ||
description: | | ||
This template checks if Amazon SNS topics are configured to allow public subscription access via topic policies. | ||
reference: | ||
- https://docs.aws.amazon.com/sns/latest/api/API_GetTopicAttributes.html | ||
tags: cloud, devops, aws, amazon, sns, aws-cloud-config | ||
|
||
flow: | | ||
code(1) | ||
for (let topicArn of iterate(template.topics)) { | ||
set("topicArn", topicArn) | ||
code(2) | ||
} | ||
self-contained: true | ||
code: | ||
- engine: | ||
- sh | ||
- bash | ||
source: | | ||
aws sns list-topics --query 'Topics[*].TopicArn' | ||
extractors: | ||
- type: json | ||
internal: true | ||
name: topics | ||
json: | ||
- '.[]' | ||
|
||
- engine: | ||
- sh | ||
- bash | ||
source: | | ||
aws sns get-topic-attributes --topic-arn $topicArn --query Attributes.Policy --output text | ||
matchers-condition: and | ||
matchers: | ||
- type: word | ||
part: body | ||
words: | ||
- '"Effect":"Allow"' | ||
|
||
- type: word | ||
part: body | ||
words: | ||
- '"Principal":{"AWS":"*"}' | ||
|
||
- type: word | ||
part: body | ||
words: | ||
- '"Action":"SNS:Subscribe"' | ||
|
||
- type: regex | ||
part: body | ||
negative: true | ||
regex: | ||
- '"Condition"' | ||
|
||
extractors: | ||
- type: dsl | ||
dsl: | ||
- '"The SNS topic " + topicArn + " allows public subscription via Policy"' | ||
# digest: 4a0a0047304502205fb7f0c9b0626cc145370d50015cadeeda16e73469baaab959fc8c76c120a57b02210096912a33733194302dcee8747a398dd06c425ceac11d7348bd8c08ca4b0184de:f37bf26b30a8e29c9db6a85589544950 |