In Part 1 of this post, we discuss common problems in AWS Cognito security, as seen in client environments, which would benefit from automated scanning and exploitation. In Part 2, we walk through our solution: two new modules for Pacu, our open-source AWS exploitation framework. Feel free to skip to Part 2 now if you’re already familiar with Cognito.
AWS Cognito manages user authentication and authorization for client applications, usually mobile or web. The standard user flow is below.
The “client,” “user pool” and “identity pool” have their own associated “ID” that can be used for direct API calls. These resources work as follows:
Client
The “client” is the app (usually web or mobile) the user registers for and logs in to. It is similar to an OAuth 2.0 client app.
User Pool
The “user pool” is a user directory that manages user registration and login for the “client.” It is similar to an OpenID Connect identity provider (OIDC IdP).
Identity Pool
The “identity pool” gives temporary AWS credentials to end users. These IAM credentials allow direct interaction with the AWS account, which provides additional attack surface.
In recent pentesting engagements, we’ve seen many vulnerabilities in client AWS environments due to their handling of Cognito. Below are some of those common Cognito findings.
During penetration tests, we often see the need for tools to quickly test Cognito for security vulnerabilities. For this reason, we have created two new modules for our open-source AWS exploitation framework, Pacu.
Cognito__enum – Cognito enumeration module using IAM creds with Cognito Read permissions
Cognito__attack – Cognito attack module using at least one Cognito resource ID (such as an “identity pool” ID)
To see these demonstrated, check out part 2 of the post.