SlideShare a Scribd company logo
“I Hunt Sys Admins”
(U) Will
@harmj0y
Version 2.0
$ whoami
● Security researcher and red teamer for the
Adaptive Threat Division of Veris Group
● Co-founder of the Veil-Framework and
founder of Veil’s PowerTools
● Cons:
o Shmoocon ‘14: AV Evasion with the Veil Framework
o Defcon ‘14: Veil-Pillage: Post-exploitation 2.0
o Derbycon ‘14: Passing the Torch: Old School Red
Teaming, New School Tactics?
What this is
● Ways to hunt for target users on Windows
domains
● Ya really, that’s it
● Will cover as many tools and technique for
doing this as I have time for
● Setting the stage
● Existing tools
o psloggedon.exe, netsess.exe, PVEFindADUser.exe,
netview.exe, Nmap, smbexec, Veil-Pillage
● Domain data sources
o homeDirectory, profilePath, event logs, email
headers, SPNs
● PowerShellz
o Sidenote: PowerShell WinAPI access
o PowerView
tl;dr
Setting the Stage
● This talk is from the “assume breach”
perspective
o i.e. assume foothold/access to a Windows domain
machine
● I’m also going to assume you know (more or
less) what users you’re targeting
● PowerShell methods are going to heavily
rely on PowerView
o https://github.com/veil-framework/PowerTools
User Hunting: Lateral Spread
● Most common:
o If you have a privileged account, or local admin
account, you want to figure out where high value
users are logged in
● Hunt -> pop box -> Mimikatz -> profit
● Knowing what users log in to what boxes
from where can give you a better
understanding of a network layout and
implicit trust relationships
“I Hunt Domain Admins”
“I Hunt Domain Admins”
“I Hunt Domain Admins”
User Hunting: Post DA
● Red teaming isn’t about access, it’s about
data and showing impact!
● Once you get privileged access (like domain
admin) there are likely specific targets you
might want to go after
● Think incident response teams, CEOs, the
linux team, database admins, etc.
Does the CEO Care?
How About Now?
Where my sysadmins at?
Finding your prey
Existing Tools
● Several tools have been written that allow
you to figure out who’s logged in where
● I’ll cover what’s already out there, including
the positives/negatives for each
● “Offensive in depth”
o You always want multiple ways of achieving the
same objective
● Component of Microsoft’s Sysinternals
o “...determines who is logged on by scanning the
keys under the HKEY_USERS key.”
o “To determine who is logged onto a computer via
resource shares, PsLoggedOn uses the
NetSessionEnum API.”
● Needs remote registry access to determine
who’s logged in
o i.e. admin privileges on a remote machine
http://technet.microsoft.com/en-us/sysinternals/bb897545.aspx
psloggedon.exe
psloggedon.exe
netsess.exe
● Component of
http://www.joeware.net/freetools/
● Utilizes the NetSessionEnum API call
o http://msdn.microsoft.com/en-
us/library/windows/desktop/bb525382(v=vs.85).aspx
● Think a version of “net session” that works
on remote machines!
o great for targeting file servers :)
o no admin privs needed!
netsess.exe
PVEFindADUser.exe
● Tool released by corelanc0d3r in 2009
● “Helps you find where AD users are logged in”
o Can also check who’s logged into specific machines
● But “...you also need to have admin access on
the computers you are running the utility
against.”
https://www.corelan.be/index.php/2009/07/12/free-tool-find-where-ad-users-are-logged-on-into/
PVEFindADUser.exe
netview.exe
● Rob Fuller’s (@mubix) netview.exe project,
presented at Derbycon 2012, is a tool to
“enumerate systems using WinAPI calls”
● Finds all machines on the network,
enumerates shares, sessions, and logged in
users for each host
o And now can check share access, highlight high
value users, and use a delay/jitter :)
o and also, no admin privs needed!
https://github.com/mubix/netview
netview.exe
Nmap
● If you have a valid domain account, or local
account valid for several machines, you can
use smb-enum-sessions.nse
● Don’t need to have admin privileges!
nmap -sU -sS --script smb-enum-
sessions.nse --script-args
'smbuser=jasonf,smbpass=BusinessBus
inessBusiness!' -p U:137,T:139
192.168.52.0/24
http://nmap.org/nsedoc/scripts/smb-enum-sessions.html
Nmap
Smbexec
● Awesome post-exploitation framework built
on top of patched Samba binaries
● The enumeration/checkda module can
check machines for domain admin
processes/sessions on particular targets
● However:
o requires local admin on the target machine
o only can target domain admins
Veil-Pillage
● Veil-Pillage is a post-exploitation framework
conceptually similiar to Smbexec
● The enumeration/domain/group_hunter
and enumeration/host/user_hunter
modules will do the same tasklist and
qwinsta process to hunt for specific target
groups
● However:
o requires local admin on the target machine
o but can target more than just domain admins
Domain Data Sources
“It’s a feature”
Active Directory Sources
● There are a few components of Active
Directory user objects that warrant interest
● homeDirectory
o path to a user’s auto-mounted home directory
● profilePath
o path to a user’s roaming profile
● Why?
o Enumerating remote sessions against common
network servers lots of people use gives an
excellent mapping of what users are where
Event Logs
● Sometimes you have DA, but need to target
specific users (think the IR team :)
● If you can query the event logs on a domain
controller, you can extract:
o logon type (interactive/network), account name,
source network address
● @sixdub rolled this into a PowerShell script,
which has since been incorporated into
PowerView, more on this later
http://sixdub.net/2014/11/offensive-event-parsing-bringing-home-trophies/
Email Headers
● If you have access to someone’s email
(Mimikatz+OWA, etc.) internal headers can
provide a wealth of information
● Search for any chains to/from target users,
and examine headers for given email chains
● If the “X-Originating-IP” header is present,
you can trace where a user sent a given
email from
Service Principal Names
● SPNs aren’t just for machines
● Registering a service to run on a machine
under a particular user account will register
that machine/service for that user in AD
o Makes a great place to check for users, all with a
single AD query
● Scott Sutherland (@_nullbind) has a great
article on this:
o https://blog.netspi.com/faster-domain-escalation-
using-ldap/
Manual Checks
● To find your targets:
o net user “Domain Admins” /domain
● To find your file servers:
o AdFind.exe -f "samAccountType=805306368" attr
homeDirectory | findstr /c:"homeDirectory"
● To find where your targets are:
o NetSess.exe FILESERVER
Wrapping in VBScript
● You can wrap some of these tools in some
basic VB script to automate it all up
● Run tool, filter for target users, etc.
● But why use VBScript, when you have...
PowerShell
“Microsoft’s Post-Exploitation Language”
-@obscuresec
PowerShellz
● PowerShell has some awesome AD hooks
and has various ways to access the lower-
level Windows API
● You can also access the lower-level Win32
API for interesting functions
○ NetSessionEnum for user sessions
○ NetWkstaUserEnum for logged on users
● Thanks @mattifestation for lots of ways to
access the underlying API functions!
Enumerating Targets
● PowerView has several functions that can
help you enumerate target users and hunt
them down
● Finding targets:
o Get-NetGroups *wildcard* will return groups
containing specific wildcard terms
o Get-UserProperties will extract all user property
fields
 often interesting field names!
o Invoke-UserFieldSearch will search particular user
fields for wildcard terms
Invoke-UserHunter
● Flexible function that:
o queries AD for hosts or takes a target list
o queries AD for users of a target group, or takes a
list/single user
o uses Win32 API calls to enumerate sessions
(NetSessionEnum) and logged in users
(NetWkstaUserEnum), matching against the target
user list
● Can also check to see if you have local
admin access on targets
o but no admin privs needed to get good info!
Invoke-UserHunter
Invoke-UserHunter
Invoke-UserView
● Several times on engagements we found
ourselves rerunning Invoke-UserHunter in
order to re-hunt for specific users
● This creates a lot of unnecessary noise
● Invoke-UserView will run the exact same
functions/checks that Invoke-UserHunter
does, but preserves all output for later
processing
Invoke-UserView
Invoke-StealthUserHunter
● Uses an old red teaming trick
1. Queries AD for all users and extracts all
homeDirectory fields to identify likely domain file
servers
2. Runs NetSessionEnum against each file server to
enumerate remote sessions, matching against target
user list
● Gets reasonable coverage with a lot less
traffic than UserHunter
o and again, no admin privs needed
Invoke-StealthUserHunter
Invoke-StealthUserHunter
Invoke-UserProcessHunter
● Utilizes the newly christened Get-
NetProcesses
o this function makes it easy to enumerate running
processes on remote machines
● You will need admin privileges on the
machines you’re enumerating
● Invoke-UserProcessHunter wraps this all
up into a weaponized form
Invoke-UserProcessHunter
Invoke-UserEventHunter
● Sometimes you have DA, but need to target
specific users (think the IR team :)
● Domain controller event logs make it trivial to
track down domain users, provided you have
domain admin access
● Get-UserLogonEvents implements
@sixdub’s work on offensive event parsing
o Invoke-UserEventHunt rolls this all into a
weaponized form
Invoke-UserEventHunter
Demo(s)
Shameless Sidebar
● Want to research cool stuff like this?
● Want to work with 13 x OSCPs and 3 x
OSCEs?
● Want to do some sweet red teaming?
● Hit me up to join Veris Group’s Adaptive
Threat Division
Questions?
● Contact me:
o @harmj0y
o will [at] harmj0y.net
o harmj0y in #veil and #armitage on Freenode
● Read more:
o http://blog.harmj0y.net
o https://www.veil-framework.com
● Get PowerView:
o https://github.com/Veil-Framework/PowerTools

