The concept
CircleCI projects can be configured to run builds for pull requests from forks and pass project secrets to those builds, allowing an attacker to submit a malicious pull request that exfiltrates the secrets. The author describes how to detect this configuration using public build logs and provides scripts to automate the process.
nathandavison.com
Published on nathandavison.com
The research in this write up was inspired by the excellent CI Knew There Would Be Bugs Here research by EdOverflow. As outlined in that research, the concept of finding secrets such as API keys and other credentials in CI/CD logs is a promising one for bug bounty hunters, as it is a data source which is updated…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the project has both 'Build forked pull requests' and 'Pass secrets to builds from forked pull requests' enabled in CircleCI, so untrusted fork pull requests can modify the CI configuration and access project secrets.
Impact
An attacker could exfiltrate secrets such as API keys and tokens from the CI environment, potentially leading to further compromise, though the author notes that without running the attack the validity and impact of the secrets cannot be fully confirmed.
What the attacker needed
Public GitHub repo; CircleCI project with both settings enabled; attacker can fork and open PR
The fix
Disable either 'Build forked pull requests' or 'Pass secrets to builds from forked pull requests', or use CircleCI Contexts to restrict secret access to authorised users.
How it was found
- Find a GitHub organisation that uses CircleCI by visiting the CircleCI page for the organisation.
- Look for CircleCI builds named 'pull/XXX' indicating a pull request from a fork.
- Open a successful build and check the 'Preparing Environment Variables' stage for secret names.
- If secrets other than CIRCLE_JOB are listed, the project may be vulnerable.
- Optionally, send a harmless test pull request from a fork to confirm secrets are passed.
- Close the test pull request to avoid wasting the program's time.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you contribute to a project on GitHub, you can send a 'pull request' from your own copy (a fork) of the project. Some projects automatically run their tests on these pull requests using a service called CircleCI. If the project also gives those test runs access to secret passwords and keys, someone could send a pull request that secretly copies those secrets out. This article explains how to spot projects set up this way without actually stealing anything.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.