Vulnerability #7: AWS Cognito Misconfiguration
Last updated
Last updated
Itβs not very uncommon that android apps nowadays use cloud services - and not very uncommon either that developers sometimes hardcode potentially sensitive API keys into the resources of the app. While browsing through strings.xml
, we found the following key:
After a bit of researching, I found out the following documentation for which are supposedly a means to provide temporary AWS credentials for unauthenticated users/guests.
If you ever find a suspicious API key in some bug bounty program or pentest, try to refer in checking if the βleakedβ key has some potential security issues.
Using the mentioned keyhacks repo, I tried to read the part regarding AWS and tried to install awscli using the following command:
To test this vulnerability, I followed used the following writeup as a reference:
First step that we need to do is to extract AWS credentials (access_key, secret_key, session_token) from the identity-pool:
An interesting permission that we have is that we can list the s3 buckets. For it to work, we need to configure our credentials (Iβm using new creds here, I may have messed something up earlier):
We see two buckets, now letβs see what they contain:
Looks like some other player has left nothing for us lmao. To summarize the poc:
Extract AWS credentials (access_key, secret_key and session_token ) from the identity pool;
Enumerate permissions/roles for the credentials that you have;
Privesc by abusing permissions.
Afterwhich, weβll use the following script () to enumerate permissions with the credentials that we have.