Jenkins 101: Common Misconfigurations & How to best Secure it?

Eylam Milner
Jun 07 · 4 min read
securing jenkins ci cd misconfigurations

What is Jenkins and it’s Logo about?

Jenkins is the most widely-used CI/CD tool today. As the world moves from cloud to cloud-native applications powered by Kubernetes, Jenkins still remains highly relevant. It has adapted to the fast-changing tech landscape and is still a vital part of software operations for many organizations. However, Jenkins, as any software, needs to be properly secured to avoid breaches. In this post, we look at the 4 common misconfigurations related to Jenkins and ways to avoid these. Let’s start with some background on Jenkins.

One look at the Jenkins logo and you’d think it’s quite silly in comparison with other tech logos. An elderly man dressed in a tux, seemingly waiting on someone.

Jenkins Logo transparent PNG - StickPNG

Well, that is exactly what the creators of Jenkins had in mind when naming the project and creating this logo. The name ‘Jenkins’ is inspired by a butler, who manages the food and other home duties at large households. In like manner, Jenkins the tool is all about enabling you to get things done better and faster when creating and deploying software.

What is Jenkins?

Jenkins calls itself an ‘open source automation server.’ It is known for its role as a build server, which is a key part of the continuous integration (CI) process. While initially focused on CI, Jenkins has also expanded further downstream to include continuous delivery (CD) capabilities as well. Today, as the world moves to Kubernetes and containers, Jenkins has not waned in popularity. It is still used to control and manage the software supply chain at many organizations, both large and small. 

What can go wrong with Jenkins?

Verkada, a company that manufactures security cameras for industrial and home use, was recently in the news for a security breach that involved Jenkins. Verkada had left their Jenkins servers unsecured and publicly accessible via the internet. These servers had ‘super administrator’ privileges turned on by default, which automatically gave attackers full privileges on those servers. Using these privileges, one security researcher was able to extract the details of 157,000 security cameras and their users’ email ID. The group that revealed this attack showed screenshots of videos they could access. This is an eerie breach of customer trust, and incidents like this can bring an organization down to its knees.

Jenkins CI CD Security Posture

Let’s take a look at 4 security pillars for Jenkins and which misconfiguration to look for related to them.

Pillar 1: Identity and Access Management

Top Misconfiguration: The Jenkins Controller can be accessed by agents. The agent can then ask a Controller to do just about anything within the confinement of the operating system, such as accessing files on the Controller or triggering other jobs on Jenkins.

Jenkins can be accessed by agents

How to avoid it:  You can restrict the actions and files an agent can make and/or access on the Jenkins Controller.

Pillar 2: Application Security

Top Misconfiguration: Possible malicious code injection in Jenkins server. Jenkins allows outside users to supply HTML, which could contain malicious code.

How to avoid it: Prevent malicious code injections through HTML by setting a Markup Formatter plugin. This would ensure that users don’t supply malicious cargo code in the HTML they supply (in descriptions of jobs, builds, views, and others). 

Pillar 3: Configuration Management

Top Misconfiguration: Build jobs running on Jenkins Controller which can read or modify files in JENKINS_HOME can impact the entire Jenkins installations and even the ability to create pipelines. 

How to avoid it: Configure the master to have no executors, and run builds only on build agents where people who administer Jenkins are different from the people who configure jobs or commit to projects. 

Pillar 4: Network Security

Top Misconfiguration: Possible CSRF (Cross-Site Request Forgery) attacks on Jenkins, which force an end-user to execute unwanted actions on Jenkins. 

How to avoid it: Configure CSRF protection on Jenkins. This requires that for any actions resulting in modifications, a specific token (called crumb in Jenkins) will be provided so the user it was created for can be identified. 

The Main Takeaway

As seen above, there are multiple attack vectors for a Jenkins install. Attackers could gain access using IAM, application code, the Jenkins Controller, or externally via CSRF. There are multiple ways to secure Jenkins CI CD from these attacks. The remedies listed here to keep in mind the type of attack and address them appropriately. There are many other such attacks to keep an eye on. What’s important is to have a security posture that keeps adapting according to changes in attacks. 

Security tools that secure applications in production aren’t built for these kinds of tasks. What is needed is a supply chain-aware security solution that understands the different components and players across the entire supply chain. Things like the Jenkins Controller, code coming from known and unknown identities, and builds that violate privileges. 

By being aware of the security risks facing Jenkins and leveraging the appropriate security tooling to guard against them, you can bolster your software supply chain. In a world where a company’s reputation can be tarnished with just one incident (hint: SolarWinds) all organizations need to take appropriate actions to secure their software supply chain from these attacks. 

Jenkins, DevOps, DevSecOps, CICD Security 

Eylam Milner
Jun 07 · 4 min read

Related Articles

Securing your GitLab: Best Practices To Implement

What is GitLab GitLab is a free open-source service designed to manage and share code in a distributed version control…

Eylam Milner
Jul 14 · 4 min read

President Biden’s Executive Order Demands Cybersecurity for Software...

The SolarWinds Attack Was the Industry’s Wakeup Call The new wave of software supply chain attacks that targeted SolarWinds, Codecov,…

Eran Orzel
Jun 23 · 5 min read

The importance of having visibility over your pipeline’s plugins...

Hardly a week goes by these days without hearing about a new supply chain attack. A recent headline featured yet…

Eilon Elhadad
Jun 21 · 4 min read

End-to-End CI/CD Security Platform

open source vulnerability scanner