You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-user-pools.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -234,7 +234,7 @@ To **login** you **need** to know:
234
234
235
235
{% hint style="info" %}
236
236
In order to be **able to login with this method** that application must allow to login with `ALLOW_ADMIN_USER_PASSWORD_AUTH`.\
237
-
Moreover, to perform this action you need credentials with the permissions\*\*`cognito-idp:AdminInitiateAuth`\*\*and **`cognito-idp:AdminRespondToAuthChallenge`**
237
+
Moreover, to perform this action you need credentials with the permissions**`cognito-idp:AdminInitiateAuth`**and **`cognito-idp:AdminRespondToAuthChallenge`**
Identity Pools can grant **IAM roles to unauthenticated users** that just **know the Identity Pool ID** (which is fairly common to **find**), and attacker with this info could try to **access that IAM rol**e and exploit it.\
31
+
Moreoever, IAM roles could also be assigned to **authenticated users** that access the Identity Pool. If an attacker can **register a user** or already has **access to the identity provider** used in the identity pool you could access to the **IAM role being given to authenticated** users and abuse its privileges.
32
+
33
+
[**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-identity-pools.md).
34
+
35
+
### User Pool ID
36
+
37
+
By default Cognito allows to **register new user**. Being able to register a user might give you **access** to the **underlaying application** or to the **authenticated IAM access role of an Identity Pool** that is accepting as identity provider the Cognito User Pool. [**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-user-pools.md#registration).
38
+
28
39
### Pacu modules for pentesting and enumeration
29
40
30
41
[Pacu](https://github.com/RhinoSecurityLabs/pacu), the AWS exploitation framework, now includes the "cognito\_\_enum" and "cognito\_\_attack" modules that automate enumeration of all Cognito assets in an account and flag weak configurations, user attributes used for access control, etc., and also automate user creation (including MFA support) and privilege escalation based on modifiable custom attributes, usable identity pool credentials, assumable roles in id tokens, etc.
31
42
32
43
For a description of the modules' functions see part 2 of the [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2). For installation instructions see the main [Pacu](https://github.com/RhinoSecurityLabs/pacu) page.
33
44
34
-
### Usage
45
+
####Usage
35
46
36
-
Sample cognito\_\_attack usage to attempt user creation and all privesc vectors against a given identity pool and user pool client:
47
+
Sample `cognito__attack` usage to attempt user creation and all privesc vectors against a given identity pool and user pool client:
37
48
38
49
```bash
39
50
Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gmail.com --identity_pools
@@ -47,17 +58,6 @@ Sample cognito\_\_enum usage to gather all user pools, user pool clients, identi
47
58
Pacu (new:test) > run cognito__enum
48
59
```
49
60
50
-
### Identity Pool ID
51
-
52
-
Identity Pools can grant **IAM roles to unauthenticated users** that just **know the Identity Pool ID** (which is fairly common to **find**), and attacker with this info could try to **access that IAM rol**e and exploit it.\
53
-
Moreoever, IAM roles could also be assigned to **authenticated users** that access the Identity Pool. If an attacker can **register a user** or already has **access to the identity provider** used in the identity pool you could access to the **IAM role being given to authenticated** users and abuse its privileges.
54
-
55
-
[**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-identity-pools.md).
56
-
57
-
### User Pool ID
58
-
59
-
By default Cognito allows to **register new user**. Being able to register a user might give you **access** to the **underlaying application** or to the **authenticated IAM access role of an Identity Pool** that is accepting as identity provider the Cognito User Pool. [**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-user-pools.md#registration).
60
-
61
61
{% hint style="success" %}
62
62
Learn & practice AWS Hacking:<imgsrc="../../../.gitbook/assets/image (1).png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="../../../.gitbook/assets/image (1).png"alt=""data-size="line">\
63
63
Learn & practice GCP Hacking: <imgsrc="../../../.gitbook/assets/image (2).png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="../../../.gitbook/assets/image (2).png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
There are 2 main ways to access GCP as a service account:
199
+
200
+
***Via OAuth tokens**: These are tokens that you will get from places like metadata endpoints or stealing http requests and they are limited by the **access scopes**.
201
+
***Keys**: These are public and private key pairs that will allow you to sign requests as the service account and even generate OAuth tokens to perform actions as the service account. These keys are dangerous because they are more complicated to limit and control, that's why GCP recommend to not generate them.
202
+
* Note that every-time a SA is created, **GCP generates a key for the service account** that the user cannot access (and won't be listed in the web application). According to [**this thread**](https://www.reddit.com/r/googlecloud/comments/f0ospy/service\_account\_keys\_observations/) this key is **used internally by GCP** to give metadata endpoints access to generate the accesible OAuth tokens.
203
+
196
204
### **Access scopes**
197
205
198
206
Access scope are **attached to generated OAuth tokens** to access the GCP API endpoints. They **restrict the permissions** of the OAuth token.\
0 commit comments