Windows & AD Hacking
Zero to Hero
Windows & AD Hacking
Zero to Hero*
*Only if you practice
About this talk
Warning
Warning (Translation)
NetExec (NXC)
"""
The network execution tool
Maintained as an open source project by @NeffIsBack, @MJHallenbeck, @_zblurx
For documentation and usage examples, visit: https://www.netexec.wiki/
"""
Protocols:
vnc, ssh, ftp, winrm, wmi, smb, mssql, rdp, ldap, nfs
NXC
sudo apt install pipx
pipx install git+https://github.com/Pennyw0rth/NetExec
pipx install git+https://github.com/ThePorgs/impacket
sudo apt install netexec
sudo apt install impacket
Impacket
Recon
Network Recon
Exploits that don't need credentials
Eternal Blue (CVE-2017-0144)
ZeroLogon (CVE-2020-1472)
SMB
Check SMB Auth
SMB Shares
Impacket's smbclient.py
SMB Password Spraying
Rid Brute
Null Auth
Command Execution??
LLMNR Background
Intro to Relay: SMB Share Relay with Responder
sudo Responder -I tun0
More about Relaying
Slinky Module
Coercion Exploits
PetitPotam
https://github.com/topotam/PetitPotam
ShadowCoerce (CVE 2022 30154)
How to auto-coerce
How to auto-coerce (pt2)
How to receive hashes
How to relay hashes
Exploits that need credentials
PrintNightmare (CVE-2021-1675, CVE-2021–34527, CVE-2021–34481)
Vulnerability that lets you use the print spooler (RPC) to remotely add printer drivers on the system as admin
This means you can execute arbitrary code as admin and become admin
noPac
Abuse Functions
How can we abuse this from Linux?
nxc smb <DC> -u <u> -p <p> -M nopac
python3 noPac.py domain.local/username:password -dc-ip $dcip -dc-host $dc01 --impersonate $userToImpersonate –dump
https://github.com/Ridter/noPac
LDAP
ldapsearch - getting the naming contexts
ldapsearch - searching
ldapsearch + bash magic
How to make it easier
How to make it EVEN easier
BloodHound
SharpHound & Bloodhound.py
.\SharpHound.exe -c All -d <domain>
python3 bloodhound.py -u validUser -p validPass -d domain.local -c All
Dangerous Privileges:
GenericAll - Full rights to the object (add users to a group or reset user's password)
GenericWrite - Update object's attributes (i.e logon script)
WriteOwner - Change object owner to attacker controlled user take over the object
WriteDACL - Modify object's ACEs and give attacker full control right over the object
AllExtendedRights - Add user to a group or reset password
ForceChangePassword - Change user's password
DCSync - Sync to the DC (can be used to grab domain credentials)
Kerberos
Kerberos Attacks
Two attacks that can let you steal password hashes and (maybe) crack them
AS-Reproasting (Before and After)
Kerberoasting (Before and After)
ADCS
ADCS
certipy find -u <u>@<domain> -p <p> -vulnerable -enabled
A certificate template is a blueprint of settings, options and permissions that can specified when generating a certificate.
Some Options Include:
SCCM
SCCM
https://www.thehacker.recipes/a-d/movement/sccm-mecm
Web
IIS RCE??
Other web
MSSQL
MSSQL
RDP: 3389 TCP
WinRM
evil-winrm
Post-Exploitation
Credentials!!!
TryHackMe
Local Privilege Escalation
Dangerous Privileges
More Privileges
Potato Attacks & SeImpersonatePrivilege
Unquoted Service Path
C:\Program.exe�C:\Program Files\A.exe�C:\Program Files\A Subfolder\B.exe�C:\Program Files\A Subfolder\B Subfolder\C.exe�C:\Program Files\A Subfolder\B Subfolder\C Subfolder\SomeExecutable.exe
Automating Findings
Questions?