CRTP writeup
CRTP writeup
In this assessment we are given the task to compromise (get OS command execution) on
five different boxes starting with a compromised low privilege Windows Server 2016 and a
set of credentials (user and password).
Tools used in this assignment as well as documentation are provided at the end of the
report.
We start by running Bloodhound’s ingestor on our initial machine because it will allow us to
easily visualize relationships to discover a path in lateral movements; also is a very handy
tool to keep track of compromised objects in the domain.
We transfer the result zip file into our local machine for Bloodhound to analyze.
User.GARRISON.CASTLE.LOCAL - Local Privilege Escalation
We start by elevating our privileges in the initial machine, this will allow us to compromise
other users that have logged in, we could also add a folder exception in windows defender to
download our tools (mimikatz, powerview, powerup, etc) and manage fluently further lateral
movements.
We load PowerUp.ps1 into the machine; this tool lets us enumerate common Windows
privilege escalation vectors based on misconfigurations. It also provides a function to easily
abuse the service based on the identified weakness.
The SensorDataService service is spotted as modifiable service, this means we (as user
examAd) have the rights to modify the binPath for the service, and also the service run as
LocalSystem, giving us elevated privileges.
We can abuse the service by running the next command and adding our user into the local
administrators group.
We log out and proceed to log in again so we can see the changes reflected.
With our new privileges we can add an exception in Windows Defender and download some
tools to ease lateral movement.
DEVSRV.GARRISON.CASTLE.LOCAL - Abuse through ReportUser SQL instance
We start enumerating our Active Directory, and we spot a SQL instance by using
PowerUpSQL.ps1; we check our access.
This command scans SPN looking for SQL services, and redirects its output to get basic
information about the server if found any.
The output shows us that we are not Sysadmin on the MSSQL Server so we can not
execute local commands (which is our main goal).
We connect via HeidiSQL, an open source GUI software that allows to connect to SQL
servers and manipulate information via queries.
By enumerating a bit more we encounter a new user that is currently logged in our machine.
As we are local administrator we can get this new user’s NTLM hash to impersonate it.
We run Invoke-Mimikatz.ps1 locally which allows us to grab NTLM hashes of users currently
logged in.
We can now impersonate this user by using its NTLM hash into Invoke-Mimikatz.
We can now check again SQL instances in our Domain (by using PowerUpSql.ps1 once
again) but as reportuser.
We are Sysadmin so we can execute command on the machine if there is no additional
restrictions. We execute HeidiSQL as the current user (reportuser) and we login into
devsrv.garrison.castle.local to enable xp_cmdshell.
With this new user a new tree of possibilities has open. We can load PowerView.ps1 into our
reverse shell to enumerate more. Let’s load the Invoke-ACLScanner function from
PowerView to get interesting ACLs that the devsqladmin has.
PowerView has the Add-NetGroupUser function that adds a user into a Group if we have the
privileges to do so. We execute the following command on the DEVSRV machine as
devsqladmin.
We (examAd user) are now part of the SQLManagers group. Let’s verify if we can access in
the UATSRV machine.
We can now run Invoke-Mimikatz on this new Session to get hashes of logged in users for
further lateral movement.
PRODSRV.GARRISON.CASTLE.LOCAL - Prodadmin’s password change by Batchuser
permit
In the last section we obtained uatadmin and batchuser’s hashes. Thanks to bloodhound we
can observe for any ACL this new users have.
Batchuser can change the password of Prodadmin without knowing its current password.
We can Invoke-Mimikatz to impersonate this user having its NTLM hash, so we can change
Prodadmin password and obtain its hash.
We are using Mimikatz even though we have batchuser’s password, because runas did not
worked on the assessment.
We load PowerView_dev.ps1 to execute the Set-DomainUserPassword function to abuse
this capability and set PRODADMIN’s password to “G@teTotheGarris0n!”.
As we have this password, we can generate a local NTLM hash to impersonate it.
The user serviceacct has a session into PRODSRV, but also it is part of the Administrators
Group in our domain GARRISON.
Users that are part of the Administrators Group can access the Domain Controller as local
administrators, please note that the Administrators Group is not the same as the Domain
Admin Group.
This means that the user serviceacct only has local administrator access in the
garrison-dc.garrison.castle.local (Domain Controller) but no other machine (like Domain
Admins do).
By abusing this last access into PRODSRV we can load Mimikatz and get serviceacct’s
NTLM hash for lateral movement.
We get serviceacct’s NTLM hash so we can now impersonate it to access the Domain
Controller.
As final step if we have local administrator privileges on the Domain Controller, we can dump
NTLM hashes of the users that have a session in.
By executing Invoke-Mimikatz into the Domain Controller we can grab Administrator’s NTLM
hash and get its privileges.
Please note that we have executed the following commands before Invoke-Mimikatz in every
computer:
Tools used
● PowerView.ps1 - Part of the powersploit’s recon suite. Powershell script with
functions to perform active directory enumeration.
https://github.com/PowerShellMafia/PowerSploit
https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon
● PowerUp.ps1 - Script that is part of the PowerSploit suite. It can enumerate common
Windows privilege escalation vectors based on misconfigurations. It also provides
easy abuse functions based on the identified weakness.
https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc
● HeidiSQL - Open source project to connect and manipulate most popular SQL
services.
https://www.heidisql.com/
● HFS - Open source web server to send and receive files over the network. It can host
several files so we can download them via Invoke-WebRequest.
https://www.rejetto.com/hfs/