AWS - Cognito Enum

Support HackTricks

Cognito

Amazon Cognitoは、ウェブおよびモバイルアプリケーションにおける認証、認可、およびユーザー管理に利用されます。ユーザーはユーザー名とパスワードを直接使用するか、Facebook、Amazon、Google、Appleなどのサードパーティを通じて間接的にサインインする柔軟性を持っています。

Amazon Cognitoの中心には、2つの主要なコンポーネントがあります:

  1. User Pools: これらはアプリユーザーのためのディレクトリであり、サインアップおよびサインイン機能を提供します。

  2. Identity Pools: これらのプールは、異なるAWSサービスへのユーザーのアクセスを認可するために重要です。サインインやサインアッププロセスには直接関与しませんが、認証後のリソースアクセスには重要です。

User pools

Cognito User Poolについて学ぶには、以下をチェックしてください:

Cognito User Pools

Identity pools

Cognito Identity Poolについて学ぶには、以下をチェックしてください:

Cognito Identity Pools

Enumeration

# List Identity Pools
aws cognito-identity list-identity-pools --max-results 60
aws cognito-identity describe-identity-pool --identity-pool-id "eu-west-2:38b294756-2578-8246-9074-5367fc9f5367"
aws cognito-identity list-identities --identity-pool-id <ident-pool-id> --max-results 60
aws cognito-identity get-identity-pool-roles --identity-pool-id <ident-pool-id>

# Identities Datasets
## Get dataset of identity id (inside identity pool)
aws cognito-sync list-datasets --identity-pool-id <ident-pool-id> --identity-id <ident-id>
## Get info of the dataset
aws cognito-sync describe-dataset --identity-pool-id <value> --identity-id <value> --dataset-name <value>
## Get dataset records
aws cognito-sync list-records --identity-pool-id <value> --identity-id <value> --dataset-name <value>

# User Pools
## Get pools
aws cognito-idp list-user-pools --max-results 60

## Get users
aws cognito-idp list-users --user-pool-id <user-pool-id>

## Get groups
aws cognito-idp list-groups --user-pool-id <user-pool-id>

## Get users in a group
aws cognito-idp list-users-in-group --user-pool-id <user-pool-id> --group-name <group-name>

## List App IDs of a user pool
aws cognito-idp list-user-pool-clients --user-pool-id <user-pool-id>

## List configured identity providers for a user pool
aws cognito-idp list-identity-providers --user-pool-id <user-poo

## List user import jobs
aws cognito-idp list-user-import-jobs --user-pool-id <user-pool-id> --max-results 60

## Get MFA config of a user pool
aws cognito-idp get-user-pool-mfa-config --user-pool-id <user-pool-id>

## Get risk configuration
aws cognito-idp describe-risk-configuration --user-pool-id <user-pool-id>

Identity Pools - Unauthenticated Enumeration

Identity Pool IDを知っているだけで認証されていないユーザーに関連付けられたロールの資格情報を取得できるかもしれません(もしあれば)。方法はこちら

User Pools - Unauthenticated Enumeration

Cognito内の有効なユーザー名を知らなくても、有効なユーザー名を列挙したり、パスワードをBFしたり、新しいユーザーを登録したりすることができるかもしれません。App client IDを知っているだけで(通常はソースコードに記載されています)。方法はこちら

Privesc

AWS - Cognito Privesc

Unauthenticated Access

AWS - Cognito Unauthenticated Enum

Persistence

AWS - Cognito Persistence
HackTricksをサポートする

Last updated