More Related Content

PDF
Derbycon - The Unintended Risks of Trusting Active Directory
PPTX
(Ab)Using GPOs for Active Directory Pwnage
PDF
Hunting Lateral Movement in Windows Infrastructure
PDF
DerbyCon 2019 - Kerberoasting Revisited
PDF
Carlos García - Pentesting Active Directory Forests [rooted2019]
PDF
Attacker's Perspective of Active Directory
PPTX
Network protocols
PDF
Hunting for Credentials Dumping in Windows Environment
Derbycon - The Unintended Risks of Trusting Active Directory
(Ab)Using GPOs for Active Directory Pwnage
Hunting Lateral Movement in Windows Infrastructure
DerbyCon 2019 - Kerberoasting Revisited
Carlos García - Pentesting Active Directory Forests [rooted2019]
Attacker's Perspective of Active Directory
Network protocols
Hunting for Credentials Dumping in Windows Environment

What's hot (20)

PPTX
PSConfEU - Offensive Active Directory (With PowerShell!)
PPTX
Pentesting ReST API
PDF
aclpwn - Active Directory ACL exploitation with BloodHound
PDF
Red Team Methodology - A Naked Look
PDF
Carlos García - Pentesting Active Directory [rooted2018]
PPTX
Abusing Microsoft Kerberos - Sorry you guys don't get it
PDF
Not a Security Boundary
PDF
Hunting for Privilege Escalation in Windows Environment
PDF
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
PDF
The Unintended Risks of Trusting Active Directory
PPTX
Attacking thru HTTP Host header
PPTX
RACE - Minimal Rights and ACE for Active Directory Dominance
PPTX
Here Be Dragons: The Unexplored Land of Active Directory ACLs
PPTX
Red Team Revenge - Attacking Microsoft ATA
PPTX
Hot potato Privilege Escalation
PDF
Ace Up the Sleeve
PPTX
Pwning the Enterprise With PowerShell
PDF
An ACE in the Hole - Stealthy Host Persistence via Security Descriptors
PPTX
I Hunt Sys Admins
PDF
ReCertifying Active Directory
PSConfEU - Offensive Active Directory (With PowerShell!)
Pentesting ReST API
aclpwn - Active Directory ACL exploitation with BloodHound
Red Team Methodology - A Naked Look
Carlos García - Pentesting Active Directory [rooted2018]
Abusing Microsoft Kerberos - Sorry you guys don't get it
Not a Security Boundary
Hunting for Privilege Escalation in Windows Environment
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
The Unintended Risks of Trusting Active Directory
Attacking thru HTTP Host header
RACE - Minimal Rights and ACE for Active Directory Dominance
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Red Team Revenge - Attacking Microsoft ATA
Hot potato Privilege Escalation
Ace Up the Sleeve
Pwning the Enterprise With PowerShell
An ACE in the Hole - Stealthy Host Persistence via Security Descriptors
I Hunt Sys Admins
ReCertifying Active Directory
Ad

Similar to I hunt sys admins 2.0 (20)

PPTX
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamers
PDF
Ever Present Persistence - Established Footholds Seen in the Wild
PPTX
Derbycon - Passing the Torch
PPTX
Bridging the Gap
PPTX
Bridging the Gap: Lessons in Adversarial Tradecraft
PPTX
Wielding a cortana
PDF
Crikeycon 2019 Velociraptor Workshop
PDF
The State of the Veil Framework
PDF
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
PDF
Metasploit: Pwnage and Ponies
PDF
Veil-PowerView - NovaHackers
PDF
Black hat dc-2010-egypt-uav-slides
PPTX
PowerShell - Be A Cool Blue Kid
PDF
XP Days 2019: First secret delivery for modern cloud-native applications
PPTX
Owning computers without shell access dark
PDF
Ansible Automation to Rule Them All
PPTX
So you want to be a security expert
PPTX
drupal ci cd concept cornel univercity.pptx
PPT
Free tools for win server administration
PDF
Linux Server Deep Dives (DrupalCon Amsterdam)
Go Hack Yourself - 10 Pen Test Tactics for Blue Teamers
Ever Present Persistence - Established Footholds Seen in the Wild
Derbycon - Passing the Torch
Bridging the Gap
Bridging the Gap: Lessons in Adversarial Tradecraft
Wielding a cortana
Crikeycon 2019 Velociraptor Workshop
The State of the Veil Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Metasploit: Pwnage and Ponies
Veil-PowerView - NovaHackers
Black hat dc-2010-egypt-uav-slides
PowerShell - Be A Cool Blue Kid
XP Days 2019: First secret delivery for modern cloud-native applications
Owning computers without shell access dark
Ansible Automation to Rule Them All
So you want to be a security expert
drupal ci cd concept cornel univercity.pptx
Free tools for win server administration
Linux Server Deep Dives (DrupalCon Amsterdam)
Ad

More from Will Schroeder (19)

PDF
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
PDF
Nemesis - SAINTCON.pdf
PDF
Certified Pre-Owned
PDF
SpecterOps Webinar Week - Kerberoasting Revisisted
PPTX
Defending Your "Gold"
PPTX
Catch Me If You Can: PowerShell Red vs Blue
PDF
A Case Study in Attacking KeePass
PPTX
The Travelling Pentester: Diaries of the Shortest Path to Compromise
PDF
A Year in the Empire
PDF
Trusts You Might Have Missed - 44con
PDF
Building an EmPyre with Python
PPTX
PSConfEU - Building an Empire with PowerShell
PDF
I Have the Power(View)
PPTX
Building an Empire with PowerShell
PPTX
Trusts You Might Have Missed
PPTX
Drilling deeper with Veil's PowerTools
PPTX
Adventures in Asymmetric Warfare
PPTX
Pwnstaller
PPTX
PowerUp - Automating Windows Privilege Escalation
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Nemesis - SAINTCON.pdf
Certified Pre-Owned
SpecterOps Webinar Week - Kerberoasting Revisisted
Defending Your "Gold"
Catch Me If You Can: PowerShell Red vs Blue
A Case Study in Attacking KeePass
The Travelling Pentester: Diaries of the Shortest Path to Compromise
A Year in the Empire
Trusts You Might Have Missed - 44con
Building an EmPyre with Python
PSConfEU - Building an Empire with PowerShell
I Have the Power(View)
Building an Empire with PowerShell
Trusts You Might Have Missed
Drilling deeper with Veil's PowerTools
Adventures in Asymmetric Warfare
Pwnstaller
PowerUp - Automating Windows Privilege Escalation

Recently uploaded (20)

PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Internet___Basics___Styled_ presentation
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPT
tcp ip networks nd ip layering assotred slides
PDF
Testing WebRTC applications at scale.pdf
PPTX
Introduction to Information and Communication Technology
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PPTX
Digital Literacy And Online Safety on internet
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
international classification of diseases ICD-10 review PPT.pptx
INTERNET------BASICS-------UPDATED PPT PRESENTATION
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
SAP Ariba Sourcing PPT for learning material
Internet___Basics___Styled_ presentation
SASE Traffic Flow - ZTNA Connector-1.pdf
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Introuction about WHO-FIC in ICD-10.pptx
Cloud-Scale Log Monitoring _ Datadog.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline
WebRTC in SignalWire - troubleshooting media negotiation
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
tcp ip networks nd ip layering assotred slides
Testing WebRTC applications at scale.pdf
Introduction to Information and Communication Technology
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PptxGenJS_Demo_Chart_20250317130215833.pptx
Triggering QUIC, presented by Geoff Huston at IETF 123
Digital Literacy And Online Safety on internet
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
international classification of diseases ICD-10 review PPT.pptx

I hunt sys admins 2.0

  • 1. “I Hunt Sys Admins” (U) Will @harmj0y Version 2.0
  • 2. $ whoami ● Security researcher and red teamer for the Adaptive Threat Division of Veris Group ● Co-founder of the Veil-Framework and founder of Veil’s PowerTools ● Cons: o Shmoocon ‘14: AV Evasion with the Veil Framework o Defcon ‘14: Veil-Pillage: Post-exploitation 2.0 o Derbycon ‘14: Passing the Torch: Old School Red Teaming, New School Tactics?
  • 3. What this is ● Ways to hunt for target users on Windows domains ● Ya really, that’s it ● Will cover as many tools and technique for doing this as I have time for
  • 4. ● Setting the stage ● Existing tools o psloggedon.exe, netsess.exe, PVEFindADUser.exe, netview.exe, Nmap, smbexec, Veil-Pillage ● Domain data sources o homeDirectory, profilePath, event logs, email headers, SPNs ● PowerShellz o Sidenote: PowerShell WinAPI access o PowerView tl;dr
  • 5. Setting the Stage ● This talk is from the “assume breach” perspective o i.e. assume foothold/access to a Windows domain machine ● I’m also going to assume you know (more or less) what users you’re targeting ● PowerShell methods are going to heavily rely on PowerView o https://github.com/veil-framework/PowerTools
  • 6. User Hunting: Lateral Spread ● Most common: o If you have a privileged account, or local admin account, you want to figure out where high value users are logged in ● Hunt -> pop box -> Mimikatz -> profit ● Knowing what users log in to what boxes from where can give you a better understanding of a network layout and implicit trust relationships
  • 7. “I Hunt Domain Admins”
  • 8. “I Hunt Domain Admins”
  • 9. “I Hunt Domain Admins”
  • 10. User Hunting: Post DA ● Red teaming isn’t about access, it’s about data and showing impact! ● Once you get privileged access (like domain admin) there are likely specific targets you might want to go after ● Think incident response teams, CEOs, the linux team, database admins, etc.
  • 11. Does the CEO Care?
  • 13. Where my sysadmins at? Finding your prey
  • 14. Existing Tools ● Several tools have been written that allow you to figure out who’s logged in where ● I’ll cover what’s already out there, including the positives/negatives for each ● “Offensive in depth” o You always want multiple ways of achieving the same objective
  • 15. ● Component of Microsoft’s Sysinternals o “...determines who is logged on by scanning the keys under the HKEY_USERS key.” o “To determine who is logged onto a computer via resource shares, PsLoggedOn uses the NetSessionEnum API.” ● Needs remote registry access to determine who’s logged in o i.e. admin privileges on a remote machine http://technet.microsoft.com/en-us/sysinternals/bb897545.aspx psloggedon.exe
  • 17. netsess.exe ● Component of http://www.joeware.net/freetools/ ● Utilizes the NetSessionEnum API call o http://msdn.microsoft.com/en- us/library/windows/desktop/bb525382(v=vs.85).aspx ● Think a version of “net session” that works on remote machines! o great for targeting file servers :) o no admin privs needed!
  • 19. PVEFindADUser.exe ● Tool released by corelanc0d3r in 2009 ● “Helps you find where AD users are logged in” o Can also check who’s logged into specific machines ● But “...you also need to have admin access on the computers you are running the utility against.” https://www.corelan.be/index.php/2009/07/12/free-tool-find-where-ad-users-are-logged-on-into/
  • 21. netview.exe ● Rob Fuller’s (@mubix) netview.exe project, presented at Derbycon 2012, is a tool to “enumerate systems using WinAPI calls” ● Finds all machines on the network, enumerates shares, sessions, and logged in users for each host o And now can check share access, highlight high value users, and use a delay/jitter :) o and also, no admin privs needed! https://github.com/mubix/netview
  • 23. Nmap ● If you have a valid domain account, or local account valid for several machines, you can use smb-enum-sessions.nse ● Don’t need to have admin privileges! nmap -sU -sS --script smb-enum- sessions.nse --script-args 'smbuser=jasonf,smbpass=BusinessBus inessBusiness!' -p U:137,T:139 192.168.52.0/24 http://nmap.org/nsedoc/scripts/smb-enum-sessions.html
  • 24. Nmap
  • 25. Smbexec ● Awesome post-exploitation framework built on top of patched Samba binaries ● The enumeration/checkda module can check machines for domain admin processes/sessions on particular targets ● However: o requires local admin on the target machine o only can target domain admins
  • 26. Veil-Pillage ● Veil-Pillage is a post-exploitation framework conceptually similiar to Smbexec ● The enumeration/domain/group_hunter and enumeration/host/user_hunter modules will do the same tasklist and qwinsta process to hunt for specific target groups ● However: o requires local admin on the target machine o but can target more than just domain admins
  • 28. Active Directory Sources ● There are a few components of Active Directory user objects that warrant interest ● homeDirectory o path to a user’s auto-mounted home directory ● profilePath o path to a user’s roaming profile ● Why? o Enumerating remote sessions against common network servers lots of people use gives an excellent mapping of what users are where
  • 29. Event Logs ● Sometimes you have DA, but need to target specific users (think the IR team :) ● If you can query the event logs on a domain controller, you can extract: o logon type (interactive/network), account name, source network address ● @sixdub rolled this into a PowerShell script, which has since been incorporated into PowerView, more on this later http://sixdub.net/2014/11/offensive-event-parsing-bringing-home-trophies/
  • 30. Email Headers ● If you have access to someone’s email (Mimikatz+OWA, etc.) internal headers can provide a wealth of information ● Search for any chains to/from target users, and examine headers for given email chains ● If the “X-Originating-IP” header is present, you can trace where a user sent a given email from
  • 31. Service Principal Names ● SPNs aren’t just for machines ● Registering a service to run on a machine under a particular user account will register that machine/service for that user in AD o Makes a great place to check for users, all with a single AD query ● Scott Sutherland (@_nullbind) has a great article on this: o https://blog.netspi.com/faster-domain-escalation- using-ldap/
  • 32. Manual Checks ● To find your targets: o net user “Domain Admins” /domain ● To find your file servers: o AdFind.exe -f "samAccountType=805306368" attr homeDirectory | findstr /c:"homeDirectory" ● To find where your targets are: o NetSess.exe FILESERVER
  • 33. Wrapping in VBScript ● You can wrap some of these tools in some basic VB script to automate it all up ● Run tool, filter for target users, etc. ● But why use VBScript, when you have...
  • 35. PowerShellz ● PowerShell has some awesome AD hooks and has various ways to access the lower- level Windows API ● You can also access the lower-level Win32 API for interesting functions ○ NetSessionEnum for user sessions ○ NetWkstaUserEnum for logged on users ● Thanks @mattifestation for lots of ways to access the underlying API functions!
  • 36. Enumerating Targets ● PowerView has several functions that can help you enumerate target users and hunt them down ● Finding targets: o Get-NetGroups *wildcard* will return groups containing specific wildcard terms o Get-UserProperties will extract all user property fields  often interesting field names! o Invoke-UserFieldSearch will search particular user fields for wildcard terms
  • 37. Invoke-UserHunter ● Flexible function that: o queries AD for hosts or takes a target list o queries AD for users of a target group, or takes a list/single user o uses Win32 API calls to enumerate sessions (NetSessionEnum) and logged in users (NetWkstaUserEnum), matching against the target user list ● Can also check to see if you have local admin access on targets o but no admin privs needed to get good info!
  • 40. Invoke-UserView ● Several times on engagements we found ourselves rerunning Invoke-UserHunter in order to re-hunt for specific users ● This creates a lot of unnecessary noise ● Invoke-UserView will run the exact same functions/checks that Invoke-UserHunter does, but preserves all output for later processing
  • 42. Invoke-StealthUserHunter ● Uses an old red teaming trick 1. Queries AD for all users and extracts all homeDirectory fields to identify likely domain file servers 2. Runs NetSessionEnum against each file server to enumerate remote sessions, matching against target user list ● Gets reasonable coverage with a lot less traffic than UserHunter o and again, no admin privs needed
  • 45. Invoke-UserProcessHunter ● Utilizes the newly christened Get- NetProcesses o this function makes it easy to enumerate running processes on remote machines ● You will need admin privileges on the machines you’re enumerating ● Invoke-UserProcessHunter wraps this all up into a weaponized form
  • 47. Invoke-UserEventHunter ● Sometimes you have DA, but need to target specific users (think the IR team :) ● Domain controller event logs make it trivial to track down domain users, provided you have domain admin access ● Get-UserLogonEvents implements @sixdub’s work on offensive event parsing o Invoke-UserEventHunt rolls this all into a weaponized form
  • 50. Shameless Sidebar ● Want to research cool stuff like this? ● Want to work with 13 x OSCPs and 3 x OSCEs? ● Want to do some sweet red teaming? ● Hit me up to join Veris Group’s Adaptive Threat Division
  • 51. Questions? ● Contact me: o @harmj0y o will [at] harmj0y.net o harmj0y in #veil and #armitage on Freenode ● Read more: o http://blog.harmj0y.net o https://www.veil-framework.com ● Get PowerView: o https://github.com/Veil-Framework/PowerTools