Miggo Logo

CVE-2021-21697: Agent-to-controller access control allows reading/writing most content of build directories in Jenkins

9.1

CVSS Score
3.1

Basic Information

EPSS Score
0.65385%
Published
5/24/2022
Updated
12/18/2023
KEV Status
No
Technology
TechnologyJava

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
org.jenkins-ci.main:jenkins-coremaven>= 2.304, <= 2.3182.319
org.jenkins-ci.main:jenkins-coremaven<= 2.303.22.303.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from two key gaps:

  1. The FilePath API implementation lacked contextual checks to limit build directory access to only builds actively running on the requesting agent (addressed by the new RunningBuildFilePathFilter in the patch).
  2. The legacy path filtering system (AdminWhitelistRule) had incomplete disallowed inputs:
    • Failed to canonicalize paths, enabling symlink attacks
    • Allowed broad access to build directories without runtime context checks
    • Did not properly validate operations like mkdirs, renameTo, and temporary file creation

The commit explicitly adds RunningBuildFilePathFilter to enforce runtime build-context checks, indicating these validations were missing in prior versions. The CWE-184 classification confirms the root cause was an incomplete allowlist/access control implementation.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

***nts *r* *llow** som* limit** ****ss to *il*s on t** J*nkins *ontroll*r *il* syst*m. T** *ir**tori*s ***nts *r* *llow** to ****ss in J*nkins *.*** *n* **rli*r, LTS *.***.* *n* **rli*r in*lu** t** *ir**tori*s storin* *uil*-r*l*t** in*orm*tion, int*n

Reasoning

T** vuln*r**ility st*ms *rom two k*y **ps: *. T** *il*P*t* *PI impl*m*nt*tion l**k** *ont*xtu*l ****ks to limit *uil* *ir**tory ****ss to only *uil*s **tiv*ly runnin* on t** r*qu*stin* ***nt (***r*ss** *y t** n*w Runnin**uil**il*P*t**ilt*r in t** p*t