Is it possible to prevent the leakage of the original data of the database even if it is hacked?

Viewed 146

We want to build a web application and deploy it on AWS.

  • EC2: Laravel
  • RDS: MySQL

I will use Laravel's encrypter to encrypt the data of database. Even RDS got hacked, the data have encrypted. Hacker can't know the contents. But if EC2 got hacked, hacker can get the database credential and the encryption key on the source code and decrypt the encrypted data from database.

My Boss (maybe client) think that it is not enough because of the database contains sensitive informations of users. He want to prevent the leakage of the original data of the database even if the web server (EC2) got hacked. Is it possible?

If not, I think we should focus on make the web server more difficult to be hacked:

  1. Set Security Group to limit ssh access by IP address.
  2. Or any other measures?
1 Answers

Here are a few safety measures you can do to reduce your blast radius.

Move your credentials for the RDS database so they are not directly on the instance, use a credential store such as:

Rotate your database credentials frequently, and use IAM roles for your EC2 applications and not IAM users.

Keep your EC2 and RDS within private subnets, add an ELB in front of the EC2 so that public traffic can only access this device only.

Configure security groups to scoped to only what they need, limit inbound access to your AWS VPC to a VPN or direct connect connection.

Restrict access to who can do what in your AWS account, if a user does not need to perform certain actions for their role then just remove those permissions. This will prevent an accidental action on a service the user should not be using.

AWS have a large number of actions you can do in the security pillar too, so make sure to take a read of that.

Related