Jenkins jobs are executed with high privileges by default
Rule Details
Cortex AppSec Rule ID
APPSEC_CICD_54
Category
Pipeline Based Access Controls
Severity
HIGH
Impact
Each executed Jenkins job is assigned with the privileges of a Jenkins user. These privileges are used to interact with the Jenkins system, and include creating jobs, running builds, and executing on the various configured Jenkins nodes. By default, Jenkins jobs run with the Jenkins SYSTEM user account (that should not be confused with the operating system user). This user account has high privileges over the system, and is allowed to perform any action on the Jenkins instance. Thus, any newly created job runs with the highest level of privileges, unless specifically set otherwise by an administrator. An attacker executing malicious code in a job running with SYSTEM privileges can take advantage of it to perform impactful actions on the Jenkins instance and its nodes. For more information about access controls for builds: https://www.jenkins.io/doc/book/security/build-authorization/
Recommended Solution - Buildtime
Change the default user used to execute Jenkins jobs to support the least privilege principle:
Install the Authorize Project plugin.
On the Jenkins instance, under “Manage Jenkins”, browse to “Configure Global Security”.
Under “Access Control for Builds”, set “Project default build authorization” to one of the following:
Run as Anonymous
Run as User who triggered Build
Run as Specific user
In addition, configure the Per-project configurable Build Authorization setting to NOT include the Run as SYSTEM strategy, to prevent it from being configured for specific jobs. Instead, set one or more of the options above.
📌 NOTE Follow the least privilege principle when configuring a job to run by a specific user.
Last updated
Was this helpful?
