🔬Win Black Box Pentest

🔬 INE LAB - Metasploitable3

  • Target IP: 10.2.29.246

  • Metasploit Framework is permitted

Port Scanning & Enumeration

  • Obtain the target IP address from the /etc/hosts file

cat /etc/hosts
	10.2.29.246 demo.ine.local
ping 10.2.29.246
ping demo.ine.local
cd Desktop
mkdir Win2k8
cd WiWin2k8/ # To store all the notes and files about the target
  • Port scanning with nmap

nmap -sV 10.2.29.246
# Scans 1000 common ports
21/tcp    open  ftp                  Microsoft ftpd
22/tcp    open  ssh                  OpenSSH 7.1 (protocol 2.0)
80/tcp    open  http                 Microsoft IIS httpd 7.5
135/tcp   open  msrpc                Microsoft Windows RPC
139/tcp   open  netbios-ssn          Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds         Microsoft Windows Server 2008 R2 - 2012 microsoft-ds
3306/tcp  open  mysql                MySQL 5.5.20-log
4848/tcp  open  ssl/http             Oracle Glassfish Application Server
7676/tcp  open  java-message-service Java Message Service 301
8080/tcp  open  http                 Sun GlassFish Open Source Edition  4.0
8181/tcp  open  ssl/http             Oracle GlassFish 4.0 (Servlet 3.1; JSP 2.3; Java 1.8)
9200/tcp  open  wap-wsp?
49152/tcp open  msrpc                Microsoft Windows RPC
49153/tcp open  msrpc                Microsoft Windows RPC
49154/tcp open  msrpc                Microsoft Windows RPC
49155/tcp open  msrpc                Microsoft Windows RPC

Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
  • Perform an advanced nmap scan and export it into an xml file

  • e.g. Extra nmap useful scans commands

  • Access the web server with a browser

    • http://10.2.29.246/

    • http://10.2.29.246/hahaha.jpg

    • View page source

  • Banner grabbing on some services

  • Other webpages

    • https://10.2.29.246:4848/

    • http://10.2.29.246:8080/

    • http://10.2.29.246:9200/

    • http://10.2.29.246:8484/

    • http://10.2.29.246:8585/

      • http://10.2.29.246:8585/wordpress/

https://10.2.29.246:4848/
http://10.2.29.246:8080/
http://10.2.29.246:8484/
http://10.2.29.246:8585/

SMB Enumeration

  • Import scan results in MSF by creating a dedicated workspace

Targeting

  • Try anonymous:anonymous with FTP

  • Brute-force the FTP server

📌 2 FTP users:

  • administrator:vagrant

  • vagrant:vagrant

  • IIS can execute .asp files

  • Generate an .asp reverse shell payload and upload it with FTP

  • Back to the msfconsole session tab

  • Open the browser and navigate to

    • 10.2.29.246/shell.aspx

  • In this case the reverse shell don't work.

  • The next step of an attacker can be to deface the website - modifying the web application

Obtain the new target IP if the lab was restarted.

Target IP: 10.2.16.83

Based on the FTP Enumeration:

  • administrator:vagrant

  • vagrant:vagrant

  • Brute-force SSH

  • User SSH login can be tried

  • Obtain a Meterpreter session

  • Back on the SSH session

Target IP: 10.2.26.45

Based on the FTP & SSH Enumeration:

  • administrator:vagrant - FTP

  • vagrant:vagrant - FTP + SSH

  • Brute-force SMB

  • Enumerate shares

  • Enumerate others system user accounts

enum4linux
  • Enumerate users with MSF

  • In a new terminal, use psexec.py to try SMB authentication

psexec - elevated cmd
  • Obtain a Meterpreter session with MSF

Elevated meterpreter session
  • If no account credentials can be found, use the EternalBlue vulnerability exploit since the system target is a Win Server 2008 R2

MySQL

  • Search for MySQL exploits

  • Brute-force MySQL

📌 root password is empty

  • Change admin WordPress user's password

DO NOT Change passwords in a real pentest

  • Access via browser

    • http://10.2.26.45:8585/wordpress/wp-admin

  • Try to gain access to phpMyAdmin using MSF

    • Access the target through SMB and modify phpMyAdmin configuration file

  • Move into the wamp folder

  • Change WordPress admin password

phpmyadmin.conf
  • Access phpMyAdmin

    • http://10.2.26.45:8585/phpmyadmin/

    • it automatically logs in since the root password is null

phpMyAdmin

DO NOT Change passwords in a real pentest


Last updated

Was this helpful?