RhinoSecurityLabs / cloudgoat

CloudGoat is Rhino Security Labs' "Vulnerable by Design" AWS deployment tool
BSD 3-Clause "New" or "Revised" License
2.88k stars 597 forks source link

Scenario/rds snapshot #239

Closed tt0kyu closed 8 months ago

tt0kyu commented 9 months ago

Add a simple new scenario to exploit RDS snapshots to steal data. This scenario incorporates a bit of the Imperva data breach incident case.

andrew-aiken commented 9 months ago

Hitting an issue with the ec2 provisioner. When connecting the the instance it seems that the apt update did not apply

aws_instance.cg-ec2-instance (remote-exec): Package awscli is not available, but is referred to by another package.
aws_instance.cg-ec2-instance (remote-exec): This may mean that the package is missing, has been obsoleted, or
aws_instance.cg-ec2-instance (remote-exec): is only available from another source

aws_instance.cg-ec2-instance (remote-exec): E: Package 'awscli' has no installation candidate
aws_instance.cg-ec2-instance (remote-exec): Reading package lists... 0%
aws_instance.cg-ec2-instance (remote-exec): Reading package lists... 100%
aws_instance.cg-ec2-instance (remote-exec): Reading package lists... Done
aws_instance.cg-ec2-instance (remote-exec): Building dependency tree... 0%
aws_instance.cg-ec2-instance (remote-exec): Building dependency tree... 0%
aws_instance.cg-ec2-instance (remote-exec): Building dependency tree... 50%
aws_instance.cg-ec2-instance (remote-exec): Building dependency tree... 50%
aws_instance.cg-ec2-instance (remote-exec): Building dependency tree
aws_instance.cg-ec2-instance (remote-exec): Reading state information... 0%
aws_instance.cg-ec2-instance (remote-exec): Reading state information... 0%
aws_instance.cg-ec2-instance (remote-exec): Reading state information... Done
aws_instance.cg-ec2-instance (remote-exec): Some packages could not be installed. This may mean that you have
aws_instance.cg-ec2-instance (remote-exec): requested an impossible situation or if you are using the unstable
aws_instance.cg-ec2-instance (remote-exec): distribution that some required packages have not yet been created
aws_instance.cg-ec2-instance (remote-exec): or been moved out of Incoming.
aws_instance.cg-ec2-instance (remote-exec): The following information may help to resolve the situation:

aws_instance.cg-ec2-instance (remote-exec): The following packages have unmet dependencies:
aws_instance.cg-ec2-instance (remote-exec):  mysql-client : Depends: mysql-client-8.0 but it is not going to be installed
aws_instance.cg-ec2-instance (remote-exec): E: Unable to correct problems, you have held broken packages.
aws_instance.cg-ec2-instance (remote-exec): /tmp/terraform_984242100.sh: 6: mysql: not found
andrew-aiken commented 9 months ago

The output command ssh -i cloudgoat ubuntu@52.202.200.52 should have the key referenced in the scenario dir like -i rds_snapshot_cgid6ah49c806v/cloudgoat

andrew-aiken commented 9 months ago

awscli install works (version 1 tho) Still getting an issue wit the mysql client. Maybe the package mysql-client-core-8.0?

aws_instance.cg-ec2-instance (remote-exec): Package default-mysql-client is not available, but is referred to by another package.
aws_instance.cg-ec2-instance (remote-exec): This may mean that the package is missing, has been obsoleted, or
aws_instance.cg-ec2-instance (remote-exec): is only available from another source

aws_instance.cg-ec2-instance (remote-exec): E: Package 'default-mysql-client' has no installation candidate
aws_instance.cg-ec2-instance (remote-exec): /tmp/terraform_724382914.sh: 7: mysql: not found
tt0kyu commented 9 months ago

Thanks for the great review.

Updated the output command to include cgid, and fixed an error that prevented mysql client from installing.

jdearmas commented 8 months ago

This pull request was manually merged at bd8a04e.

andrew-aiken commented 8 months ago

@jdearmas @tt0kyu Still getting issues with this scenario

The mysql command was still not installed on the ec2 instance and I think the script never ran (missing table).

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| innodb             |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

Additionally should the user be able to modify the existing DB? It allows skipping restoring of the snapshot