microsoft ignite session: look under the hood: bypassing antimalware tactics and infrastructure...

29
Look under the hood: Bypassing antimalware tactics and infrastructure response methods Paula Januszkiewicz CQURE: CEO, Penetration Tester / Security Expert CQURE Academy: Trainer MVP: Enterprise Security, MCT Contact: [email protected] | http://cqure.us @paulacqure @CQUREAcademy

Upload: paula-januszkiewicz

Post on 05-Jan-2017

1.165 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Look under the hood: Bypassing antimalware tactics and infrastructure response methods

Paula JanuszkiewiczCQURE: CEO, Penetration Tester / Security ExpertCQURE Academy: TrainerMVP: Enterprise Security, MCTContact: [email protected] | http://cqure.us

@paulacqure @CQUREAcademy

Page 2: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”
Page 4: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Agenda

Intro

1

Evading Live Scenarios

32

Evading Techniques

4

Summary

Page 5: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

We have the best security solutions…

Page 6: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

…but the security landscape has changed.

Page 7: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo:SDDL - Can antivirus be stopped?

Page 8: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Techniques for malware discoverySignature-basedCan rely on the imphash" (uses library/API names and their specific order within the executable)

Behavior-based Attempts to open, view, delete, and/or modify filesAttempts to format disk drives and other unrecoverable disk operationsModifications to the logic of executable files, scripts of macrosModification of critical system settings, such as start-up settingsScripting of e-mail and instant messaging clients to send executable contentInitiation of network communications

Page 9: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

1- Evasion Techniques Used by Malware

WrappingAttaches the malicious payload (the installer or the malware itself) to a legitimate file. Tools:

Packers and EncryptorsTools used to compress and encode binary files. Packer will "unpack" the payload into memory and execute it.Tools and techniques: UPX, PECompact, Armadillo, Encoders (Metasploit), Hyperion

Page 10: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo: Hyperion

Page 11: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

2- Evasion Techniques Used by Malware

Anti-debuggingPrevents a binary from being analyzed in an emulated environments such security sandbox etc.Examples: ZeroAccess, sleep function.

ObfuscationModifies high level or binary code it in a way that does not affect its functionality, but changes its signature. Tools:

Page 12: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Reflective PE LoaderCustom code

User Mode LoadersExecutable is extracted and decrypted in memoryCode is loaded and executed dynamically In Powershell.exe – not every module is embedded – they can be created and loaded during the executionIn Win32API: Custom code mimics LoadLibrary()

Interesting: During the compilation, that’s what helps us:CompilerParameters.CompilerOptions = "/platform:x64";

Page 13: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo:Custom Reflective PE Loader - CQPELoader

Page 14: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

3- Evasion Techniques Used by MalwareTargetingUsed to:Attack a specific part of a system (IE, Firefox etc.), and act as one (Create Remote Thread etc.)

Detect specific settings (VMWare, Process Explorer running etc.) to prevent analysis. Typical examples are: Do not run if network card is Microsoft CorporationDo not run if wireshark.exe is workingDo not run if windbg.exe is running

Page 15: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Agenda

Intro

1

Evading Live Scenarios

32

Evading Techniques

4

Summary

Page 16: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo: Evasion Scenario

Page 17: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Scenario:

Attacker Victim

Firefox RCE+payload

Firefox GET

Connect 888

Remote session 888: download files

Remote session 888: SCHTASKS: elevate, 777Connect 777

Remote session 777: Infect WMI

Connect 666

Page 18: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

1. Attacker uses exploitable bug in the Firefox to remotely execute the code

2. Attacker uses the bug in Windows (MS16-032) to elevate from user to the Local System account

3. Attacker injects the script to the WMI repository

Scenario 1: Techniques used

Page 19: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

1. Intro: Script in the WMI Repository

2. It writes a file into the disc (source code

3. Source code is compiled to executable (EXE)

4. EXE is executed and it finds svchost.exe

5. EXE injects a payload into the svchost.exe

6. EXE calls CreateRemoteThread in svchost.exe to run a custom remote shell

Scenario 2: Techniques used

Page 20: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo: Execution through the debugger

Page 21: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

AMSIAntimalware Scan Interface (AMSI)It is a generic interface standard that allows applications and services to integrate with any antimalware product

Techniques usedIt supports a calling structure allowing for file and memory or stream scanning, content source URL/IP reputation checks, and other techniques

Allows correlation of eventsThe different fragments of a malicious payload can be associated to reach a more informed decision, which would be much harder to reach just by looking at those fragments in isolation.

Page 22: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo:AMSI in action

Page 23: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Demo:Sysmon

Page 24: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Agenda

Intro

1

Evading Live Scenarios

32

Evading Techniques

4

Summary

Page 25: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

Summary: Bypassing techniques and mitigations1. The only cure is a

_complete_ code execution prevention

2. Anti-Exploit solutions make a lot of sense

3. Sysmon (absolutely!) 4. At the end it is a matter of

budged and price5. Code execution prevention

solutions are often misconfigured

Page 27: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”
Page 29: Microsoft Ignite session: Look under the hood: bypassing antimalware tactics and infrastructure response method”

From your PC or Tablet visit MyIgnite at http://myignite.microsoft.com

From your phone download and use the Ignite Mobile App by scanning the QR code above or visiting https://aka.ms/ignite.mobileapp

Please evaluate this sessionYour feedback is important to us!