|
| 1 | +--- |
| 2 | +authors: |
| 3 | + - core |
| 4 | +tags: [security] |
| 5 | +--- |
| 6 | +# CircleCI Security Incident |
| 7 | + |
| 8 | +In early January 2023, CircleCI informed us that they had a large |
| 9 | +[security breach](https://circleci.com/blog/jan-4-2023-incident-report/) |
| 10 | +where a third party had gained access to all the environment secrets |
| 11 | +stored in the service. For `conda-forge`, these secrets are the API |
| 12 | +token used to upload built packages to our staging area on |
| 13 | +`anaconda.org` and the unique token we generate for each feedstock. The |
| 14 | +feedstock tokens are used as part of our artifact staging process to |
| 15 | +ensure that only the maintainers of a given feedstock can upload |
| 16 | +packages built by that feedstock. Later in January, we were informed by |
| 17 | +CircleCI that their security breach started on December 19, 2022, with |
| 18 | +the bulk of the secrets being exfiltrated in plain text from their |
| 19 | +servers a few days later. A malicious third-party with access to these |
| 20 | +secrets could potentially upload compromised versions of any package on |
| 21 | +`conda-forge` in a so-called "supply chain" attack. |
| 22 | + |
| 23 | +<!--truncate --> |
| 24 | + |
| 25 | +**We have produced a** [list of all possibly compromised |
| 26 | +artifacts](https://raw.githubusercontent.com/conda-forge/conda-forge.github.io/main/misc/circle_ci_pkgs_dec2022_breach.json). |
| 27 | + |
| 28 | +**If you use** `conda-forge` **in very sensitive environments (which we |
| 29 | +do not recommend!), please remove these artifacts from your system.** |
| 30 | + |
| 31 | +**To date, we know of no compromised artifacts in** `conda-forge`. |
| 32 | + |
| 33 | +**API tokens for the main** `conda-forge` **channel were never exposed |
| 34 | +and remain secure to our knowledge.** |
| 35 | + |
| 36 | +## Our Response |
| 37 | + |
| 38 | +We took the following steps to respond to this incident. |
| 39 | + |
| 40 | +- We immediately started a token rotation of all of our feedstock |
| 41 | + tokens and our staging area upload tokens as precautionary measures. |
| 42 | + This token rotation hit a few bugs, but was completed as of January |
| 43 | + 13, 2023. |
| 44 | +- We produced a census of all packages uploaded between December 19, |
| 45 | + 2022 and January 13, 2023. This data is available for download as a |
| 46 | + [JSON |
| 47 | + file](https://raw.githubusercontent.com/conda-forge/conda-forge.github.io/main/misc/circle_ci_pkgs_dec2022_breach.json). |
| 48 | +- We examined all the artifacts built during this time period for the |
| 49 | + [malicious |
| 50 | + files](https://circleci.com/blog/jan-4-2023-incident-report/) listed |
| 51 | + by CicleCI. We did not find any of those files in our artifacts. |
| 52 | +- As detailed below, we have begun retooling our system for feedstock |
| 53 | + tokens to be more robust and enable greater flexibility in our |
| 54 | + response to incidents like this. |
| 55 | +- We have begun systematically invalidating old tokens, |
| 56 | + decommissioning old bots, and minimizing permissions of our current |
| 57 | + tokens in order to further enhance `conda-forge`'s security. |
| 58 | + |
| 59 | +Rotating all of our tokens was taken as a precautionary measure. |
| 60 | +Unfortunately, during this token rotation, one of our bots encountered a |
| 61 | +bug which resulted in us losing the tokens for a very large fraction of |
| 62 | +feedstocks. This situation resulted in an extended outage that lasted |
| 63 | +about five days and was resolved on January 13, 2023, when the full |
| 64 | +token rotation was completed. |
| 65 | + |
| 66 | +## What did we learn? |
| 67 | + |
| 68 | +We learned a few things about our system for feedstock tokens and |
| 69 | +general maintenance of our CI service integrations. We probably should |
| 70 | +have known them already, but here we are. |
| 71 | + |
| 72 | +- We used the same feedstock token across multiple CI services. This |
| 73 | + limited our ability to immediately invalidate tokens associated with |
| 74 | + a single CI service and exposed all services if any single service |
| 75 | + had an incident. |
| 76 | +- Our token system only allowed one valid token per feedstock. This |
| 77 | + limitation means that we cannot recover from partially failed token |
| 78 | + resets/rotations and are subject to race conditions during the |
| 79 | + reset/rotation process that can cause failed package uploads. |
| 80 | +- We need to be more proactive about cleaning up deprecated/removed CI |
| 81 | + services. The use of CircleCI in `conda-forge` has been deprecated |
| 82 | + for quite a while. Had we taken the time, and had the foresight, to |
| 83 | + remove all of our secrets from CircleCI when it was deprecated, we |
| 84 | + could have avoided the security incident all together. |
| 85 | + |
| 86 | +We have begun retooling our system for feedstock tokens in order to fix |
| 87 | +the issues identified above and allow us to have more flexibility in |
| 88 | +responding to security incidents. We have also started the process of |
| 89 | +decommissioning several of our old CI services. These changes will take |
| 90 | +time to implement. You can follow the progress on our various public |
| 91 | +issue trackers. |
| 92 | + |
| 93 | +## Closing Thoughts & What can you do? |
| 94 | + |
| 95 | +We, the `conda-forge` core dev team, want to thank everyone for their |
| 96 | +patience and support as we have responded to the various security |
| 97 | +incidents and bugs detailed above. It goes without saying that the |
| 98 | +public nature of `conda-forge`'s infrastructure carries risks. On the |
| 99 | +other hand, by being public, anyone can look and verify our artifact |
| 100 | +builds. Security for `conda-forge` is about reducing risk, and we will |
| 101 | +continue to do our best. |
| 102 | + |
| 103 | +As a reminder, we do not recommend that you use `conda-forge` in |
| 104 | +environments with sensitive information. `conda-forge`'s software is |
| 105 | +built by our users and the core dev team cannot verify or guarantee that |
| 106 | +this software is not malicious or has not been tampered with. |
| 107 | + |
| 108 | +Our best defense against security incidents in `conda-forge` is you! Our |
| 109 | +feedstock maintainers are in the best position to notice incidents and |
| 110 | +issues. Please responsibly report anything you find to us at |
| 111 | + |
0 commit comments