# AWS - SQS Persistensie

{{#include ../../../../banners/hacktricks-training.md}}

## SQS

Vir meer inligting, kyk:

{{#ref}}
../../aws-services/aws-sqs-and-sns-enum.md
{{#endref}}

### Gebruik van resource policy

In SQS moet jy met 'n IAM policy aandui **wie toegang het om te lees en te skryf**. Dit is moontlik om eksterne rekeninge, ARN van rolle, of **selfs "\*"** aan te dui.\
Die volgende policy gee almal in AWS toegang tot alles in die queue genaamd **MyTestQueue**:
```json
{
"Version": "2008-10-17",
"Id": "__default_policy_ID",
"Statement": [
{
"Sid": "__owner_statement",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": ["SQS:*"],
"Resource": "arn:aws:sqs:us-east-1:123123123123:MyTestQueue"
}
]
}
```
> [!NOTE]
> Jy kan selfs **trigger 'n Lambda in the attacker's account elke keer as 'n nuwe boodskap** in die queue geplaas word (jy sal dit weer moet herplaas). Volg hiervoor hierdie instruksies: [https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html)

### Meer SQS Persistence Techniques

{{#ref}}
aws-sqs-dlq-backdoor-persistence.md
{{#endref}}

{{#ref}}
aws-sqs-orgid-policy-backdoor.md
{{#endref}}

{{#include ../../../../banners/hacktricks-training.md}}
