# AWS - Cognito Unauthenticated Enum {{#include ../../../../banners/hacktricks-training.md}} ## Unauthenticated Cognito Cognito एक AWS सेवा है जो डेवलपर्स को सक्षम बनाती है कि वे अपने ऐप उपयोगकर्ताओं को AWS सेवाओं तक पहुँच प्रदान कर सकें। डेवलपर्स अपने ऐप में authenticated users को **IAM roles प्रदान** करते हैं (संभावना है कि लोग बस sign up कर सकें) और वे unauthenticated users को भी एक **IAM role** दे सकते हैं। For basic info about Cognito check: {{#ref}} ../../aws-services/aws-cognito-enum/ {{#endref}} ### Identity Pool ID Identity Pools उन users को भी **IAM roles प्रदान** कर सकते हैं जो केवल **Identity Pool ID** को जानते हैं (जो आमतौर पर मिल जाना आसान होता है), और इस जानकारी वाले एक attacker उस IAM role तक पहुँचने और उसे exploit करने की कोशिश कर सकता है। इसके अलावा, IAM roles उन **authenticated users** को भी असाइन किए जा सकते हैं जो Identity Pool तक पहुँचते हैं। यदि कोई attacker **एक user रजिस्टर कर सकता है** या पहले से ही उस **identity provider** तक access रखता है जो identity pool में उपयोग किया जाता है, तो वह उन **authenticated users को दिए जा रहे IAM role** तक पहुँच बना कर उसके privileges का दुरुपयोग कर सकता है। [**इसे कैसे करना है, यहाँ देखें**](../../aws-services/aws-cognito-enum/cognito-identity-pools.md). ### User Pool ID डिफ़ॉल्ट रूप से Cognito नए users को **register** करने की अनुमति देता है। किसी user को register करने में सक्षम होना आपको underlying application या उस **authenticated IAM access role of an Identity Pool** तक पहुँच दे सकता है जो Cognito User Pool को identity provider के रूप में स्वीकार करता है। [**इसे कैसे करना है, यहाँ देखें**](../../aws-services/aws-cognito-enum/cognito-user-pools.md#registration). ### Pacu modules for pentesting and enumeration [Pacu](https://github.com/RhinoSecurityLabs/pacu), the AWS exploitation framework, अब "cognito__enum" और "cognito__attack" मॉड्यूल्स शामिल करता है जो किसी account में सभी Cognito assets की enumeration को automate करते हैं और कमजोर कॉन्फ़िगरेशन, access control के लिए उपयोग किए जाने वाले user attributes आदि को flag करते हैं, साथ ही user creation (MFA support सहित) और modifiable custom attributes, usable identity pool credentials, id tokens में assumable roles आदि के आधार पर privilege escalation को भी automate करते हैं। मॉड्यूल्स के फ़ंक्शंस का विवरण देखने के लिए [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2) के भाग 2 को देखें। इंस्टॉलेशन निर्देशों के लिए मुख्य [Pacu](https://github.com/RhinoSecurityLabs/pacu) पेज देखें। #### Usage Sample `cognito__attack` usage to attempt user creation and all privesc vectors against a given identity pool and user pool client: ```bash Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gmail.com --identity_pools us-east-2:a06XXXXX-c9XX-4aXX-9a33-9ceXXXXXXXXX --user_pool_clients 59f6tuhfXXXXXXXXXXXXXXXXXX@us-east-2_0aXXXXXXX ``` cognito\_\_enum का नमूना उपयोग वर्तमान AWS खाते में दिखाई देने वाले सभी user pools, user pool clients, identity pools, users, आदि इकट्ठा करने के लिए: ```bash Pacu (new:test) > run cognito__enum ``` {{#include ../../../../banners/hacktricks-training.md}}