Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Privilege Escalation via a service account impe...

Avatar for Jakub Domeracki Jakub Domeracki
December 04, 2025
2

Privilege Escalation via a service account impersonation chain

Privilege Escalation via a service account impersonation chain

Story behind the most creative report from Google Cloud bugSWAT 2025

Avatar for Jakub Domeracki

Jakub Domeracki

December 04, 2025
Tweet

Transcript

  1. Privilege Escalation via a service account impersonation chain Story behind

    the most creative report from Google Cloud bugSWAT 2025 Jakub Domeracki OH MY HACK 2025 OH MY HACK 2025 OH MY HACK 2025
  2. whoami Sr. Security Engineer @ Coder Started reporting bugs to

    Google in late 2023 Currently ranked top 100 all time on Google VRP Leaderboard Agenda Live Hacking Event 101 Why Google SecOps SOAR? Abusing non-human identities Connecting the dots Vertical Privilige Escalation Full attack scenario Remediation
  3. Live Hacking Event 101 Invite only Collaboration is encouraged Bounty

    multipliers Duplicate window Predefined scope Final couple days onsite https://x.com/GoogleVRP/status/1974546816772239699/photo/1
  4. Getting invited Google typically considers the performance of individual researchers

    from the past year of Cloud VRP reports as well as previous bugSWAT event performance when deciding who to invite.
  5. Picking the target Scope consisted of 9 Google Cloud Products

    Due to limited time I decided to pick a single target and stay with it throughout the event
  6. Why Google SecOps SOAR? Acquisition doesn’t use Google’s battle tested

    frameworks Enterprise license hard to access by individual hunters → untouched scope Large attack surface feature creep → tech debt aggregates over time
  7. Reading the docs First thing I recommend to do is

    go through the docs and then do it again
  8. Methodology 1.Mapping the attack surface Unauthenticated Authenticated External & Internal

    APIs 2.Attack scenario ideation Verifiable hypotheses based on current context Overarching aim is maximum impact (go big or go home) Repeat steps #1 and #2 in a loop
  9. Python execution environment aka RCE-as-a-Service One of the first features

    which stood out after documentaion review was the Secure implementation of code sandboxing is notoriously hard https://docs.cloud.google.com/chronicle/docs/soar/respond/ide/using-the-ide#custom-code-validation
  10. IDE custom code validation 🤨 The denylist approach seemed almost

    certainly insufficient https://web.archive.org/web/20250419131143/https://cloud.google.com/chronicle/docs/soar/respond/ide/ide-custom-code-
  11. We are in, what next? Linux Privilige Escalation goal: go

    from user nonroot → root issue: no straightforward pathway (SUID/SGID binaries etc.) Pivot to other services within the Cluster goal: get access to privileged services issue: blocked by Cloud Service Mesh (managed Istio) Call the K8s apiserver goal: attempt to take advantage of the default bound KSA token issues: blocked by Network Policies
  12. Workload Identity Federation for GKE Elegant solution to grant per

    Service permissions to call Google APIs https://medium.com/google-cloud/whoami-the-quest-of-understanding-gke-workload-identity-federation-e951e5e4a03f
  13. Access token introspection Service account access tokens are opaque (can’t

    be decoded locally) One can introspect them using the https://oauth2.googleapis.com/tokeninfo API https://docs.cloud.google.com/docs/authentication/token-types#sa-access-tokens
  14. What is gke-init-python used for? Yet again documentation came in

    handy https://docs.cloud.google.com/docs/authentication/token-types#sa-access-tokens
  15. Service Account impersonation When an authenticated principal, such as a

    user or another service account, authenticates as a service account to gain the service account's permissions, it's called impersonating the service account. https://docs.cloud.google.com/iam/docs/service-account-impersonation
  16. Prior art The fact that the service account impersonation mechanism

    opens room for privilige escalation scenarios has been known since at least 2020 Some research examples: Plundering GCP - Escalating Privileges, Moving Laterally, and Stealing Secrets in Google Cloud by Chris Moberly from GitLab EP60 Impersonating Service Accounts in GCP and Beyond: Cloud Security Is About IAM? with Dylan Ayrey, cofounder of Truffle Security Privilege Escalation in GCP A Transitive Path by Kat Traxler
  17. What can gke-init-python do? Running following gcloud CLI commands as

    gke-init-python yielded surprising results https://docs.cloud.google.com/iam/docs/testing-permissions
  18. Malachite enters the scene Malachite is the internal name of

    Chronicle which in now called SecOps SIEM
  19. Connecting the dots 1.Attacker can perform API calls as the

    gke-init-python Service Account 2.gke-init-python can impersonate the secops-auth Service Account 3.secops-auth Service Account is the issuer of Signed JWTs
  20. Live demo 404 🚧 Google broke the chain by removing

    misconfigured IAM bindings soon after the event I couldn’t record a demo nor do it live (yeah, I know)
  21. Full-read SSRF via the predefined HTTPv2 integration Trivial SSRF to

    get the OAuth access token of the Service Account bound to the Python execution environment https://docs.cloud.google.com/chronicle/docs/soar/marketplace-integrations/http-v2#execute-request
  22. Code Execution via SSTI in TemplateEngine PowerUp Classic Jinja2 Server

    Side Template Injection subprocess.Popen was imported making exploitation trivial https://docs.cloud.google.com/chronicle/docs/soar/marketplace-and-integrations/power-ups/templateengine
  23. The aftermath Reports which weren’t considered impactful got payed out

    retroactively 💰 I showcased a live demo during show & tell Ended up winning the most creative report award! 🎉
  24. Q&A

  25. Thank you for attending! Please rate the talk and provide

    feedback Contact information: https://x.com/j_domeracki https://www.linkedin.com/in/jakub-domeracki/