330 Hunting Malware
330 Hunting Malware
330 Hunting Malware
Professional
Hunting Malware
S e c t i o n 0 3 | M o d u l e 0 3
© Caendra Inc. 2020
All Rights Reserved
Table of Contents
Introduction
This module will reveal that there are tools available to aid
you in your hunts.
Detection Tools
Here is the
output of the
command if
it finds code
injection:
To link the output from that tool and the output from
PowerShell Arsenal, we will run Reflective Injection
Detection again and capture the output. Afterward, we will
run the cmdlet Find-ProcessPEs from PowerShell Arsenal.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.31
3.2.5 Detection Tools – PowerShell Arsenal
This PowerShell tool can aid you on the hunt to detect code
injection. This tool will scan active threads on the system. It
will retrieve the starting address of certain functions, such
as NTQueryInformationThread, and if executable code is
found, it will flag it as injected.
We recommend you
conduct independent
research to fully
understand the
output from this tool.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.39
3.3
Detection
Techniques
• Will divide the file into smaller pieces and examine those
smaller pieces rather than the file as a whole.
https://ssdeep-project.github.io/ssdeep/index.html THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.43
3.3.1 Detection Techniques – Fuzzy Hashing
Virus Total uses SSDeep, which performs fuzzy hashing, against files that are
uploaded to the platform. The output from SSDeep is displayed when the
analysis of the uploaded file has completed.
http://dfrws.org/sites/default/files/session-files/paper-identifying_almost_identical_files_using_context_triggered_piecewise_hashing.pdf
https://dfir.science/2017/07/How-To-Fuzzy-Hashing-with-SSDEEP-(similarity-matching).html
https://github.com/ssdeep-project/ssdeep
The “imphash” technique has been coined by Mandiant, and it is yet another
technique implemented by Virus Total. It’s part of the output report displayed
when a sample has been analyzed, similar to SSDeep.
You can read more about this technique here and an open
source tool to generate PE Import Hashes here.
https://www.fireeye.com/blog/threat-research/2014/01/tracking-malware-import-hashing.html THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.48
https://github.com/Neo23x0/ImpHash-Generator
3.3.3 Detection Techniques – Execution Tracing
You can read more about how this tool can be used to
detect Temporal Execution Correlation, Time Stacking, etc.,
here.
Memory Analysis
https://accessdata.com/product-download/ftk-imager-version-4-2-0
https://my.comae.com/
https://www.magnetforensics.com/resources/magnet-ram-capture/
The next screen shot will show you the Redline interface
along with an explanation as to what MRI Scores are.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.71
3.4.1 Memory Analysis - Redline
Processes View
Note that this plugin will not include hidden processes in its
output!
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.99
3.4.2 Memory Analysis - Volatility
Output of “pstree”:
Injected areas that begin with the "MZ" file header are
especially interesting to us – denoting a Windows
executable file (which is the case on the picture on the next
slide). Of course, the injected area may contain
shellcode, which lacks the “MZ” header, and which requires
that the analyst further investigate to understand its
behavior and purpose.
Malware Analysis
We have covered:
✓ Various detection tools
✓ Various detection techniques
✓ Memory analysis tools
✓ The importance of malware analysis
RandomCode
https://github.com/abhisek/RandomCode/tree/master/Malware/Process
Meterpreter_Payload_Detection
https://github.com/DamonMohammadbagher/Meterpreter_Payload_Detection
PowerShellArsenal
https://github.com/mattifestation/PowerShellArsenal
NtQueryInformationThread function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684283(v=vs.85).aspx
Get-InjectedThread.ps1
https://gist.github.com/jaredcatkinson/23905d34537ce4b5b1818c3e6405c1d2
ssdeep
https://github.com/ssdeep-project/ssdeep
ImpHash-Generator
https://github.com/Neo23x0/ImpHash-Generator
appcompatprocessor
https://github.com/mbevilacqua/appcompatprocessor
FTK Imager
https://accessdata.com/product-download/ftk-imager-version-4-2-0
Comae Stardust
https://my.comae.com/
volatility
https://github.com/volatilityfoundation/volatility
Captain
https://github.com/y3n11/Captain
memhunter
https://github.com/marcosd4h/memhunter
Volatility Usage
https://github.com/volatilityfoundation/volatility/wiki/Volatility-Usage
yarascan
https://github.com/volatilityfoundation/volatility/wiki/Command-Reference-Mal#yarascan
Note that all videos are only available in Full or Elite Editions of the course.
To upgrade, click LINK.
*Labs are only available in Full or Elite Editions of the course. To ACCESS your labs, go to the course
in your members area and click the labs drop-down in the appropriate module line. To UPGRADE to
gain access, click LINK.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.149
Labs
Advanced Endpoint Hunting
Inside THP you will find two (2) distinct labs on advanced hacking techniques hunting at the
endpoint level. Specifically, you will learn how to hunt for process doppelganging, AMSI
bypasses, parent PID spoofing, reflective DLL injection, module stomping etc.
*Labs are only available in Full or Elite Editions of the course. To ACCESS your labs, go to the course
in your members area and click the labs drop-down in the appropriate module line. To UPGRADE to
gain access, click LINK.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.150
Labs
Hunting Malware Part 2
Your manager, Tony, received 2 memory files from another facility within the ISAC. These 2
memory files were from actual incidents that took place within their facility a few years ago.
Tony wants you to analyze them to see if you are able to analyze them for any signs of code
injection and/or a rootkit to prepare you to detect APT attacks.
Hunting Empire
Your manager, Tony, wants to make sure that you can detect the widely used attacking tool,
Empire. A hunting exercise has been scheduled, where you are tasked with detecting
Empire’s presence on an endpoint.
*Labs are only available in Full or Elite Editions of the course. To ACCESS your labs, go to the course
in your members area and click the labs drop-down in the appropriate module line. To UPGRADE to
gain access, click LINK.
THPv2: Section 03, Module 03 - Caendra Inc. © 2020 | p.151