Have you heard about Dependabot? If not, just ask any developer around you, and they’ll likely rave about how it has revolutionized the tedious task of checking and updating outdated dependencies in software projects.
Dependabot not only takes care of the checks for you, but also provides suggestions for modifications that can be approved with just a single click. Although Dependabot is limited to GitHub-hosted projects, it has set a new standard for continuous providers to offer similar capabilities. This automation of “administrative” tasks has become a norm, enabling developers to integrate and deploy their work faster than ever before. Continuous integration and deployment workflows have become the cornerstone of software engineering, propelling the DevOps movement to the forefront of the industry.
But a recent advisory by security firm Checkmarx sheds light on a concerning incident. Malicious actors have recently attempted to exploit the trust associated with Dependabot by impersonating the tool. By mimicking the suggestions made by Dependabot (in the form of pull requests), these actors tried to deceive developers into accepting changes without giving them a second thought.
While Dependabot exemplifies the advancements in automating software maintenance tasks, this incident also underscores the broader complexities and vulnerabilities inherent in CI/CD pipelines. These pipelines serve as vital conduits, linking the external world of software development tools and platforms with the internal processes of software creation and deployment. Understanding this connection is key to addressing the security challenges we face.
Continuous integration (CI) and deployment (CD) workflows have revolutionized the software development process, providing developers with the ability to seamlessly merge their work and deploy it to the production environment. These workflows ensure that the code undergoes automated security scans, rigorous testing, and adherence to coding standards, resulting in a more efficient and reliable development process. They have become a catalyst for innovation, enabling teams to focus on building and enhancing their products with the assurance of quality and security.
To illustrate the concept, imagine building a puzzle. CI acts as a vigilant checker, verifying that each new puzzle piece fits correctly before moving forward. On the other hand, CD takes this a step further by automatically placing each verified piece into the final puzzle, eliminating the need to wait for the entire puzzle to be completed. This accelerated process allows for faster feature delivery and ultimately expedites the overall product development timeline.
However, these CI/CD workflows also connect the outside world with the internal development environment, creating potential risks. For instance, consider a scenario where a developer integrates a third-party library into their project through a CI/CD pipeline. If the developer fails to thoroughly vet the library or if the pipeline lacks proper security checks, malicious code could be unknowingly incorporated into the project, compromising its integrity. In recent years, there has been a rise in attacks such as typosquatting and dependency confusion, which aim to exploit the reliance on open source software for financial gain.
The rise of automated integrations workflows have changed the economics for attackers by lowering the cost and increasing the potential gains of an attack. Attackers can target popular central package repositories like PyPi, which hosts thousands of packages and serves millions of downloads daily. The sheer scale of operations makes it economically viable for attackers to try their luck, even with a small chance of success.
Another example is the use of external APIs within CI/CD pipelines. Developers often need to provide valid credentials for these APIs to enable automated deployment or integration with external services. However, if these credentials are not securely managed or if they are inadvertently exposed in logs or artifacts, they can be exploited by attackers to gain unauthorized access to sensitive resources or manipulate the pipeline’s behavior.
CI/CD breaches frequently stem from either an initial compromise of secrets or developers becoming targets of specific attacks. However, rather than blaming developers for these breaches, it is crucial to recognize that the issue lies in the inherent lack of security in these pipelines. This highlights a larger problem: CI/CD pipelines are far from being secure by default.
Although the idea of implementing secure-by-design workflows is becoming more popular, CI/CD platforms still have a significant way to go. Platforms like GitHub Actions, GitLab CI/CD, and CircleCI, which were initially designed with flexibility in mind, often prioritize ease of use over robust security measures. As a result, there is a lack of default safeguards to prevent potential issues from arising.
A glaring example of this is how easy it is for a developer to expose sensitive information like secrets. Developers commonly inject secrets at runtime and rely for that on the capability to store secrets in the CI provider itself. While this practice isn’t a problem by itself, it raises at least two security concerns: first, the CI provider hosting the secrets becomes a vault of sensitive information and an attractive target for attackers. As recently as early 2023, CircleCI suffered a breach of its systems which forced users to rotate “any and all” their secrets following a breach of the company’s systems.
Second, secrets can often leak and go unnoticed through CI/CD pipelines themselves. For example, if a secret is concatenated with another string (say, a URL) and then logged, the CI redacting mechanism will not work. Same goes with encoded secrets. The consequence is that CI logs often expose plaintext secrets. Similarly, it is not uncommon at all to find secrets hard-coded in software artifacts, being the result of a misconfigured continuous integration workflow.
CI/CD providers have already taken steps to enhance security, like GitHub Dependabot security checks. But most of the time, permissive defaults and complex permission models are still the rule. To protect CI/CD pipelines and prevent code compromise, developers should take additional measures to harden their pipelines against attacks. One crucial aspect is ensuring the protection of developers’ credentials. Another one is to take a proactive approach to security with alert triggers.
To effectively secure CI/CD pipelines, it’s crucial to view them as high-priority, potentially externally connected environments. The key is a mix of best practices:
By combining these strategies, organizations can comprehensively safeguard their CI/CD pipelines and software supply chain, adapting to evolving threats and maintaining robust security protocols. Get started securing your pipelines today with the GitGuardian Platform.
Reference: https://thehackernews.com/2023/11/cicd-risks-protecting-your-software.html