mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-03-12 21:22:57 -07:00
Translated ['', 'src/pentesting-cloud/aws-security/aws-post-exploitation
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
## STS
|
||||
|
||||
For more information:
|
||||
詳細については:
|
||||
|
||||
{{#ref}}
|
||||
../../aws-services/aws-iam-enum.md
|
||||
@@ -12,12 +12,12 @@ For more information:
|
||||
|
||||
### From IAM Creds to Console
|
||||
|
||||
If you have managed to obtain some IAM credentials you might be interested on **accessing the web console** using the following tools.\
|
||||
Note that the the user/role must have the permission **`sts:GetFederationToken`**.
|
||||
IAM credentials を取得した場合、以下のツールを使用して **web console にアクセス** することに興味があるかもしれません。\
|
||||
user/role は **`sts:GetFederationToken`** 権限を持っている必要があります。
|
||||
|
||||
#### カスタムスクリプト
|
||||
|
||||
以下のスクリプトはデフォルトのプロファイルとデフォルトの AWS ロケーション(not gov and not cn)を使用して、ウェブコンソールにログインするために使える署名付き URL を生成します:
|
||||
以下のスクリプトはデフォルトのプロファイルとデフォルトの AWS ロケーション(gov と cn ではない)を使用して、web console にログインするために使用できる署名付き URL を生成します:
|
||||
```bash
|
||||
# Get federated creds (you must indicate a policy or they won't have any perms)
|
||||
## Even if you don't have Admin access you can indicate that policy to make sure you get all your privileges
|
||||
@@ -55,7 +55,7 @@ echo -n "https://signin.aws.amazon.com/federation?Action=login&Issuer=example.co
|
||||
```
|
||||
#### aws_consoler
|
||||
|
||||
[https://github.com/NetSPI/aws_consoler](https://github.com/NetSPI/aws_consoler) を使って**Webコンソールリンクを生成できます**。
|
||||
このツールを使って、**Webコンソールのリンクを生成**できます: [https://github.com/NetSPI/aws_consoler](https://github.com/NetSPI/aws_consoler).
|
||||
```bash
|
||||
cd /tmp
|
||||
python3 -m venv env
|
||||
@@ -64,22 +64,26 @@ pip install aws-consoler
|
||||
aws_consoler [params...] #This will generate a link to login into the console
|
||||
```
|
||||
> [!WARNING]
|
||||
> IAM ユーザーが `sts:GetFederationToken` パーミッションを持っていることを確認するか、assume するための role を用意してください。
|
||||
> IAMユーザーに `sts:GetFederationToken` 権限があることを確認するか、ロールを引き受けるための権限を与えてください。
|
||||
|
||||
#### aws-vault
|
||||
|
||||
[**aws-vault**](https://github.com/99designs/aws-vault) は、開発環境で AWS 認証情報を安全に保存およびアクセスするためのツールです。
|
||||
[**aws-vault**](https://github.com/99designs/aws-vault) は開発環境で AWS の認証情報を安全に保存・アクセスするためのツールです。
|
||||
```bash
|
||||
aws-vault list
|
||||
aws-vault exec jonsmith -- aws s3 ls # Execute aws cli with jonsmith creds
|
||||
aws-vault login jonsmith # Open a browser logged as jonsmith
|
||||
```
|
||||
> [!NOTE]
|
||||
> **aws-vault** を使って **ブラウザのコンソールセッション** を取得することもできます
|
||||
> **aws-vault** を使って **ブラウザコンソールセッション** を取得することもできます
|
||||
|
||||
### **PythonからのUser-Agent制限の回避**
|
||||
### Web Console から IAM Creds へ
|
||||
|
||||
もし **User-Agent に基づいて特定の操作を実行することが制限されている** 場合(例:User-Agent に基づいて python boto3 ライブラリの使用を制限するなど)、前述の手法で **ブラウザ経由でウェブコンソールに接続する** こともできますし、あるいは直接 **boto3 の User-Agent を変更する** ことで実行することも可能です:
|
||||
The browser extension **<https://github.com/AI-redteam/clier>** is capable of intercepting from the network IAM credentials before they are protected in the memory of the browser.
|
||||
|
||||
### **Python から User-Agent 制限をバイパス**
|
||||
|
||||
If there is a **restriction to perform certain actions based on the user agent** used (like restricting the use of python boto3 library based on the user agent) it's possible to use the previous technique to **connect to the web console via a browser**, or you could directly **modify the boto3 user-agent** by doing:
|
||||
```bash
|
||||
# Shared by ex16x41
|
||||
# Create a client
|
||||
@@ -94,12 +98,12 @@ response = client.get_secret_value(SecretId="flag_secret") print(response['Secre
|
||||
```
|
||||
### **`sts:GetFederationToken`**
|
||||
|
||||
この権限があれば、実行しているユーザーの権限の範囲内で、フェデレーテッドアイデンティティを作成できます。
|
||||
この権限があれば、これを実行しているユーザーの持つ権限に制限されたフェデレーテッドアイデンティティを作成できます。
|
||||
```bash
|
||||
aws sts get-federation-token --name <username>
|
||||
```
|
||||
sts:GetFederationToken によって返されるトークンは呼び出し元ユーザーのフェデレーテッドIDに属しますが、権限は制限されています。たとえユーザーが管理者権限を持っていても、IAMユーザーの一覧表示やポリシーのアタッチなど、一部の操作はフェデレーテッドトークン経由では実行できません。
|
||||
sts:GetFederationToken によって返されるトークンは呼び出し元ユーザーのフェデレーテッド・アイデンティティに属しますが、権限は制限されます。たとえユーザーが管理者権限を持っていても、IAM ユーザーの一覧表示やポリシーのアタッチなどの操作はフェデレーテッドトークンでは実行できません。
|
||||
|
||||
さらに、この方法はややステルス性が高くなります。フェデレーテッドユーザーはAWS Portalに表示されず、CloudTrailログや監視ツール経由でしか確認できません。
|
||||
さらに、この方法はややステルス性が高く、フェデレーテッドユーザーは AWS Portal に表示されず、CloudTrail ログや監視ツールでのみ確認できます。
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
|
||||
Reference in New Issue
Block a user