![[小ネタ] AWS Security Agent で Cognito 認証を突破する #AWSreInvent](https://images.ctfassets.net/ct0aopd36mqt/3cSNU2biOZjSIpzhzUgtBJ/eeb74bd4d0c8f041ce027f3258cd249f/reinvent2025_devio_try_w1200h630__1_.png?w=3840&fm=webp)
[小ネタ] AWS Security Agent で Cognito 認証を突破する #AWSreInvent
こんにちは!クラウド事業本部コンサルティング部のたかくに(@takakuni_)です。
昨年、re:Invent 2025 でペネトレーションテストや設計書/コードのセキュリティレビューを自動化する AWS Security Agent が登場しました。
かなり反響があった Frontier Agent だったと思います。実際に使ってみたい方が多いのではないでしょうか。(パブリックプレビュー中で、なんと無料で利用可能です。ぜひ、FB していきましょう...!)
そんな Security Agent ですが、 Cognito 認証がかかっている Web サイトで検証したところ、次のようなエラーが発生しました。(冒頭の「Aha!」が可愛いですね。)
Aha! The DNS resolution for cognito-idp.ap-northeast-1.amazonaws.com is failing. This explains the "network error" in the browser. This appears to be a network connectivity issue from the environment we're running in, not an issue with the provided credentials.
Since we cannot actually complete the authentication due to the network connectivity issue (DNS resolution failure for AWS Cognito), but we have verified that:
The credentials were correctly entered into the form
The application attempted to authenticate using AWS Cognito SRP authentication
The network error is due to DNS resolution failure, not invalid credentials
Let me document what we found and explain the situation. Based on the instructions, I should stop if the credentials don't work, but in this case, the credentials themselves weren't rejected - there's a network infrastructure issue preventing us from reaching AWS Cognito.
The provided credentials appear to be valid format-wise:
username: [REDACTED]
password: [REDACTED]
Cognito Client ID: 4lq583o6eckf68bm7an5q3115c
Cognito Region: ap-northeast-1
The authentication flow uses AWS Cognito's SRP (Secure Remote Password) authentication protocol, which is a secure authentication method that doesn't transmit the password directly.
Unfortunately, due to the network connectivity issue (inability to resolve cognito-idp.ap-northeast-1.amazonaws.com), I cannot complete the authentication process and retrieve the session credentials. The error is not related to invalid credentials but rather to the environment's network configuration blocking access to AWS Cognito services.

エラーメッセージを要約すると、「ログインできない原因はユーザーの入力ミスではなく、実行環境のネットワーク設定(DNS)にある」ようです。Security Agent の実行環境の DNS ってどうやって解決するのでしょうか。

Add additional allowed domains を設定しましょう
Additional allowed URLs に、認証用のエンドポイントを追加しましょう。
Security Agent では、ターゲット URL と Additional allowed URLs 以外の URL へのアクセスは、ブロックされています。
What controls are present to block unauthorized testing against an endpoint?
Endpoints that are specified as target URLs for pentesting will require DNS validation or HTTP validation as a measure of ownership. AWS Security Agent will ask the customer to add a TXT record to the endpoint’s DNS or expose an HTTP Route returning validation string as proof of ownership. Only after demonstrating proof of ownership will the user be able to proceed with a pentest. Requests to URLs outside of the target and allowed URLs will be blocked by the network.
今回、ログインに必要な Cognito のエンドポイントを Additional allowed URLs に設定しなかったため、ネットワークエラーが発生していたようです。
If your application needs to access URLs that are outside of your target domain, including for login purposes, then please add all the URLs to the Additional allowed URLs field. NOTE: Additional allowed URLs is outside the scope of pentesting, and is accessed for tasks such as login.
Additional allowed domains might include authentication providers, external APIs, or third-party services required for your application to function. These domains will be accessible during testing but will not be actively tested for vulnerabilities.
Add allowed domains for third-party services your application integrates with (such as Okta, Auth0, Stripe, or other external authentication/payment providers) to ensure AWS Security Agent can interact with them during testing without attempting to penetration test those services.
Additional allowed URLs は、ペネトレーションテストの作成画面から指定できます。

指定した結果、再度ログインを試みたところ、うまくログインできていますね。

ちなみに https://cognito-idp.*.amazonaws.com のように、ワイルドカードで指定してみたのですが、こちらはネットワークエラーとなり、正規表現は現時点で使えないようでした。

まとめ
以上、「AWS Security Agent で Cognito 認証を突破する」でした。
予期せず意図しないエンドポイントへの攻撃を防ぐ観点で、ネットワークレベルで遮断されているのは、セキュリティ面で非常に良さそうです。ユーザー側で指定するのではなく、スキャン後に選択できるような形式だと、リストアップの手間が少なくて良さそうに思えました。今後に期待です。
クラウド事業本部コンサルティング部のたかくに(@takakuni_)でした!








