2. Lay of the land - Initial enumeration

AV / EDR / Network / AppLocker

Cannot function / react effectively without an understanding of surroundings. When we land on a win/linux system intending to privesc there are a few things we should always look at.

Network information Crucial part of enumeration. Consider host may be dual-homed - host/server belongs to two/more different networks

Gather info about local domain if part of AD - including IP addrs of domain controllers. Important to use arp and view arp cache to view other hosts the host has recently communicated with. This could help with lateral movement after obtaining credentials.

ipconfig /all

arp -a

route print

Enumerating protections Most modern environments have some sort of AV or EDR Public PoCs or tools are likely to be caught Enumerating protections help us ensure we're using methods that aren't being blocked - help us craft custom payloads or modify tools before using them.

Orgs common use app whitelisting to control kinds of apps / files certain users can run. i.e. blockign non-admin from running cmd.exe or powershell.exe / other binaries and filetypes not needed for day-to-day work. Popular solution is AppLocker https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/applocker/applocker-overview

GetAppLockerPolicy https://docs.microsoft.com/en-us/powershell/module/applocker/get-applockerpolicy?view=windowsserver2019-ps usage to enumerate local, effective, and domain policies

In realworld engagement client will have protections that detect the most common tools/scripts (including tools listed in tool section) There are ways to deal with this and enumerating the protections in use can help us modify our tools in a lab env and test them before using against a client system. Some EDR tools detect on / block usage of common binaries like net.exe , tasklist, etc. Orgs may restrict binaries a user can run + immediately flag suspicious activity - EX: accountant machine showing binaries being run via cmd.exe for example. Early enum is key to deep understanding of client env and workaround against common av/edr can save us time during non-evasive engagement

Check Windows Defender status

Get-MpComputerStatus
...
RealTimeProtectionEnabled       : False

List AppLocker rules

Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections

Test AppLocker Policy

Get-AppLockerPolicy -Local | Test-AppLockerPolicy -path C:\Windows\System32\cmd.exe -User Everyone

Differences between administrator level users

Account Type Description
NT AUTHORITY\SYSTEM (LocalSystem) A highly privileged account with more privileges than a local administrator. It is used to run most Windows services. Learn more.
Built-in Administrator Some organizations disable this account, but many do not. It is often reused across multiple systems in a client environment.
Local Administrators Group Member Any local account in this group has the same privileges as the built-in Administrator account.
Standard Domain User in Administrators Group A non-privileged domain user who has local administrator rights.
Domain Admin in Administrators Group A highly privileged domain account that has local administrator rights.
Vital to: uncover details relating to the OS version, patch level, installed software, current privileges, group memberships, and more - not an exhaustive list.

Windows command reference for performing manual enumeration tasks https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

Key points

Inspecting running processes

tasklist /svc

Become familiar with standard windows processes as well: smss.exe https://en.wikipedia.org/wiki/Session_Manager_Subsystem The manager is responsible for starting the kernel and user modes of the Win32 subsystem. csrss.exe https://en.wikipedia.org/wiki/Client/Server_Runtime_Subsystem provides the user mode side of the Win32 subsystem. In modern versions of Windows, it is primarily involved with process and thread management, console window handling, side-by-side assembly loading and the shutdown process. WinLogon.exe https://en.wikipedia.org/wiki/Winlogon responsible for handling the secure attention sequence, loading the user profile on logon, creates the desktops for the window station, and optionally locking the computer when a screensaver is running (requiring another authentication step) Local Security Authority Subsystem LSASS https://en.wikipedia.org/wiki/Local_Security_Authority_Subsystem_Service responsible for enforcing the security policy on the system. It verifies users logging on to a Windows computer or server, handles password changes, and creates access tokens.[2] It also writes to the Windows Security Log. Service Host https://en.wikipedia.org/wiki/Svchost.exe can host one or more Windows services in the Windows NT family of operating systemsSvchost is essential in the implementation of shared service processes, where a number of services can share a process in order to reduce resource consumption Other processes such as MsMpEng.exe, Windows Defender, are interesting because they can help us map out what protections are in place on the target host that we may have to evade/bypass.

Being able to spot std process/svcs will speed up enum and hone in on non-standard processes that stick out. Example in tasklist output above - seeing FileZilla is a telltale process that sticks out for further enumeration

Environment variables

set

Not uncommon for admins to modify PATH. Common example is to place python / java in path allowing exec of python/jars. If folder placed in path is writable by user its possible to perform DLL injections against other applications.
When running a program windows looks for that program in CWD first - then PATH going left to right

Set can also provide HOME DRIVE - in enterprises often a fileshare. Navigating to fileshare itself may reveal other directories that can be accessed. Not uncommon to access IT Dir containing inventory spreadsheet including passwords. Shares also utilized for homedirs so user can logon to other computers and have the same experience/files/desktop etc (Roaming Profiles) https://docs.microsoft.com/en-us/windows-server/storage/folder-redirection/folder-redirection-rup-overview If file placed in USERPROFILE\AppData\Microsoft\Windows\Start Menu\Programs\Startup when user logs into diff machine this file will execute.

Detailed configuration information systeminfo cmd shows if box has been patched / if it is a VM. If not patched recently getting admin level access may be as simple as running a known exploit. Google KBs installed under HotFixes and get an idea of patching. Not always present, possible to hide hotfixes from nonadmins. If box not restarted for other 6months chances are its also not patched.

wmic qfe

Powershell version of above:

Get-HotFix | ft -AutoSize

Installed programs

wmic product get name

WMI can also be used to check installed software. Run LaZagne to check stored creds for those apps are installed. Some prog may be installed + running as vuln svc

Get-WmiObject -Class Win32_Product |  select Name, Version

Display running processes netstat display active tcp/udp connections giving us better idea of what svcs listening on which ports both locally + accessible to outside.

netstat -ano

User/group info

Member of local admin group user dir may be browsable and contain pw files Logged-in Users:

query user

Check current user always: echo %USERNAME% If you already have access as service account you may have privileges like SeImpersonatePrivilege that can be abused to escalate privileges using a tool like JuicyPotato https://github.com/ohpe/juicy-potato

Current user privs whoami /priv Current group privs whoami /groups Get all Users net user Get all groups net localgroup Group info net localgroup administrators