TravisCI Security
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
What is TravisCI
Travis CI is a hosted or on premises continuous integration service used to build and test software projects hosted on several different git platform.
Basic TravisCI InformationAttacks
Triggers
To launch an attack you first need to know how to trigger a build. By default TravisCI will trigger a build on pushes and pull requests:
![](https://cloud.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F430239558-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5uvPQhxNCPYYTqpRwsuS%252Fuploads%252FroAGcq0V3Yx9MIbzNirn%252Fimage.png%3Falt%3Dmedia%26token%3Dd4c23379-3a23-49fa-8236-8bce2b21a1a1&width=768&dpr=4&quality=100&sign=2a1e53fb&sv=1)
Cron Jobs
If you have access to the web application you can set crons to run the build, this could be useful for persistence or to trigger a build:
![](https://cloud.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F430239558-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5uvPQhxNCPYYTqpRwsuS%252Fuploads%252FgAE8gapLxJLsnXzlwxGR%252Fimage.png%3Falt%3Dmedia%26token%3Da6593223-38b6-4372-9e6c-0aefef15a618&width=768&dpr=4&quality=100&sign=d2bacfee&sv=1)
It looks like It's not possible to set crons inside the .travis.yml
according to this.
Third Party PR
TravisCI by default disables sharing env variables with PRs coming from third parties, but someone might enable it and then you could create PRs to the repo and exfiltrate the secrets:
![](https://cloud.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F430239558-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5uvPQhxNCPYYTqpRwsuS%252Fuploads%252FGS85gTzLY6NrPq2djugz%252Fimage.png%3Falt%3Dmedia%26token%3D4c12026f-8239-4b01-9d8e-5a3be56a10b7&width=768&dpr=4&quality=100&sign=dae3ef67&sv=1)
Dumping Secrets
As explained in the basic information page, there are 2 types of secrets. Environment Variables secrets (which are listed in the web page) and custom encrypted secrets, which are stored inside the .travis.yml
file as base64 (note that both as stored encrypted will end as env variables in the final machines).
To enumerate secrets configured as Environment Variables go to the settings of the project and check the list. However, note that all the project env variables set here will appear when triggering a build.
To enumerate the custom encrypted secrets the best you can do is to check the
.travis.yml
file.To enumerate encrypted files you can check for
.enc
files in the repo, for lines similar toopenssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d
in the config file, or for encrypted iv and keys in the Environment Variables such as:
![](https://cloud.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F430239558-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5uvPQhxNCPYYTqpRwsuS%252Fuploads%252FG2E8dxstAyID3QwkZOPy%252Fimage.png%3Falt%3Dmedia%26token%3D1c65f7fc-0bce-4660-921e-7be2352e39c9&width=768&dpr=4&quality=100&sign=e18f2033&sv=1)
TODO:
Example build with reverse shell running on Windows/Mac/Linux
Example build leaking the env base64 encoded in the logs
TravisCI Enterprise
If an attacker ends in an environment which uses TravisCI enterprise (more info about what this is in the basic information), he will be able to trigger builds in the the Worker. This means that an attacker will be able to move laterally to that server from which he could be able to:
escape to the host?
compromise kubernetes?
compromise other machines running in the same network?
compromise new cloud credentials?
References
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated