For the Jenkins version running the jenkins-cli can be exploited by downloading the jenkins-cli.jar off the website then using that to get a foothold.
Download jenkins-cli
Download:
Usage:
Get Commands list
Get all help command: The sed is looking for 2 spaces and to remove them.
Execute Command list
The command with the largest output was the connect-node command:
Getting Access to user
The users.xml was found my looking through the Jenkins documentation page and I can across this resource which details that the users information had been migrated to /users/users.xml below you can see the output of going to that file. For getting the actual user information I was about to find this security update which details how the user migration was taking place for upgrading to Jenkins LTS 2.138.x. It shows that “In this case, rename the directory $JENKINS_HOME/users/admin_6635238516816951048/” which is how I was about to find jennifers hash.
Jenkins stores its users in /var/jenkins_home/users/users.xml this is where I found jennifer_12108429903186576833
Using jennifer_12108429903186576833 in the path for user configs /var/jenkins_home/users/jennifer_12108429903186576833/config.xml we find in this file at the end there is a password hash.
I took this has and made the file below:
Then I used the hashcat command. Which cracked the password which came out to princess. With this password I am about to log into the Jenkins webpage as Jennifer.
User
After logging into the Jenkins webpage I started digging around and came across the root user configuration. After trying to play with the update credentials I started digging in the html and was able to find:
The key will be pretty long:
From here going the /script and doing the following from here
This will output the private key:
Privilege Escalation
From getting the ssh key we can copy the private key to host system and make a keyfile:
If we look in the directory /home/jennifer we will find: