+ All Categories
Home > Technology > Mind the gap - Troopers 2016

Mind the gap - Troopers 2016

Date post: 14-Jan-2017
Category:
Upload: casey-smith
View: 2,266 times
Download: 0 times
Share this document with a friend
68
Mind The Gap Exploit Free Whitelisting Evasion Tactics Casey Smith @subTee
Transcript
Page 1: Mind the gap  - Troopers 2016

Mind The GapExploit Free Whitelisting Evasion TacticsCasey Smith @subTee

Page 2: Mind the gap  - Troopers 2016

C:\> whoami /all

USER INFORMATION --------------------Banker By Day

Red Team Lead

Page 3: Mind the gap  - Troopers 2016

This talk seeks to explore the gaps in Application Whitelisting.

Page 4: Mind the gap  - Troopers 2016

Trusted Applications Can Circumvent Whitelisting Constraints

Page 5: Mind the gap  - Troopers 2016

Architecture

Path Rules

.NET

Scripting

Emerging Strengths

Page 6: Mind the gap  - Troopers 2016

Understand:

How Your Defenses Work

& Where They Fail

Page 7: Mind the gap  - Troopers 2016

Why Exploit Free?

Exploits can be patched…

Architecture flaws cannot.

Page 8: Mind the gap  - Troopers 2016

“…designed to protect against unauthorized and malicious programs executing on a computer.”

Page 9: Mind the gap  - Troopers 2016

How is this implemented?

Page 10: Mind the gap  - Troopers 2016

Kernel Mode Minifilter Drivers

Page 11: Mind the gap  - Troopers 2016
Page 12: Mind the gap  - Troopers 2016

Minifilter/Event Monitor

Decision Support/Approval

User Mode

Kernel Mode

Page 13: Mind the gap  - Troopers 2016

Trust DecisionsPathPublisher (Certificate)Hash

Page 14: Mind the gap  - Troopers 2016

Attacking Weak Path Rules

Page 15: Mind the gap  - Troopers 2016

Vote For Your Favorite Path Rule

C:\Windows\*

C:\Windows\TempC:\Windows\Tasks

Page 16: Mind the gap  - Troopers 2016

Vote For Your Favorite Path Rule

C:\Windows\System32\*

C:\Windows\System32\Spool\Drivers\Color

Page 17: Mind the gap  - Troopers 2016

Test and Validate & Limit/Avoid Path Rules

Page 18: Mind the gap  - Troopers 2016

J

Page 19: Mind the gap  - Troopers 2016

Demonstration One:

AppLocker Default Rules

Page 20: Mind the gap  - Troopers 2016

.NET Utilities & Tactics

Page 21: Mind the gap  - Troopers 2016

Installed by default

All Signed Microsoft binaries trusted as a matter of convenience…

Page 22: Mind the gap  - Troopers 2016

“…An attacker, on the other hand, is more interested in what an application can be made to do and operates on the principle that "any action not specifically denied, is allowed".” – OWASP Secure Coding Practices

Page 23: Mind the gap  - Troopers 2016

See Also: Kernel-based monitoring on Windows (32/64 bit) – Florian Rienhardthttp://www.bitnuts.de/KernelBasedMonitoring.pdf

Page 24: Mind the gap  - Troopers 2016

Proof of Concept Driver“Soteria”

Page 25: Mind the gap  - Troopers 2016

The guidance provided is simply NOT going to catch some .NET execution events.

Page 26: Mind the gap  - Troopers 2016

Installed By Default

•InstallUtil.exe•Regasm.exe

Signed By MicrosoftNo Admin Rights Required To Execute

Page 27: Mind the gap  - Troopers 2016

These Utilities Accept ANYAssembly as Input

This is the designed behavior

Page 28: Mind the gap  - Troopers 2016

Regasm.exe

MyBad.dll

Page 29: Mind the gap  - Troopers 2016

In order to raise awareness…

I wrote some tools, Proof Of Concept

Page 30: Mind the gap  - Troopers 2016

InstallUtil.exe

Page 31: Mind the gap  - Troopers 2016
Page 32: Mind the gap  - Troopers 2016

C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /U katz.exe

C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe /out:katz.exe /unsafe katz.cs

Page 33: Mind the gap  - Troopers 2016

Demonstration Two:

Mimikatz Inside InstallUtil.exe

Page 34: Mind the gap  - Troopers 2016

InstallUtil Bypass in Metasploit J

Page 35: Mind the gap  - Troopers 2016

RegAsm.exe

Page 36: Mind the gap  - Troopers 2016
Page 37: Mind the gap  - Troopers 2016

You need Admin rights to register an assembly

If not?

Unregister function works J

Page 38: Mind the gap  - Troopers 2016

Demonstration Three:

Shellcode Via Regasm.exe

Page 39: Mind the gap  - Troopers 2016

Scripting Languages

Page 40: Mind the gap  - Troopers 2016

Dllhost.exe

Page 41: Mind the gap  - Troopers 2016

Admin Rights Required For This

Blend in with the noise…

Page 42: Mind the gap  - Troopers 2016
Page 43: Mind the gap  - Troopers 2016

Poweliks Emulation:

rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";o=new%20ActiveXObject("JS");o.Exec();

Page 44: Mind the gap  - Troopers 2016
Page 45: Mind the gap  - Troopers 2016

Whitelisting does NOT prevent exploitation of trusted applications

Page 46: Mind the gap  - Troopers 2016

Examples:

BrowserOfficeJavaPDF Readers

Page 47: Mind the gap  - Troopers 2016

Consider Exploit Mitigation:

Microsoft EMET Can Be Highly Effective

Enhanced Mitigation Experience Toolkit

Page 48: Mind the gap  - Troopers 2016

Demonstration Four – Part 1:

EMET Protecting Excel Spreadsheet

Page 49: Mind the gap  - Troopers 2016

MSHTA.EXE

An HTA executes without the constraints of the browser security model; in fact, it executes as a "fully trusted" application.

Page 50: Mind the gap  - Troopers 2016

MSHTA.exe

Spawns Excel

Executes Macro

Page 51: Mind the gap  - Troopers 2016

Demonstration Four – Part 2: EMET 5.5 Evasion via HTA/VBA Custom Shellcode

Thanks To: Josh Pitts@midnite_runr

Page 52: Mind the gap  - Troopers 2016

EAF = Export Address Table Filtering

I’m running a macro.

I do not need to scan EAT to locate addresses for LoadLibraryA, GetProcAddress

Page 53: Mind the gap  - Troopers 2016

Evasion Internals – If We Have Time.

Page 54: Mind the gap  - Troopers 2016

Base Address GetProcAddress LoadLibraryA

Page 55: Mind the gap  - Troopers 2016

Memory Base: 089a0000

Page 56: Mind the gap  - Troopers 2016

GetProcAddress: 76d1cc94

Page 57: Mind the gap  - Troopers 2016

LoadLibraryA: 76d1dc65

Page 58: Mind the gap  - Troopers 2016

Just move lookups into VBA instead of ASM.

Page 59: Mind the gap  - Troopers 2016

Conclusion – 7 Slides Remaining

Page 60: Mind the gap  - Troopers 2016

Why Should We Consider Application Whitelisting at all?

What does all this mean?

Page 61: Mind the gap  - Troopers 2016

Whitelisting Works

•Forces Adversaries to Re-Tool/ Burn Tradecraft• Increases visibility

• Increases Noise/Tracks Attackers Generate•Removes an entire class of attacks

Download and Execute For Example

Page 62: Mind the gap  - Troopers 2016

New Directions – Emerging Strengths

•Windows 10 Device Guard• Virtualization Based Security | Hypervisor Layer• Provides For User Mode Code Integrity (UMCI)• Caveat… Not Trivial To Configure/Deploy

• PowerShell ConstrainedLanguage Mode

Page 63: Mind the gap  - Troopers 2016

http://www.alex-ionescu.com/blackhat2015.pdf

References: http://blogs.technet.com/b/ash/archive/2016/03/02/windows-10-device-guard-and-credential-guard-demystified.aspx

Page 64: Mind the gap  - Troopers 2016

Understand Where Gaps Exist:

•Script Engines

•“Living Off The Land” –•Misuse of trusted ApplicationsOffice, .NET, WMI, PowerShell etc…

•Memory Residence/Injection

Page 65: Mind the gap  - Troopers 2016

Common Arguments AgainstWhitelisting Defenses

•Too difficult…• Take it in steps, start with your most static

machines.

• It does not stop everything…• No defense is perfect. None. • Run it in Log Mode if nothing else…• Get the visibility on Endpoint executions and

new binaries.

Page 66: Mind the gap  - Troopers 2016

Thank You!

Page 67: Mind the gap  - Troopers 2016

References

•https://github.com/subTee/Troopers2016

Special Thanks:•Florian Rienhardt

http://bitnuts.de/

Page 68: Mind the gap  - Troopers 2016

Questions? Feedback?

Please don’t hesitate to contact me

Casey Smith@subTee


Recommended