# AWS - Codebuild Enum {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} ## CodeBuild AWS **CodeBuild** is recognized as a **fully managed continuous integration service**. The primary purpose of this service is to automate the sequence of compiling source code, executing tests, and packaging the software for deployment purposes. The predominant benefit offered by CodeBuild lies in its ability to alleviate the need for users to provision, manage, and scale their build servers. This convenience is because the service itself manages these tasks. Essential features of AWS CodeBuild encompass: 1. **Managed Service**: CodeBuild manages and scales the build servers, freeing users from server maintenance. 2. **Continuous Integration**: It integrates with the development and deployment workflow, automating the build and test phases of the software release process. 3. **Package Production**: After the build and test phases, it prepares the software packages, making them ready for deployment. AWS CodeBuild seamlessly integrates with other AWS services, enhancing the CI/CD (Continuous Integration/Continuous Deployment) pipeline's efficiency and reliability. ### **Github/Gitlab/Bitbucket Credentials** #### **Default source credentials** This is the legacy option where it's possible to configure some **access** (like a Github token or app) that will be **shared across codebuild projects** so all the projects can use this configured set of credentials. The stored credentials (tokens, passwords...) are **managed by codebuild** and there isn't any public way to retrieve them from AWS APIs. #### Custom source credential Depending on the repository platform (Github, Gitlab and Bitbucket) different options are provided. But in general, any option that requires to **store a token or a password will store it as a secret in the secrets manager**. This allows **different codebuild projects to use different configured accesses** to the providers instead of just using the configured default one. ### Enumeration ```bash # List external repo creds (such as github tokens) ## It doesn't return the token but just the ARN where it's located aws codebuild list-source-credentials # Projects aws codebuild list-shared-projects aws codebuild list-projects aws codebuild batch-get-projects --names # Check for creds in env vars # Builds aws codebuild list-builds aws codebuild list-builds-for-project --project-name aws codebuild list-build-batches aws codebuild list-build-batches-for-project --project-name # Reports aws codebuild list-reports aws codebuild describe-test-cases --report-arn ``` ### Privesc In the following page, you can check how to **abuse codebuild permissions to escalate privileges**: {% content-ref url="../aws-privilege-escalation/aws-codebuild-privesc.md" %} [aws-codebuild-privesc.md](../aws-privilege-escalation/aws-codebuild-privesc.md) {% endcontent-ref %} ### Post Exploitation {% content-ref url="../aws-post-exploitation/aws-codebuild-post-exploitation/" %} [aws-codebuild-post-exploitation](../aws-post-exploitation/aws-codebuild-post-exploitation/) {% endcontent-ref %} ### Unauthenticated Access {% content-ref url="../aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md" %} [aws-codebuild-unauthenticated-access.md](../aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md) {% endcontent-ref %} ## References * [https://docs.aws.amazon.com/managedservices/latest/userguide/code-build.html](https://docs.aws.amazon.com/managedservices/latest/userguide/code-build.html) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}