agentleFS
EvilFreelancerEvilFreelancer/secs/.agents/skills/investigating-gcp-incidents/SKILL.md

investigating-gcp-incidents

Skill11 starsChanged 3 months agoApache-2.0View on GitHub

Investigate a suspected Google Cloud compromise from the control plane — Cloud Audit Logs (Admin Activity, Data Access, System Event, Policy Denied), Cloud Logging, and VPC Flow Logs — to reconstruct IAM and service-account abuse, key creation, data access, and log tampering into a timeline. Use when the evidence is GCP audit logs rather than a host. Service-account keys and IAM bindings are the usual attack path; preserve the audit logs before retention lapses.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check for a google.logging.v2.ConfigServiceV2.DeleteSink or disabled Data Access logging in the window — a gap after that point is …

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Investigating GCP Incidents

Google Cloud writes the intrusion into its audit logs. Cloud Audit Logs record who called which API on what resource, split into streams — Admin Activity (always on), Data Access (often off by default, and where read/exfil is proven), System Event, and Policy Denied. The attacker's path is usually identity: abusing a service account, minting a service-account key, or widening an IAM binding. The investigator reconstructs it from the logs, and the first job is to preserve them, because Data Access logs may not have been enabled and their retention is finite.

Confirm the project/organization is in scope per AGENTS.md. Note up front whether Data Access logging was enabled for the affected services — if it was not, read/exfil evidence may simply not exist, and that gap is itself a finding. This is read-only investigation; disabling keys or bindings is the operator's containment call.

When to Use

  • A suspected GCP compromise where the evidence is Cloud Audit Logs
  • Tracing IAM and service-account abuse, key creation, and impersonation
  • Confirming data access or exfiltration from GCS and other services
  • Finding cloud persistence (new bindings, keys) and log/sink tampering
  • Building a GCP attack timeline for an incident

When NOT to Use

  • On-host artifacts of a GCE instance — use investigating-windows-endpoints (or acquire the disk/memory)
  • AWS or Azure — use investigating-aws-incidents or investigating-azure-incidents
  • Proactive search with no incident yet — use hunting-threats
  • Offensive cloud testing — use exploiting-cloud-platforms
  • Proactive hardening — use hardening-cloud-posture
  • Running the whole incident — use responding-to-incidents
  • Packaging IOCs into a product — use producing-threat-intelligence

Preserve First

Export the relevant audit logs to a separate project or bucket before anything can be altered, and snapshot affected disks:

gcloud logging read \
  'logName:"cloudaudit.googleapis.com" AND timestamp>="2026-08-01T00:00:00Z"' \
  --project TARGET --format json > gcp_audit_$(date -u +%Y%m%d_%H%M%S).json
gcloud compute disks snapshot DISK --project TARGET --snapshot-names ir-DISK

Check for a google.logging.v2.ConfigServiceV2.DeleteSink or disabled Data Access logging in the window — a gap after that point is evidence, not all-clear.

Reconstruct from the Control Plane

Scope the window and the suspect principal, then read the audit streams. Query by protoPayload.methodName and authenticationInfo.principalEmail:

CategorymethodName signals
Access / recon...IAMPolicy.GetIamPolicy, ...testIamPermissions, unusual principalEmail
Persistence / privescSetIamPolicy (new bindings), CreateServiceAccountKey, generateAccessToken/generateIdToken (impersonation), CreateServiceAccount
Data access / exfilstorage.objects.get/list (Data Access logs), bigquery ... jobservice, disk image/snapshot export
Defense evasionDeleteSink, UpdateSink, disabling Data Access logging, firewall/VPC changes
# Service-account key creations in the window
gcloud logging read \
 'protoPayload.methodName="google.iam.admin.v1.CreateServiceAccountKey"' \
 --project TARGET --format 'table(timestamp, protoPayload.authenticationInfo.principalEmail, protoPayload.resourceName)'

Correlate with VPC Flow Logs for egress volume and destinations. Pivot on principalEmail, callerIp, and callerSuppliedUserAgent to follow an identity through impersonation chains (generateAccessToken is the GCP equivalent of an AssumeRole hop and a favorite privilege path).

Rationalizations to Reject

  • "No Data Access logs, so no exfil happened." Data Access logging is off by default for many services. Absent logs mean unknown, not clean — record the gap.
  • "Admin Activity looks quiet." Read/exfil and impersonation may only appear in Data Access and token-generation events. Check those streams explicitly.
  • "One project is enough." Check the organization and folder levels and other projects the compromised principal could reach.
  • "The key was deleted, case closed." Establish what the service-account key did before deletion; deletion may itself be the attacker covering tracks.
  • "IAM binding change is routine." A new SetIamPolicy granting a service account broad roles is a classic GCP persistence/privesc step. Verify it was authorized.

Deliverable

# GCP Investigation <GCP-###>   Date: <UTC>   Analyst: <name>
Project / org / scope: <ids, in-scope confirmation>
Window:           <UTC start–end>
Logging state:    <which audit streams were enabled — name the gaps>
Entry:            <compromised principal / service account / key>
Actions:          <methodNames by category, with caller IP + user agent>
Data touched:     <GCS/BigQuery/snapshots — read/exported>
Persistence:      <new bindings, SA keys, impersonation>
Log tampering:    <sink deletes / disabled logging + resulting gaps>
Timeline:         <UTC, chronological>
Conclusion:       compromised / not / could-not-determine  Confidence: <>

Save log exports and query output as {tool}_{project}_{YYYYMMDD_HHMMSS}.{ext} and log identities/IOCs via maintaining-engagement-state. ATT&CK IDs common here (T1078.004 Valid Cloud Accounts, T1098 Account Manipulation, T1528 Steal Application Access Token, T1530 Data from Cloud Storage, T1070 Indicator Removal) — re-verify before citing.

References

  • investigating-aws-incidents, investigating-azure-incidents — the sibling cloud investigations
  • investigating-windows-endpoints — when a GCE host must be examined
  • responding-to-incidents — the incident this feeds
  • hardening-cloud-posture — the audit logging and IAM controls this tests in hindsight
  • exploiting-cloud-platforms — the offensive counterpart TTPs
  • Cloud Audit Logs (Admin Activity / Data Access / System Event / Policy Denied), Cloud Logging, VPC Flow Logs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.