Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation...

35
VetleØkland FINDING PRIVESC WITH PROCMON

Transcript of Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation...

Page 1: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Vetle Økland

FINDING PRIVESC WITH PROCMON

Page 2: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

::1

• Pentester @ Nagarro

• Live here in Oslo

• Too young to understand why Windows does anything

• Twitter: @bordplate

• Blog: https://bordplate.no/blog/en

Page 3: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

What is Procmon?Process Monitor

Page 4: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 5: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Boot logging

• Consider disabling anti-virus scanning for smaller log files

Page 6: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

What are we looking for?

Page 7: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 8: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Image from: https://krbtgt.pw/dacl-permissions-overwrite-privilege-escalation-cve-2019-0841/DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed

Page 9: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 10: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 11: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Paths and Files• PATH NOT FOUND

• NAME NOT FOUND

Both of these in a user-writable folder indicate you can influence the program.

Will wary based on file type and the program handling the files.

Image from a vulnerability found by Florian Bogner at bogner.sh: https://bogner.sh/2018/02/local-privilege-escalation-in-crashplans-windows-client/

Page 12: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

SetSecurityFile / Permission Overwrite

CVE-2019-8452 – Permission Overwrite

Page 13: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Hard links to any file

• Courtesy of James Forshaw from Google’s Project Zero

• Normal mklink tool does not allow hard links to files you don’t have write-access to

• ZwSetInformationFile does not enforce that check

• CreateHardLinkW does however

• Native-HardLink.ps1 from https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Native-HardLink.ps1 by @fuzzysec (Ruben Boonen)

Page 14: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Unquoted service paths

Page 15: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

DLL search order hijacking

Page 16: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Configuration

• Need to have local admin

Page 17: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Useful filters

• SYSTEM

• NAME NOT FOUND / PATH NOT FOUND

• SetSecurityFilter (by its own)

Page 18: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Exporting for other tools

• Exports to CSV and XML

• Exporting for XML with stack traces can create *really* big files

Page 19: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Exploring in Procmon

Page 20: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 21: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 22: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 23: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 24: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 25: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 26: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 27: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 28: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 29: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 30: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 31: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 32: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

Hunting in registry

• Not seen any potential for abuse

• Include SYSTEM user

• Exclude starting with HKLM and HKCU

Page 33: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files

AccessEnum

Page 34: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files
Page 35: Finding Privesc with Procmon - Bordplate · DACL Permissions Overwrite Privilege Escalation (CVE-2019-0841) by Nabeel Ahmed. Paths and Files