SlideShare una empresa de Scribd logo
1 de 70
Descargar para leer sin conexión
CheckPlease -
Payload-Agnostic
Targeted Malware
@Arvanaghi & @ChrisTruncer
Brandon Arvanaghi
Associate Consultant at Mandiant
Red teaming, reverse engineering, tool developer
Vanderbilt University
2
Chris TruncerPrevious Sys Admin turned Red Team
West Coast Red Team Lead
Open Source Developer
Veil, EyeWitness, WMImplant
3
What’s this talk about?
▰ Evolution of antivirus
▰ A shift to behavioral detection
▰ Introduction to CheckPlease
▰ Walkthrough of various checks
▰ Use today :)
▰ Questions
4
Why?
We are not delivering ransomware.
5
Antivirus Evolution
From then to now
6
#avlol
AV Detection Methods
▰ Antivirus has existed for quite some time
▰ AV companies tried to solve the malware
problem with writing signatures
▻ Probably didn’t anticipate the cat and
mouse game
▰ Static signatures were effective
▻ For about 5 minutes
7
AV Detection Methods
▰ Automation helped, but static signature itself
isn’t effective
▻ Veil, anything custom, any other project
beats this
▰ Behavioral based detection came next
▻ What can a machine “observe” about
malware?
8
AV Detection Methods
▰ Behavioral based detection watches:
▻ Network traffic
▻ File creation/deletion
▻ Registry modifications
▻ Created/Killed processes
▻ etc.
9
AV Detection Methods
▰ Over time, AV started getting better at
reviewing malware written in “traditional”
languages
▻ C, C++, C#
▰ These were the languages they primarily saw,
so they had to build out this capability
10
And then… there were new methods
▰ However… malware started to be developed in
non-standard languages
▻ Python
▻ Ruby
▻ Go
▻ PowerShell
▻ Perl
▰ But why? 11
12
13
14
Simply changing
the language the
code is written in
completely bypassed
all signatures.
Cat and Mouse
▰ This is really similar to where we are today, a
game of cat and mouse
▻ Attackers strike, defenders detect,
attackers mod… goto one
▰ Signatures leads to new obfuscation
▰ Obfuscation leads to new signatures
15
A Decent Approach
▰ So let’s focus on dynamic analysis
▰ This is just the best way to do it right? Since it
sees everything.
16
The New Battleground
▰ Dynamic analysis is the new cat and mouse
battleground
▰ Malware developers attempt to check and see
if they are on the targeted system, or in a
sandboxed environment prior to malicious
execution
▻ If in a sandbox, just do some math and
that’s it
▰ So, where do we go from here? 17
Our Philosophy
▰ Fighting against static detection is the old
school cool
▰ Now, it’s even more important to write code
that runs on your target, and that alone
▻ The new cat and mouse!
18
CheckPlease
19
Languages Supported
▰ C
▰ C#
▰ PowerShell
▰ Python
▰ Go
▰ Ruby
▰ Perl 20
CheckPlease
21
CheckPlease
▰ Easily add new detection techniques
▰ Search the technique you want, choose from
the implementations
▻ Stack ‘em
22
Why multiple languages?
▰ Uptick in payload deliverance
▰ One language may not be caught
▰ Targeting malware per system
▰ Allows sandbox, AV vendors to better defend
23
CheckPlease
▰ So, we’ve talked about this a lot, but what is
CheckPlease actually doing?
▰ Let’s talk techniques
24
Daddy Issues
25
Parent Process
▰ Every time we launch a payload, we know
exactly what the parent process should be!
▻ Word document?
▻ PDF document?
▻ HTA application?
▰ But we won’t know the ppid
▻ What most languages support finding
26
Parent Process: Python
27
Parent Process: PowerShell
28
Sleeping
I’m tired
29
Payload Sleeping
▰ This is what a lot of people try first
▰ Make your payload sleep an hour
▻ No sandbox would observe for an hour
▻ Resources aren’t infinite
▰ Should work right?
▻ Wrong
30
Payload Sleeping
▰ Sandbox devs know this too
▻ They will look for sleep calls in a payload,
and hook them
▻ Sleep calls can be fast-forwarded
▻ Next steps will be immediately executed
▰ So… how to beat this?
31
Payload Sleeping
▰ Outsource the time validation with NTP
servers
▻ Make a request to a NTP server for current
time
▻ Attempt to sleep for attacker-defined
period
▻ Make another request for time from NTP
server 32
Payload Sleeping
▰ Now, just compare the two times!
▻ If we expect our malware to sleep for 30
seconds, did it?
▻ If so, then maybe we’re not in a sandbox!
▻ If not, then it’s highly likely we are in a
sandbox :(
33
Payload Sleeping
▰ If the payload thinks it is in a sandbox, then do
something innocuous and exit
▰ Otherwise, run the rest of your code!
34
Payload Sleeping
▰ Alternative Option?
▻ Create functions that can reliably take a
select period of time
▻ Use those to avoid any sleep calls
35
Payload Sleeping
36
User Interaction
We all love users :)
37
Working with Users
▰ What’s normal activity on user workstations?
▻ Users browsing web pages
▻ Files in certain folders
▻ Using a mouse to navigate their
workstation
38
Working with Users
▰ So let’s take normal activity, and make
“indicators of users” for them
▰ We want to validate evidence of normal user
activity vs. a system designed to run an
unknown file
39
What should we look for?
▰ Mouse Clicks!
▻ These can be a decent indicator of user
activity
▰ Specify a minimum number of clicks before
executing the payload
40
Python: Mouse Clicks
41
What should we look for? Mouse Position
▰ Mouse Position!
▻ You move your mouse from time to time,
don’t you?
▻ Sandboxes might not.
▻ Check the x and y coordinates of the
mouse, wait, then check again
42
Go: Mouse Position
43
What should we look for?
▰ Web Browsers!
▻ How many web browsers do people
normally have?
▻ Internet Explorer
▻ Edge
▻ Chrome?
▻ Check the number of browsers 44
PowerShell: Web Browsers
45
What should we look for?
▰ What about USB drives?
▻ Likely that most people have used USB
drives on their system
▻ Make a check for the number of USB
drives in a computer
46
Ruby: USB Device History
47
Targeted Code
Host Metadata
48
Targeted Code
▰ We’ve looked at:
▻ Programmatic bypasses
▻ User behavior
▰ Now, let’s look at host machine metadata
49
Targeted Code
▰ Why make malware very targeted? It stops the
spread!
▻ Well, that’s one benefit
▻ If we’re not specifically on the host we’re
targeting, ideally it won’t run
▻ Sandbox may not be able to trigger the
malicious code
▰ Phish for information about your targets! 50
Targeted Code - Dlls
▰ Check for known sandbox dlls
▻ There’s a bunch of dlls that we can search
for
▻ Vmcheck.dll
▻ Wpespy.dll
▻ Many more...
▻ If we find one, it might be on a system we
don’t want to run our code 51
Targeted Code - Dlls
52
Targeted Code - MAC
▰ MAC Addresses are easy to obtain
▰ Enumerate the MAC address of the local
system
▰ Write code that only runs on a system with a
specific payload
53
Targeted Code - MAC
54
Targeted Code - UTC Time Zone
▰ What time zone do you expect the targeted
system to use?
▰ UTC may be used by various sandboxes
▰ Check to make sure our code isn’t running in a
system using UTC
55
Targeted Code - UTC Time Zone
56
Targeted Code - Process Names
▰ We can write code that easily enumerates
currently running processes on the system
▰ Why not check for processes we don’t running
while our own code is?
▻ Wireshark
▻ Vmware
▻ Process Explorer
▻ tcpview 57
Targeted Code - Process Names
58
Targeted Code - Disk Space
▰ You can reasonably assume that modern
computer systems have a large amount of
hard drive space
▻ At least 50?
▻ At least 100?
▻ At least 250?
▰ Validate your best guess!
59
Targeted Code - Disk Space
60
Windows Updates
▰ Number of installed Windows updates can tell
you about…
▻ Computer usage
▻ How often computer is restarted
▰ A real user updates more often than a poser
61
Windows Updates: PowerShell
62
Registry Size
▰ Do you know the rough size of the registry on
your system?
▻ We have a decent idea of where the size
should be
▻ Compare these sizes!
63
Registry Size
64
CheckPlease
▰ There’s many more checks available:
▻ Domain Name
▻ System Hostname
▻ Anti-Debug
▻ FilePath Existence
▻ Registry Keys
▻ RAM size
▻ ...and many more
65
CheckPlease - The Point
▰ You can take any one of these checks, or chain
multiple together
▻ Make all checks pass in order for your code
to run
▻ If one fails, just be a simple calculator :)
66
CheckPlease - The Point
▰ Environment enumeration and help determine if
it is “safe”
▰ We’ve curated a large collection of checks that
can perform enumeration
▰ Just plug in what you want to search for, and
verify your environment!
67
CheckPlease & Veil
▰ This is a great opportunity to help Veil’s
codebase
▰ It allows users to take these checks and
instantly create targeted stagers
▰ Merge this code base into Veil!
68
CheckPlease
▰ CheckPlease is now available online
▻ https://github.com/Arvanaghi/CheckPlease
69
70
THANKS!
Any questions?
https://github.com/Arvanaghi/CheckPlease
@Arvanaghi & @ChrisTruncer

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil Framework
 
Bringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirusBringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirus
 
The Art of AV Evasion - Or Lack Thereof
The Art of AV Evasion - Or Lack ThereofThe Art of AV Evasion - Or Lack Thereof
The Art of AV Evasion - Or Lack Thereof
 
Breadcrumbs to Loaves: BSides Austin '17
Breadcrumbs to Loaves: BSides Austin '17Breadcrumbs to Loaves: BSides Austin '17
Breadcrumbs to Loaves: BSides Austin '17
 
Egress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data ExfiltrationEgress-Assess and Owning Data Exfiltration
Egress-Assess and Owning Data Exfiltration
 
The Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingThe Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while Persisting
 
AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0
 
Veil-Ordnance
Veil-OrdnanceVeil-Ordnance
Veil-Ordnance
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
 
Higher Level Malware
Higher Level MalwareHigher Level Malware
Higher Level Malware
 
The Veil-Framework
The Veil-FrameworkThe Veil-Framework
The Veil-Framework
 
Pen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and MorePen Testing, Red Teaming, and More
Pen Testing, Red Teaming, and More
 
Introduction to Dynamic Malware Analysis ...Or am I "Cuckoo for Malware?"
Introduction to Dynamic Malware Analysis   ...Or am I "Cuckoo for Malware?"Introduction to Dynamic Malware Analysis   ...Or am I "Cuckoo for Malware?"
Introduction to Dynamic Malware Analysis ...Or am I "Cuckoo for Malware?"
 
BSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathersBSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathers
 
Introduction to Penetration Testing
Introduction to Penetration TestingIntroduction to Penetration Testing
Introduction to Penetration Testing
 
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
 
Malware analysis
Malware analysisMalware analysis
Malware analysis
 
Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016
 
Metasploit for Penetration Testing: Beginner Class
Metasploit for Penetration Testing: Beginner ClassMetasploit for Penetration Testing: Beginner Class
Metasploit for Penetration Testing: Beginner Class
 
Масштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google ChromeМасштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google Chrome
 

Similar a CheckPlease: Payload-Agnostic Targeted Malware

Adversarial Post Ex - Lessons from the Pros
Adversarial Post Ex - Lessons from the ProsAdversarial Post Ex - Lessons from the Pros
Adversarial Post Ex - Lessons from the Pros
sixdub
 

Similar a CheckPlease: Payload-Agnostic Targeted Malware (20)

From SLO to GOTY
From SLO to GOTYFrom SLO to GOTY
From SLO to GOTY
 
Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1
 
Safety Bot Guaranteed -- Shmoocon 2017
Safety Bot Guaranteed -- Shmoocon 2017Safety Bot Guaranteed -- Shmoocon 2017
Safety Bot Guaranteed -- Shmoocon 2017
 
Sensepost assessment automation
Sensepost assessment automationSensepost assessment automation
Sensepost assessment automation
 
Hogy néz ki egy pentest meló a gyakorlatban?
Hogy néz ki egy pentest meló a gyakorlatban?Hogy néz ki egy pentest meló a gyakorlatban?
Hogy néz ki egy pentest meló a gyakorlatban?
 
Sandbox detection: leak, abuse, test - Hacktivity 2015
Sandbox detection: leak, abuse, test - Hacktivity 2015Sandbox detection: leak, abuse, test - Hacktivity 2015
Sandbox detection: leak, abuse, test - Hacktivity 2015
 
Logging for Hackers - What you need to know to catch them
Logging for Hackers - What you need to know to catch themLogging for Hackers - What you need to know to catch them
Logging for Hackers - What you need to know to catch them
 
Test & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automatedTest & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automated
 
Windows logging workshop - BSides Austin 2014
Windows logging workshop - BSides Austin 2014Windows logging workshop - BSides Austin 2014
Windows logging workshop - BSides Austin 2014
 
Enabling effective hunt teaming and incident response
Enabling effective hunt teaming and incident responseEnabling effective hunt teaming and incident response
Enabling effective hunt teaming and incident response
 
Logging for hackers SAINTCON
Logging for hackers SAINTCONLogging for hackers SAINTCON
Logging for hackers SAINTCON
 
Mastering Microservices 2022 - Debugging distributed systems
Mastering Microservices 2022 - Debugging distributed systemsMastering Microservices 2022 - Debugging distributed systems
Mastering Microservices 2022 - Debugging distributed systems
 
Tech w23
Tech w23Tech w23
Tech w23
 
Debugging distributed systems
Debugging distributed systemsDebugging distributed systems
Debugging distributed systems
 
Adversarial Post-Ex: Lessons From The Pros
Adversarial Post-Ex: Lessons From The ProsAdversarial Post-Ex: Lessons From The Pros
Adversarial Post-Ex: Lessons From The Pros
 
Adversarial Post Ex - Lessons from the Pros
Adversarial Post Ex - Lessons from the ProsAdversarial Post Ex - Lessons from the Pros
Adversarial Post Ex - Lessons from the Pros
 
Windows Incident Response is hard, but doesn't have to be
Windows Incident Response is hard, but doesn't have to beWindows Incident Response is hard, but doesn't have to be
Windows Incident Response is hard, but doesn't have to be
 
JavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systemsJavaLand 2022 - Debugging distributed systems
JavaLand 2022 - Debugging distributed systems
 
GOTO night April 2022 - Debugging distributed systems
GOTO night April 2022 - Debugging distributed systemsGOTO night April 2022 - Debugging distributed systems
GOTO night April 2022 - Debugging distributed systems
 
Syed Ubaid Ali Jafri - Black Box Penetration testing for Associates
Syed Ubaid Ali Jafri - Black Box Penetration testing for AssociatesSyed Ubaid Ali Jafri - Black Box Penetration testing for Associates
Syed Ubaid Ali Jafri - Black Box Penetration testing for Associates
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

CheckPlease: Payload-Agnostic Targeted Malware

  • 2. Brandon Arvanaghi Associate Consultant at Mandiant Red teaming, reverse engineering, tool developer Vanderbilt University 2
  • 3. Chris TruncerPrevious Sys Admin turned Red Team West Coast Red Team Lead Open Source Developer Veil, EyeWitness, WMImplant 3
  • 4. What’s this talk about? ▰ Evolution of antivirus ▰ A shift to behavioral detection ▰ Introduction to CheckPlease ▰ Walkthrough of various checks ▰ Use today :) ▰ Questions 4
  • 5. Why? We are not delivering ransomware. 5
  • 7. AV Detection Methods ▰ Antivirus has existed for quite some time ▰ AV companies tried to solve the malware problem with writing signatures ▻ Probably didn’t anticipate the cat and mouse game ▰ Static signatures were effective ▻ For about 5 minutes 7
  • 8. AV Detection Methods ▰ Automation helped, but static signature itself isn’t effective ▻ Veil, anything custom, any other project beats this ▰ Behavioral based detection came next ▻ What can a machine “observe” about malware? 8
  • 9. AV Detection Methods ▰ Behavioral based detection watches: ▻ Network traffic ▻ File creation/deletion ▻ Registry modifications ▻ Created/Killed processes ▻ etc. 9
  • 10. AV Detection Methods ▰ Over time, AV started getting better at reviewing malware written in “traditional” languages ▻ C, C++, C# ▰ These were the languages they primarily saw, so they had to build out this capability 10
  • 11. And then… there were new methods ▰ However… malware started to be developed in non-standard languages ▻ Python ▻ Ruby ▻ Go ▻ PowerShell ▻ Perl ▰ But why? 11
  • 12. 12
  • 13. 13
  • 14. 14 Simply changing the language the code is written in completely bypassed all signatures.
  • 15. Cat and Mouse ▰ This is really similar to where we are today, a game of cat and mouse ▻ Attackers strike, defenders detect, attackers mod… goto one ▰ Signatures leads to new obfuscation ▰ Obfuscation leads to new signatures 15
  • 16. A Decent Approach ▰ So let’s focus on dynamic analysis ▰ This is just the best way to do it right? Since it sees everything. 16
  • 17. The New Battleground ▰ Dynamic analysis is the new cat and mouse battleground ▰ Malware developers attempt to check and see if they are on the targeted system, or in a sandboxed environment prior to malicious execution ▻ If in a sandbox, just do some math and that’s it ▰ So, where do we go from here? 17
  • 18. Our Philosophy ▰ Fighting against static detection is the old school cool ▰ Now, it’s even more important to write code that runs on your target, and that alone ▻ The new cat and mouse! 18
  • 20. Languages Supported ▰ C ▰ C# ▰ PowerShell ▰ Python ▰ Go ▰ Ruby ▰ Perl 20
  • 22. CheckPlease ▰ Easily add new detection techniques ▰ Search the technique you want, choose from the implementations ▻ Stack ‘em 22
  • 23. Why multiple languages? ▰ Uptick in payload deliverance ▰ One language may not be caught ▰ Targeting malware per system ▰ Allows sandbox, AV vendors to better defend 23
  • 24. CheckPlease ▰ So, we’ve talked about this a lot, but what is CheckPlease actually doing? ▰ Let’s talk techniques 24
  • 26. Parent Process ▰ Every time we launch a payload, we know exactly what the parent process should be! ▻ Word document? ▻ PDF document? ▻ HTA application? ▰ But we won’t know the ppid ▻ What most languages support finding 26
  • 30. Payload Sleeping ▰ This is what a lot of people try first ▰ Make your payload sleep an hour ▻ No sandbox would observe for an hour ▻ Resources aren’t infinite ▰ Should work right? ▻ Wrong 30
  • 31. Payload Sleeping ▰ Sandbox devs know this too ▻ They will look for sleep calls in a payload, and hook them ▻ Sleep calls can be fast-forwarded ▻ Next steps will be immediately executed ▰ So… how to beat this? 31
  • 32. Payload Sleeping ▰ Outsource the time validation with NTP servers ▻ Make a request to a NTP server for current time ▻ Attempt to sleep for attacker-defined period ▻ Make another request for time from NTP server 32
  • 33. Payload Sleeping ▰ Now, just compare the two times! ▻ If we expect our malware to sleep for 30 seconds, did it? ▻ If so, then maybe we’re not in a sandbox! ▻ If not, then it’s highly likely we are in a sandbox :( 33
  • 34. Payload Sleeping ▰ If the payload thinks it is in a sandbox, then do something innocuous and exit ▰ Otherwise, run the rest of your code! 34
  • 35. Payload Sleeping ▰ Alternative Option? ▻ Create functions that can reliably take a select period of time ▻ Use those to avoid any sleep calls 35
  • 37. User Interaction We all love users :) 37
  • 38. Working with Users ▰ What’s normal activity on user workstations? ▻ Users browsing web pages ▻ Files in certain folders ▻ Using a mouse to navigate their workstation 38
  • 39. Working with Users ▰ So let’s take normal activity, and make “indicators of users” for them ▰ We want to validate evidence of normal user activity vs. a system designed to run an unknown file 39
  • 40. What should we look for? ▰ Mouse Clicks! ▻ These can be a decent indicator of user activity ▰ Specify a minimum number of clicks before executing the payload 40
  • 42. What should we look for? Mouse Position ▰ Mouse Position! ▻ You move your mouse from time to time, don’t you? ▻ Sandboxes might not. ▻ Check the x and y coordinates of the mouse, wait, then check again 42
  • 44. What should we look for? ▰ Web Browsers! ▻ How many web browsers do people normally have? ▻ Internet Explorer ▻ Edge ▻ Chrome? ▻ Check the number of browsers 44
  • 46. What should we look for? ▰ What about USB drives? ▻ Likely that most people have used USB drives on their system ▻ Make a check for the number of USB drives in a computer 46
  • 47. Ruby: USB Device History 47
  • 49. Targeted Code ▰ We’ve looked at: ▻ Programmatic bypasses ▻ User behavior ▰ Now, let’s look at host machine metadata 49
  • 50. Targeted Code ▰ Why make malware very targeted? It stops the spread! ▻ Well, that’s one benefit ▻ If we’re not specifically on the host we’re targeting, ideally it won’t run ▻ Sandbox may not be able to trigger the malicious code ▰ Phish for information about your targets! 50
  • 51. Targeted Code - Dlls ▰ Check for known sandbox dlls ▻ There’s a bunch of dlls that we can search for ▻ Vmcheck.dll ▻ Wpespy.dll ▻ Many more... ▻ If we find one, it might be on a system we don’t want to run our code 51
  • 52. Targeted Code - Dlls 52
  • 53. Targeted Code - MAC ▰ MAC Addresses are easy to obtain ▰ Enumerate the MAC address of the local system ▰ Write code that only runs on a system with a specific payload 53
  • 54. Targeted Code - MAC 54
  • 55. Targeted Code - UTC Time Zone ▰ What time zone do you expect the targeted system to use? ▰ UTC may be used by various sandboxes ▰ Check to make sure our code isn’t running in a system using UTC 55
  • 56. Targeted Code - UTC Time Zone 56
  • 57. Targeted Code - Process Names ▰ We can write code that easily enumerates currently running processes on the system ▰ Why not check for processes we don’t running while our own code is? ▻ Wireshark ▻ Vmware ▻ Process Explorer ▻ tcpview 57
  • 58. Targeted Code - Process Names 58
  • 59. Targeted Code - Disk Space ▰ You can reasonably assume that modern computer systems have a large amount of hard drive space ▻ At least 50? ▻ At least 100? ▻ At least 250? ▰ Validate your best guess! 59
  • 60. Targeted Code - Disk Space 60
  • 61. Windows Updates ▰ Number of installed Windows updates can tell you about… ▻ Computer usage ▻ How often computer is restarted ▰ A real user updates more often than a poser 61
  • 63. Registry Size ▰ Do you know the rough size of the registry on your system? ▻ We have a decent idea of where the size should be ▻ Compare these sizes! 63
  • 65. CheckPlease ▰ There’s many more checks available: ▻ Domain Name ▻ System Hostname ▻ Anti-Debug ▻ FilePath Existence ▻ Registry Keys ▻ RAM size ▻ ...and many more 65
  • 66. CheckPlease - The Point ▰ You can take any one of these checks, or chain multiple together ▻ Make all checks pass in order for your code to run ▻ If one fails, just be a simple calculator :) 66
  • 67. CheckPlease - The Point ▰ Environment enumeration and help determine if it is “safe” ▰ We’ve curated a large collection of checks that can perform enumeration ▰ Just plug in what you want to search for, and verify your environment! 67
  • 68. CheckPlease & Veil ▰ This is a great opportunity to help Veil’s codebase ▰ It allows users to take these checks and instantly create targeted stagers ▰ Merge this code base into Veil! 68
  • 69. CheckPlease ▰ CheckPlease is now available online ▻ https://github.com/Arvanaghi/CheckPlease 69