Identity Federation for Applications
Additional Resources
Students can read more on identity federation in the AWS Documentation.
Least Privilege Access
When creating IAM policies that provide permissions to users and roles, we want to follow the common security practice of granting least privilege. Least Privilege means we grant only the permissions required to perform the necessary tasks.
When creating IAM policies that provide permissions to users and roles, we want to follow the common security practice of granting least privilege. Remember, least privilege grants only the permissions required to perform necessary tasks.
It is a very common practice to allow more permissions than necessary. Usually this is for reasons such as convenience or not knowing what permissions are required. Some of the noteworthy recent cloud data breaches were partly related to users or roles which were compromised. These users and rules had expansive enough permissions to ultimately gain access to sensitive data.
A few of the noteworthy breaches were:
- Capital One breach from 2019: An intruder was able to exploit vulnerabilities on an EC2 instance to obtain API keys, and use those keys to perform other malicious activity, including exfiltrating millions of customer records.
- Imperva breach from 2018: Hackers were able to retrieve a set of AWS API from compromised cloud instances. The keys were used to access other data.
- OneLogin 2017: AWS API keys were compromised and used to access customer data.
For that reason it is critical to fine-tune IAM policies to restrict and limit, at minimum:
- What Can be Done (Actions)
- To What (Resources)
- By Who (Principals, Trust Policies)
Build A Least Privilege Policy
Let’s take a look at a simple example of taking an IAM policy and making it least privilege.
Say you have a microservice that is designed to read and write data to a recipes table in DynamoDB.
Our environment also contains other tables to store user profile information that is accessed by other microservices that are deployed.
A simple IAM policy allowing our recipe microservice to use DynamoDB might look like this:
{
"Sid": "DDBTableAccess",
"Effect": "Allow",
"Action": [
"dynamodb:*"
],
"Resource": "*"
}
The problem here is that the policy will allow the application full access to perform all operations on DynamoDB. This could include access data in other tables such as the user profile table or even deleting tables!
In the event that the role was compromised, the threat posed to our environment would be very high.
A better solution would be to fine tune the access policy so that the application only gets permission to perform the actions it needs.
In the below example, we have an IAM policy that allows specific actions and limits those actions to a specific resource - in this case, the recipes table.
{
"Sid": "DDBTableAccessLeastPrivilege",
"Effect": "Allow",
"Action": [
"dynamodb:BatchGet*",
"dynamodb:DescribeStream",
"dynamodb:DescribeTable",
"dynamodb:Get*",
"dynamodb:Query",
"dynamodb:Scan",
"dynamodb:BatchWrite*",
"dynamodb:Delete*",
"dynamodb:Update*",
"dynamodb:PutItem"
],
"Resource": "arn:aws:dynamodb:*:*:table/recipes"
}
Premisson bundary can also be used to restrict the premission granted to the role in case some other policy grant full access to the same user.