Eilon Elhadad
May 31 · 4 min read
Your CI/CD security is only as strong as its weakest link. An overlooked part of the CI/CD pipeline can be just the one that poses a security risk. For many organizations, one such overlooked area within the CI/CD process is dependencies. The recent SolarWinds supply chain attack has put the spotlight on these types of attacks, and rightly so.
In this post we look at dependency confusion attacks and how to secure your CI/CD pipeline against them.
Part of developing with any programming language is to trust its public code repository. Node package manager, Python PiPy, and Ruby Gems are examples of public repository stores. Developers frequently download packages from these repositories using a simple command like npm or pip followed by the name of the repository. The ease of executing these commands and the fact that they’re coming from a very popular source make them look perfectly safe. However, this is precisely where security is compromised. Being a publicly available repository, the packages here are uploaded by unknown developers and open source communities. There are no security guarantees associated with these packages. Some developers and communities may have basic security measures, and may be quick to fix any security vulnerabilities. However, most repositories would contain known or unknown risks that you automatically take on when you use them.
Attackers are well aware of the opportunities these repositories present and are quick to launch an attack. Typosquatting is a well-known example of how attackers try to exploit this weakness. They create and upload a repository that is a misspelling of another package. Since developers type in the name of the repository they want to install, they would often misspell the name, and end up installing the one with the typo. Another way attackers try to gain entry is to upload dependencies that no longer exist. This is how dependency confusion attacks happen.
There are many instances of attackers gaining access to a machine remotely using this form of attack. Many organizations have been victims of this attack. Alex Birsan details how he used this method to breach the security of multiple high profile organizations like Apple and Microsoft, and received handsome bug bounties for his ethical hacking.
The package management services further complicate things. For example, if there are two packages with the same name, the package manager would install the one with the higher version number. This is only when using an argument like ‘’–extra-index-url’ in pip. Hackers can simply name their package as ‘library 9000.0.0’ and become the preferred package in many instances.
Organizations are tight-lipped about how they handle dependency confusion attacks. Indeed, it can be embarrassing for a high tech firm, or a company that handles sensitive information to admit they’ve dropped the ball in such a seemingly obvious way.
Preventing these attacks takes a modern type of security tooling. One that can read the contents of a package, understand its origins, and be able to sniff out an impostor.
As a rule of thumb, no external package should be trusted as is. Additionally, every package should go through a scanner before it is allowed to be installed
Modern container security scanners Quay are an example of this approach. You can configure them so that container images only from a trusted private repository are allowed. Additionally, they scan every container image to check for CVEs (Common Vulnerabilities and Exposures).
When upgrading packages, dependencies get updated too. In these cases, it’s easy for modified dependencies to slip through the cracks. A security scanner that can spot these modified dependencies is crucial. If any suspicious changes are spotted this should automatically result in the upgrade getting aborted.
jFrog Artifactory calls itself the first ‘Universal Repository Manager.’ It hosts packages, container images, and Helm charts all in one place. While this is convenient, it shows how wide the attack vector is for dependency confusion. As we modernize the supply chain, we’re looking for ways to move faster, and centralize repositories. This move makes us more vulnerable to dependency confusion.
Argon recommendations:
While consolidating operations is convenient, it is necessary to implement customized security protocols for each repository and artifactory, and control the private and public packages differently on each repository. This is easier said than done, and requires a policy-based approach to security.
By understanding the various risks you’re exposed to when you use a package repository, and taking the steps to protect yourself from each of them, you can ensure better supply chain security. Your developers can work on install packages in confidence, and your Ops team can rest assured they won’t be in for any surprises later.
Argon Security helps automates the enforcement of security protocols across the CI/CD pipeline stages and tools, enabling development teams to take full advantage of such tools’ benefits and focus fully on delivering the best software without compromising security.
jFrog, Artifactory, Repository, Dependency Confusion, DevOps, DevSecOps
DevOps has evolved into a standard practice of software development. According to…
Logging in to websites to access your accounts isn’t as secure as…
Today’s businesses and enterprises are heavily dependent on software and applications for…
Cookie | Duration | Description |
---|---|---|
__hssrc | session | This cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
elementor | never | This cookie is used by the website's WordPress theme. It allows the website owner to implement or change the website's content in real-time. |
JSESSIONID | session | Used by sites written in JSP. General purpose platform session cookies that are used to maintain users' state across page requests. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | This cookie, set by Cloudflare, is used to support Cloudflare Bot Management. |
__hssc | 30 minutes | HubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie. |
bcookie | 2 years | LinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser ID. |
lang | session | This cookie is used to store the language preferences of a user to serve up content in that stored language the next time user visit the website. |
lidc | 1 day | LinkedIn sets the lidc cookie to facilitate data center selection. |
messagesUtk | 1 year 24 days | This cookie is set by hubspot. This cookie is used to recognize the user who have chatted using the messages tool. This cookies is stored if the user leaves before they are added as a contact. If the returning user visits again with this cookie on the browser, the chat history with the user will be loaded. |
Cookie | Duration | Description |
---|---|---|
__hstc | 1 year 24 days | This is the main cookie set by Hubspot, for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session). |
_ga | 2 years | The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors. |
_ga_1HW5JYG3DC | 2 years | This cookie is installed by Google Analytics. |
_gat_UA-191589358-1 | 1 minute | A variation of the _gat cookie set by Google Analytics and Google Tag Manager to allow website owners to track visitor behaviour and measure site performance. The pattern element in the name contains the unique identity number of the account or website it relates to. |
_gcl_au | 3 months | Provided by Google Tag Manager to experiment advertisement efficiency of websites using their services. |
_gid | 1 day | Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously. |
hubspotutk | 1 year 24 days | This cookie is used by HubSpot to keep track of the visitors to the website. This cookie is passed to Hubspot on form submission and used when deduplicating contacts. |
Cookie | Duration | Description |
---|---|---|
bscookie | 2 years | This cookie is a browser ID cookie set by Linked share Buttons and ad tags. |
test_cookie | 15 minutes | The test_cookie is set by doubleclick.net and is used to determine if the user's browser supports cookies. |
Cookie | Duration | Description |
---|---|---|
AnalyticsSyncHistory | 1 month | No description |
li_gc | 2 years | No description |
UserMatchHistory | 1 month | Linkedin - Used to track visitors on multiple websites, in order to present relevant advertisement based on the visitor's preferences. |