SlideShare a Scribd company logo
You need a PROcess to check your
running processes and modules.
The bad guys, and red teams are
coming after them!
Michael Gough – Principal NCC Group
Founder MalwareArchaeology.com
& IMFSecurity.com
MalwareArchaeology.com
Who am I
• Blue Team Defender Ninja, Malware Archaeologist, Logoholic and
Principal Incident Response Engineer for
• I love “properly” configured logs – they tell us Who, What, Where,
When and hopefully How
Creator of
“Windows Logging Cheat Sheet”
“Windows File Auditing Cheat Sheet”
“Windows Registry Auditing Cheat Sheet”
“Windows Splunk Logging Cheat Sheet”
“Windows ATT&CK Logging Cheat Sheet”
“ARTHIR – ATT&CK Remote Threat Hunting Incident Response tool”
• Co-Creator of “Log-MD” – Log Malicious Discovery Tool
• And co-host of “THE Incident Response Podcast”
MalwareArchaeology.com
Why this talk?
MalwareArchaeology.com
Because these can’t tell you enough
MalwareArchaeology.com
Or this
MalwareArchaeology.com
Fileless in memory only malware
• To address this expanding threat that is
becoming more and more common
– Too common
• Commodity malware, Red Team engagements,
and of course APT attackers use it
• This method can avoid many security tools
MalwareArchaeology.com
Let’s rethink or
redefine
Fileless Malware
MalwareArchaeology.com
Marketing- Scareware
• I get it, saying “Fileless” is an easy way to sum up
a threat for management, sales, products, etc. to
sum up and understand a new type of threat
• But for those of us having to deal with it from an
IR or Forensik perspective, we need more than
just the word “fileless”
• So let’s take a look at another more detailed way
to look at fileless malware that immediately tells
us something, and how to go about looking for it
MalwareArchaeology.com
https://conference.forensik.ca/
Rethinking Fileless Malware
• Fileless Malware that can only be found in the memory of a
running system (Malware + Memory = Memware)
• No files can be found if you scan the disk while the system
is running
– Or are very short lived, just long enough to load (bypasses FIM)
• Typical infection vectors are:
– Injection
– Dll side-loading/Hijacking
– Process Hollowing
– Download source code and compile on the fly, .NET, JSC
– User double-click, etc.
• “Fileless” malware, the file lives somewhere, so lets do a
better job guiding people where to look for signs of it
MalwareArchaeology.com
Other Fileless Malware types
• Regware – Malware payload is stored in the registry with an autorun/ASEP that
calls and loads it into memory (Malware + Payload in Registry = RegWare)
• WMIware - Malware payload is stored in the WMI database with an autorun/ASEP
that calls and loads it into memory (Malware + Payload in WMI database =
WMIWare)
• PowerShellware - Malware payload is in the form of PowerShell scripts,
downloaded or stored somewhere on the fly with an autorun/ASEP that calls and
loads it into memory (Malware + Payload in PowerShell = PowerShellWare)
• Compileware – Malware payload is not yet compiled, stored anywhere with an
autorun/ASEP that calls and loads it into memory (Malware + Payload compiled on
the fly = CompileWare)
• Downloadware – Autorun/ASEP calls out to the Internet to download malware
payload or source code that is then compiled and loads it into memory (Malware +
Payload downloaded each time = DownloadWare) maybe LOLBaSWare ;-)
MalwareArchaeology.com
Autoruns/ASEP
• Keep in mind…
– Not all malware will have an autorun/ASEP
• Latest TrickBot on Domain Controllers
• Especially the Red Team, doesn’t like to leave IOCs
– Or, the autorun is created on shutdown, then
deleted on startup once the malware loads
• Nothing found when doing live triage/analysis (Dridex)
– So what is in memory may be all that we can see
MalwareArchaeology.com
Latest TrickBot
MalwareArchaeology.com
PaloAlto Unit 42 - https://unit42.paloaltonetworks.com/goodbye-mworm-hello-nworm-trickbot-updates-propagation-module/
So how do we
find this stuff?
MalwareArchaeology.com
MITRE ATT&CK
• First - Everything you do should be mapped to
MITRE ATT&CK - https://attack.mitre.org/
• Some of the techniques used
– T1500 – Compile After Delivery
– T1127 - Trusted Developer Utilities
– T1055 – Process Injection
– T1196 – Control Panel Items
– etc
• Sub-techniques are here !!!
MalwareArchaeology.com
MITRE ATT&CK – Sub-techniques
• T1574 – Hijack Execution Flow
• 11 Sub-techniques
– 1574.002 - Dll side loading is just one of them
• T1055 – Process Injection
• 11 Sub-techniques
– 1055.002 – Portable Execution Injection
MalwareArchaeology.com
We need a PROcess
• We need to create a PROcess to start looking
for this condition
• Tools are just not preventing this technique
• We need to build this PROcess into our
hourly/daily/weekly/monthly routines to
detect and alert for this technique
• We need to build this PROcess into our
daily/weekly/monthly/yearly routines to
Threat Hunt for this technique
MalwareArchaeology.com
Canadian Andrew Hay
Two basic ways
1. Dump memory and analyze the memory
dump
– Use a tool like Volatility and all the plug-ins
2. Check running processes and their modules
for signs of additional (DLL) or injected code
– Use a tool like LOG-MD-Premium to scan a live
system for modifications to running processes and
their modules
MalwareArchaeology.com
Finding Memware
• Traditional forensics has us dumping a memory image
and running tools like Volatility against it
• Logs can contain a lot of details that can alert you to
this behavior, IF you collect THEN detect OR hunt
– Process command line is KEY to catching these attacks
• Checking running processes and their modules on a live
system is a GREAT option
– Better yet look for signs of injection !!
• Look for the other artifacts, autorun/ASEP, registry keys
storing scripts and/or payloads, WMI databases storing
scripts and/or payloads, and odd PowerShell, large
blocks, obfuscation, etc.
MalwareArchaeology.com
Signs of Injection
• What does this look like?
• A running process shows signs of additional or
replaced code
• This condition is detectable by a few tools
• And an obvious indicator of bad
• Yes, some system drivers will show up here too
MalwareArchaeology.com
Example LOG-MD-Premium
• -proc Check running processes & modules
• -md Exclude known good processes UNLESS there is
signs of injection
• -i List processes with signs of injection
• - b9 Static evaluate the file to determine malicious
likelihood and dump strings
• -vt Lookup the hashes of the modules for any
indications of known bad
• -x Dump all files that show signs of injection
MalwareArchaeology.com
Example LOG-MD-Premium
B9 module static file evaluation
• "B9 Result ":" 'Bad.exe', is likely suspicious
• Name":" Bad.exe",
• "Size":" 218624",
• "MD5":" c4f3974b6eda003b0fa3ac230b24dd49",
• "SHA1":" a9a8c1123bb8dc4dbd0ea9635792b7f3c9462e38",
• "SHA256":" 7218ad69dfae486e8ceba58d732ff91c0dbfe2615a14ed32e2addcb9aa660157"
• "SHA512":"
5ae8c1e2895e794857e6a346cc7a3ca5358718c560b5f0090de35a6cbaeb927fc9cfdfc09ad86a10fb3
414a966485bb68ddcce22103e7e153fef5584527b7538",
• "CRC32":" ea619216",
• "SSDEEP":"
3072|pQ0n3fFiFjwk5vl8E5cYkx9psaiNcJNuyJZfb5N/z4n6feAg0FujGV8umEmDP0|/MFswtDqdOamiN
udAOlymz",
• "PDB Path":" ",
• "VSInfo":" 1",
• "Entropy":" 6.576878",
• "FilePacker":" No matches found.",
• "Imphash":" 2f0d6f69089f07b10ab46e6a615c6fd4",
• "Certificates":" None found.",
• "B9 Result ":" 'Bad.exe', is likely suspicious.“
MalwareArchaeology.com
Examples
• Kovter injects into SvcHost 32bit
• Qakbot
• Dridex
MalwareArchaeology.com
Dumping/Extracting Files
• If you use a tool to extract or dump files from
memory to disk, you can statically evaluate
them
• Lookup the hashes in an API like VirusTotal
• Evaluate the makeup of the file to determine
Good, Suspicious, or Malicious indicators
• Extract Strings
• Reverse the files if needed
MalwareArchaeology.com
Dumping/Extracting Files
• You can use a memdump and Volatitility to
extract files, Dlls, and Drivers
– --dump-dir=VolatilityFiles
– --dump-dir=VolatilityDlls
– --dump-dir=VolatilityDrivers
• You can use LOG-MD-Premium to extract files
– LOG-MD-Premium -proc -md -i -x
MalwareArchaeology.com
Extracted Files LOG-MD & Volatility
MalwareArchaeology.com
• QakBot
• Kovter
• Dridex
• Evaluated with LOG-MD B9 module
Details of the files
• You can look for simple indicators
• Is it signed?
• MetaData - Actual filename vs Internal and Original
filename
• Is it packed
• Hash lookups to an API
• File upload to an API
• Determine the makeup of the file for Likely “Good”,
”Suspicious”, or “Malicious”
MalwareArchaeology.com
Downloadware Examples
• They can call out to the Internet to download
the code to compile, or fetch the malware so
it does not live on disk. Some examples:
– CobaltStrike and Sythe custom malware packages
– LoLBins/LoLBas – Rundll32, Regsvr32, Regasm, etc.
• https://github.com/LOLBAS-Project/LOLBAS
– Compilers - Csc.exe, MSBuild.exe, JSC.exe, etc.
– May write to disk on shutdown, delete on startup
MalwareArchaeology.com
CSC.exe example
MalwareArchaeology.com
• <random.cs>
• <random.cmdline>
• Csc.exe /noconfig /fullpaths @
https://blog.didierstevens.com/2019/10/15/powershell-add-type-csc-exe/
Why Running Processes
• SPEED
• It is far faster and more scalable option to scan a
system LIVE for running processes and their
modules
• Dumping memory takes time
• Determining the Imageinfo takes a LONG time
• Running all the plugins takes time
MalwareArchaeology.com
Control Panel Applets
• .CPL files are all those Control Panel applets
– Rundll32 C:<whateverdir>Fakejava.cpl
• Launches a bad Dll into memory - LOLBIN
• .cpl files load all the time, so it’s noisy
• 3rd party applets are not well signed
• Many EDRs do not alert on this method
• The Red Team LOVES this method - CobaltStrike
MalwareArchaeology.com
Control Panel Applets
• This is probably the #1 Red Team attack
method
– LOLBin (Control.exe and RunDll32.exe)
• HARD to detect due to normal noise
• EDR is poor at this method
• So how do you catch this highly used and
successful method?
MalwareArchaeology.com
Catching Control Panel Applets
• Logging executions (4688)
• Look for .cpl files and/or Control.exe and/or
RunDll32.exe
• Baseline what is normal
• Create a PROcess
• Paths will be the same as normal
• Static analyze these .cpl files, whatever the
extention
MalwareArchaeology.com
LOLBin/LOLBaS
• Oddvar Moe - https://lolbas-project.github.io/
• Listen to our podcast on the subject
MalwareArchaeology.com
NIX PRO Tip
• It is easy for NIX rootkits to hide things
• But there is a /proc directory
• Which is also easy to hide stuff from ll or ls-l, you
don’t see a hidden /proc dir
• If we know what is in the file in each /proc/<pid>
then we can look for the execution line
– ls -al /proc | awk '{print $9}' | sort -n > proc-list.txt
– for i in {1..40000}; do if test -d /proc/$i; then if ! grep -
q ^$i$ proc-list.txt; then ls -al /proc/$i/exe; fi; fi; done
| grep "root" | grep -v -f known_good_proc.txt >
odd_proc.txt
MalwareArchaeology.com
Monitoring for
and
Threat Hunting
MalwareArchaeology.com
Monitor for & Threat Hunting
• We need to develop a PROcess to monitor/detect
for and/or Threat Hunt for signs of these
techniques
• Step 1
– Enable the data (enable the logging)
– Configure logs per the Windows Logging Cheat
Sheet(s)
– Enable to collect ‘Process Command Line’
• Step 2
– Create detections for many of these techniques
– Process command line is KEY.. It’s in the parameters
MalwareArchaeology.com
Monitor for & Threat Hunting
Step 3
• Come up with a PROcess to scan Running
Processes and their loaded Modules
– Detect these memory only infections
– This should be both for regular detection and for
Threat Hunting
– Watch for indications of injection
MalwareArchaeology.com
Static eval files for Strings
• You can eval files for known indicators of
strings that may indicate injection
• The LOG-MD-Premium B9 module not only
looks at the structure of the file to determine
likely “Good”, “Suspicious”, or “Malware”
• But also dumps strings to allow eval of the
existence of strings that further indicates the
file is malicious
MalwareArchaeology.com
Example LOG-MD-Premium
B9 static file evaluation - Strings
• "B9Words":" List of words in file.",
• "!This program cannot be run in DOS mode."
• "JtRich"
• ".text"
• "`.rdata"
• "@.data"
• ".gfids"
• "GetProcessHeap"
• "FindClose"
• "FindFirstFileExA"
• "FindNextFileA"
• "IsValidCodePage"
• "GetCommandLineA"
• "GetCommandLineW"
• "GetEnvironmentStringsW"
• "FreeEnvironmentStringsW"
• "SetStdHandle"
• "WriteConsoleW"
• "ReadConsoleW"
• "CreateFileW"
• "HeapSize"
• "SetEndOfFile"
• "_CorDllMain"
• "mscoree.dll“
• "Copyright (c) by P.J. Plauger, licensed by Dinkumware, Ltd. ALL RIGHTS RESERVED."
MalwareArchaeology.com
"string too long"
"invalid string position"
"bad allocation"
"identifier removed"
"illegal byte sequence"
"interrupted"
"invalid argument"
"io error“
"is a directory"
"message size"
"network down"
"network reset"
"network unreachable"
"no buffer space"
"no child process"
"no link"
"no lock available"
"no message available“
"no message“
"no protocol option"
"no space on device“
"no stream resources"
"no such device or address"
"no such device"
"no such file or directory"
"no such process"
"not a directory"
"not a socket"
"not a stream"
"not connected"
"not enough memory"
Monitor for & Threat Hunting
Strings
• Maybe a PROcess to scan strings for API calls such as;
– OpenProcess
– VirtualAlloc
– VirtualAllocEx
– WriteProcessMemory
– LoadLibrary
– LoadLibraryA
– CreateRemoteThread
– ResumeThread
– ReflectiveLoader()
– OpenProcess
– GetProcAddress
– CreateProcess
– ZwUnMapViewOfSection
– NtUnmapViewOfSection
– GetThreadContext
– SetThreadContext
– ResumeThread
MalwareArchaeology.com
Watch for Downloading
LOLBin/LOLBaS
• Malicious code has to be downloaded
• Advanced attackers and Red Teams will use
the LOLBin and Scripts LOLBaS to download
the payload
• Alert on these
• Baseline the normal, there will NOT be many
• Watch these executions closely
MalwareArchaeology.com
LOLBINS/LOLBAS that can download
• powershell.exe
• bitsadmin.exe
• certutil.exe
• psexec.exe
• wmic.exe
• mshta.exe
• mofcomp.exe
• cmstp.exe
• windbg.exe
• cdb.exe
• msbuild.exe
• csc.exe
• regsvr32.exe
• Excel too !!!
MalwareArchaeology.com
Short list per Cisco Talos
• mshta.exe
• certutil.exe
• bitsadmin.exe
• regsvr32.exe
• powershell.exe
https://blog.talosintelligence.com/2019/11/hunting-for-lolbins.html
Process Command Line is KEY
Map to MITRE ATT&CK
NIX LOLBins - GTFObins
• https://gtfobins.github.io/
MalwareArchaeology.com
Best options for PROcess tools
• Log Management is your BEST friend here
– If you have, and can afford to put agents on all your
endpoints and collect the needed data
• If not, then you will need a PROcess to manually
check running process, their modules and signs of
injection
• LOG-MD-Premium, Systeinternals, Sysmon (ID 8
& 10), using WinRM and ARTHIR, Memory dump
with Volatility are possible options
MalwareArchaeology.com
CONCLUSION
MalwareArchaeology.com
Conclusion
• Create a PROcess to look at running processes
and their modules
• Look for signs of injection
• Log the process command line execution
• Watch the LOLBaS utilities
• Monitor for the executions discussed in this
presentation
MalwareArchaeology.com
Some tools to consider
Please let me know of any others
• LOG-MD-Premium
– Running Process and Modules, Injection, and B9 static file analysis
• Volatility
– https://www.volatilityfoundation.org/
– HollowFind Plugin (Win 10 compatible?)
• https://github.com/monnappa22/HollowFind
• PESieve (Opensource)
– https://github.com/hasherezade/pe-sieve
• Get-InjectedThread.ps1
– https://gist.github.com/jaredcatkinson/23905d34537ce4b5b1818c3e6405c1d2
• PSReflect
– https://github.com/mattifestation/PSReflect
MalwareArchaeology.com
Some tools to consider
Please let me know of any others
• GRR
– https://github.com/google/grr
• Rekall
– http://www.rekall-forensic.com/home
• InVtero
– https://github.com/ShaneK2/inVtero.net
– https://github.com/seancomeau/inVtero.net
• MemHunter (Old, requires .NET 3.5)
– https://github.com/marcosd4h/memhunter
MalwareArchaeology.com
Resources
• Red Canary Presentation
– ATT&CK Deep Dive: Process Injection
• Article on MITRE ATT&CK Sub-Techniques (coming soon)
– https://medium.com/mitre-attack/attack-sub-techniques-
preview-b79ff0ba669a
• DeepInstinct - Process Injection and Manipulation
– https://www.deepinstinct.com/2019/09/15/malware-evasion-
techniques-part-1-process-injection-and-manipulation/
• EndGame – Hunting in Memory
– https://www.slideshare.net/JoeDesimone4/taking-hunting-to-
the-next-level-hunting-in-memory
MalwareArchaeology.com
Resources
LOG-MD.COM
• Websites
– Log-MD.com The tool
– ARTHIR.com Free on GitHub
• The “Windows Logging Cheat Sheet(s)”
– MalwareArchaeology.com
• This presentation and others on SlideShare
– Search for MalwareArchaeology or LOG-MD
Questions?
LOG-MD.COM
You can find us at:
• Log-MD.com
• @HackerHurricane
• MalwareArchaeology.com

More Related Content

PDF
Detecting WMI Exploitation v1.1
PDF
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
PDF
Windows IR made easier and faster v1.0
PDF
Logging for Hackers v1.0
PDF
Windows Incident Response is hard, but doesn't have to be
PDF
Commodity malware means YOU
PDF
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
PDF
Logs, Logs, Logs - What you need to know to catch a thief
Detecting WMI Exploitation v1.1
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
Windows IR made easier and faster v1.0
Logging for Hackers v1.0
Windows Incident Response is hard, but doesn't have to be
Commodity malware means YOU
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
Logs, Logs, Logs - What you need to know to catch a thief

What's hot (20)

PDF
Deeplook into apt and how to detect and defend v1.0
PDF
RMISC logging for hackers
PDF
Info sec is not daunting v1.0
PDF
Logging for Hackers - What you need to know to catch them
PDF
Logging for hackers SAINTCON
PDF
InnoTech 2017_Defend_Against_Ransomware 3.0
PDF
You can detect PowerShell attacks
PDF
Ask a Malware Archaeologist
PDF
Finding attacks with these 6 events
PDF
The top 10 windows logs event id's used v1.0
PDF
What can you do about ransomware
PDF
DIR ISF - Email keeps getting us pwned v1.1
PDF
Malware Management - HouSecCon 2014
PDF
Mw arch mac_tips and tricks v1.0
PDF
Secure Yourself, Practice what we preach - BSides Austin 2015
PDF
EDR, ETDR, Next Gen AV is all the rage, so why am I ENRAGED?
PDF
Sandbox vs manual analysis v2.1
PDF
Proper logging can catch breaches like retail PoS
PDF
Sandbox vs manual malware analysis v1.1
PDF
Windows logging workshop - BSides Austin 2014
Deeplook into apt and how to detect and defend v1.0
RMISC logging for hackers
Info sec is not daunting v1.0
Logging for Hackers - What you need to know to catch them
Logging for hackers SAINTCON
InnoTech 2017_Defend_Against_Ransomware 3.0
You can detect PowerShell attacks
Ask a Malware Archaeologist
Finding attacks with these 6 events
The top 10 windows logs event id's used v1.0
What can you do about ransomware
DIR ISF - Email keeps getting us pwned v1.1
Malware Management - HouSecCon 2014
Mw arch mac_tips and tricks v1.0
Secure Yourself, Practice what we preach - BSides Austin 2015
EDR, ETDR, Next Gen AV is all the rage, so why am I ENRAGED?
Sandbox vs manual analysis v2.1
Proper logging can catch breaches like retail PoS
Sandbox vs manual malware analysis v1.1
Windows logging workshop - BSides Austin 2014
Ad

Similar to You need a PROcess to catch running processes and their modules_v2.0 (20)

PDF
Can_We_Really_Detect_These_So_Called_Sophisticated_Attacks?
PDF
When Security Tools Fail You
PPTX
Defending Your "Gold"
PPTX
Jason Kent - AppSec Without Additional Tools
PDF
Forensics perspective ERFA-møde marts 2017
PDF
Malware collection and analysis
PDF
Malware analysis _ Threat Intelligence Morocco
PPTX
Building next gen malware behavioural analysis environment
PPTX
Introduction to Malware Analysis
PDF
Spo2 t19 spo2-t19
PDF
Sophisticated Attacks - Can We Really Detect Them _v1.2.pdf
PDF
MITRE AttACK framework it is time you took notice_v1.0
PDF
Super Easy Memory Forensics
 
PDF
EMBA Firmware analysis - TROOPERS22
PDF
Proper logging can catch breaches like retail PoS
PDF
SANS Digital Forensics and Incident Response Poster 2012
PDF
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
PDF
RIoT (Raiding Internet of Things) by Jacob Holcomb
PPTX
Two-For-One Talk: Malware Analysis for Everyone
PPTX
Inventory Tips & Tricks
Can_We_Really_Detect_These_So_Called_Sophisticated_Attacks?
When Security Tools Fail You
Defending Your "Gold"
Jason Kent - AppSec Without Additional Tools
Forensics perspective ERFA-møde marts 2017
Malware collection and analysis
Malware analysis _ Threat Intelligence Morocco
Building next gen malware behavioural analysis environment
Introduction to Malware Analysis
Spo2 t19 spo2-t19
Sophisticated Attacks - Can We Really Detect Them _v1.2.pdf
MITRE AttACK framework it is time you took notice_v1.0
Super Easy Memory Forensics
 
EMBA Firmware analysis - TROOPERS22
Proper logging can catch breaches like retail PoS
SANS Digital Forensics and Incident Response Poster 2012
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
RIoT (Raiding Internet of Things) by Jacob Holcomb
Two-For-One Talk: Malware Analysis for Everyone
Inventory Tips & Tricks
Ad

More from Michael Gough (8)

PDF
Hacking a backup power solution(s) for your home, Tornado tested!
PDF
My InfoSec journey led me to create my own IR tools, how, and why you should too
PPTX
Incident Response Fails
PDF
Introducing ArTHIR - ATT&CK Remote Threat Hunting Incident Response Windows tool
PDF
Cred stealing emails bsides austin_2018 v1.0
PDF
Email keeps getting us pwned - Avoiding Ransomware and malware
PDF
Email keeps getting us pwned v1.1
PDF
Email keeps getting us pwned v1.0
Hacking a backup power solution(s) for your home, Tornado tested!
My InfoSec journey led me to create my own IR tools, how, and why you should too
Incident Response Fails
Introducing ArTHIR - ATT&CK Remote Threat Hunting Incident Response Windows tool
Cred stealing emails bsides austin_2018 v1.0
Email keeps getting us pwned - Avoiding Ransomware and malware
Email keeps getting us pwned v1.1
Email keeps getting us pwned v1.0

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PPTX
A Presentation on Artificial Intelligence
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
A Presentation on Artificial Intelligence
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
Diabetes mellitus diagnosis method based random forest with bat algorithm

You need a PROcess to catch running processes and their modules_v2.0

  • 1. You need a PROcess to check your running processes and modules. The bad guys, and red teams are coming after them! Michael Gough – Principal NCC Group Founder MalwareArchaeology.com & IMFSecurity.com MalwareArchaeology.com
  • 2. Who am I • Blue Team Defender Ninja, Malware Archaeologist, Logoholic and Principal Incident Response Engineer for • I love “properly” configured logs – they tell us Who, What, Where, When and hopefully How Creator of “Windows Logging Cheat Sheet” “Windows File Auditing Cheat Sheet” “Windows Registry Auditing Cheat Sheet” “Windows Splunk Logging Cheat Sheet” “Windows ATT&CK Logging Cheat Sheet” “ARTHIR – ATT&CK Remote Threat Hunting Incident Response tool” • Co-Creator of “Log-MD” – Log Malicious Discovery Tool • And co-host of “THE Incident Response Podcast” MalwareArchaeology.com
  • 4. Because these can’t tell you enough MalwareArchaeology.com
  • 6. Fileless in memory only malware • To address this expanding threat that is becoming more and more common – Too common • Commodity malware, Red Team engagements, and of course APT attackers use it • This method can avoid many security tools MalwareArchaeology.com
  • 7. Let’s rethink or redefine Fileless Malware MalwareArchaeology.com
  • 8. Marketing- Scareware • I get it, saying “Fileless” is an easy way to sum up a threat for management, sales, products, etc. to sum up and understand a new type of threat • But for those of us having to deal with it from an IR or Forensik perspective, we need more than just the word “fileless” • So let’s take a look at another more detailed way to look at fileless malware that immediately tells us something, and how to go about looking for it MalwareArchaeology.com https://conference.forensik.ca/
  • 9. Rethinking Fileless Malware • Fileless Malware that can only be found in the memory of a running system (Malware + Memory = Memware) • No files can be found if you scan the disk while the system is running – Or are very short lived, just long enough to load (bypasses FIM) • Typical infection vectors are: – Injection – Dll side-loading/Hijacking – Process Hollowing – Download source code and compile on the fly, .NET, JSC – User double-click, etc. • “Fileless” malware, the file lives somewhere, so lets do a better job guiding people where to look for signs of it MalwareArchaeology.com
  • 10. Other Fileless Malware types • Regware – Malware payload is stored in the registry with an autorun/ASEP that calls and loads it into memory (Malware + Payload in Registry = RegWare) • WMIware - Malware payload is stored in the WMI database with an autorun/ASEP that calls and loads it into memory (Malware + Payload in WMI database = WMIWare) • PowerShellware - Malware payload is in the form of PowerShell scripts, downloaded or stored somewhere on the fly with an autorun/ASEP that calls and loads it into memory (Malware + Payload in PowerShell = PowerShellWare) • Compileware – Malware payload is not yet compiled, stored anywhere with an autorun/ASEP that calls and loads it into memory (Malware + Payload compiled on the fly = CompileWare) • Downloadware – Autorun/ASEP calls out to the Internet to download malware payload or source code that is then compiled and loads it into memory (Malware + Payload downloaded each time = DownloadWare) maybe LOLBaSWare ;-) MalwareArchaeology.com
  • 11. Autoruns/ASEP • Keep in mind… – Not all malware will have an autorun/ASEP • Latest TrickBot on Domain Controllers • Especially the Red Team, doesn’t like to leave IOCs – Or, the autorun is created on shutdown, then deleted on startup once the malware loads • Nothing found when doing live triage/analysis (Dridex) – So what is in memory may be all that we can see MalwareArchaeology.com
  • 12. Latest TrickBot MalwareArchaeology.com PaloAlto Unit 42 - https://unit42.paloaltonetworks.com/goodbye-mworm-hello-nworm-trickbot-updates-propagation-module/
  • 13. So how do we find this stuff? MalwareArchaeology.com
  • 14. MITRE ATT&CK • First - Everything you do should be mapped to MITRE ATT&CK - https://attack.mitre.org/ • Some of the techniques used – T1500 – Compile After Delivery – T1127 - Trusted Developer Utilities – T1055 – Process Injection – T1196 – Control Panel Items – etc • Sub-techniques are here !!! MalwareArchaeology.com
  • 15. MITRE ATT&CK – Sub-techniques • T1574 – Hijack Execution Flow • 11 Sub-techniques – 1574.002 - Dll side loading is just one of them • T1055 – Process Injection • 11 Sub-techniques – 1055.002 – Portable Execution Injection MalwareArchaeology.com
  • 16. We need a PROcess • We need to create a PROcess to start looking for this condition • Tools are just not preventing this technique • We need to build this PROcess into our hourly/daily/weekly/monthly routines to detect and alert for this technique • We need to build this PROcess into our daily/weekly/monthly/yearly routines to Threat Hunt for this technique MalwareArchaeology.com Canadian Andrew Hay
  • 17. Two basic ways 1. Dump memory and analyze the memory dump – Use a tool like Volatility and all the plug-ins 2. Check running processes and their modules for signs of additional (DLL) or injected code – Use a tool like LOG-MD-Premium to scan a live system for modifications to running processes and their modules MalwareArchaeology.com
  • 18. Finding Memware • Traditional forensics has us dumping a memory image and running tools like Volatility against it • Logs can contain a lot of details that can alert you to this behavior, IF you collect THEN detect OR hunt – Process command line is KEY to catching these attacks • Checking running processes and their modules on a live system is a GREAT option – Better yet look for signs of injection !! • Look for the other artifacts, autorun/ASEP, registry keys storing scripts and/or payloads, WMI databases storing scripts and/or payloads, and odd PowerShell, large blocks, obfuscation, etc. MalwareArchaeology.com
  • 19. Signs of Injection • What does this look like? • A running process shows signs of additional or replaced code • This condition is detectable by a few tools • And an obvious indicator of bad • Yes, some system drivers will show up here too MalwareArchaeology.com
  • 20. Example LOG-MD-Premium • -proc Check running processes & modules • -md Exclude known good processes UNLESS there is signs of injection • -i List processes with signs of injection • - b9 Static evaluate the file to determine malicious likelihood and dump strings • -vt Lookup the hashes of the modules for any indications of known bad • -x Dump all files that show signs of injection MalwareArchaeology.com
  • 21. Example LOG-MD-Premium B9 module static file evaluation • "B9 Result ":" 'Bad.exe', is likely suspicious • Name":" Bad.exe", • "Size":" 218624", • "MD5":" c4f3974b6eda003b0fa3ac230b24dd49", • "SHA1":" a9a8c1123bb8dc4dbd0ea9635792b7f3c9462e38", • "SHA256":" 7218ad69dfae486e8ceba58d732ff91c0dbfe2615a14ed32e2addcb9aa660157" • "SHA512":" 5ae8c1e2895e794857e6a346cc7a3ca5358718c560b5f0090de35a6cbaeb927fc9cfdfc09ad86a10fb3 414a966485bb68ddcce22103e7e153fef5584527b7538", • "CRC32":" ea619216", • "SSDEEP":" 3072|pQ0n3fFiFjwk5vl8E5cYkx9psaiNcJNuyJZfb5N/z4n6feAg0FujGV8umEmDP0|/MFswtDqdOamiN udAOlymz", • "PDB Path":" ", • "VSInfo":" 1", • "Entropy":" 6.576878", • "FilePacker":" No matches found.", • "Imphash":" 2f0d6f69089f07b10ab46e6a615c6fd4", • "Certificates":" None found.", • "B9 Result ":" 'Bad.exe', is likely suspicious.“ MalwareArchaeology.com
  • 22. Examples • Kovter injects into SvcHost 32bit • Qakbot • Dridex MalwareArchaeology.com
  • 23. Dumping/Extracting Files • If you use a tool to extract or dump files from memory to disk, you can statically evaluate them • Lookup the hashes in an API like VirusTotal • Evaluate the makeup of the file to determine Good, Suspicious, or Malicious indicators • Extract Strings • Reverse the files if needed MalwareArchaeology.com
  • 24. Dumping/Extracting Files • You can use a memdump and Volatitility to extract files, Dlls, and Drivers – --dump-dir=VolatilityFiles – --dump-dir=VolatilityDlls – --dump-dir=VolatilityDrivers • You can use LOG-MD-Premium to extract files – LOG-MD-Premium -proc -md -i -x MalwareArchaeology.com
  • 25. Extracted Files LOG-MD & Volatility MalwareArchaeology.com • QakBot • Kovter • Dridex • Evaluated with LOG-MD B9 module
  • 26. Details of the files • You can look for simple indicators • Is it signed? • MetaData - Actual filename vs Internal and Original filename • Is it packed • Hash lookups to an API • File upload to an API • Determine the makeup of the file for Likely “Good”, ”Suspicious”, or “Malicious” MalwareArchaeology.com
  • 27. Downloadware Examples • They can call out to the Internet to download the code to compile, or fetch the malware so it does not live on disk. Some examples: – CobaltStrike and Sythe custom malware packages – LoLBins/LoLBas – Rundll32, Regsvr32, Regasm, etc. • https://github.com/LOLBAS-Project/LOLBAS – Compilers - Csc.exe, MSBuild.exe, JSC.exe, etc. – May write to disk on shutdown, delete on startup MalwareArchaeology.com
  • 28. CSC.exe example MalwareArchaeology.com • <random.cs> • <random.cmdline> • Csc.exe /noconfig /fullpaths @ https://blog.didierstevens.com/2019/10/15/powershell-add-type-csc-exe/
  • 29. Why Running Processes • SPEED • It is far faster and more scalable option to scan a system LIVE for running processes and their modules • Dumping memory takes time • Determining the Imageinfo takes a LONG time • Running all the plugins takes time MalwareArchaeology.com
  • 30. Control Panel Applets • .CPL files are all those Control Panel applets – Rundll32 C:<whateverdir>Fakejava.cpl • Launches a bad Dll into memory - LOLBIN • .cpl files load all the time, so it’s noisy • 3rd party applets are not well signed • Many EDRs do not alert on this method • The Red Team LOVES this method - CobaltStrike MalwareArchaeology.com
  • 31. Control Panel Applets • This is probably the #1 Red Team attack method – LOLBin (Control.exe and RunDll32.exe) • HARD to detect due to normal noise • EDR is poor at this method • So how do you catch this highly used and successful method? MalwareArchaeology.com
  • 32. Catching Control Panel Applets • Logging executions (4688) • Look for .cpl files and/or Control.exe and/or RunDll32.exe • Baseline what is normal • Create a PROcess • Paths will be the same as normal • Static analyze these .cpl files, whatever the extention MalwareArchaeology.com
  • 33. LOLBin/LOLBaS • Oddvar Moe - https://lolbas-project.github.io/ • Listen to our podcast on the subject MalwareArchaeology.com
  • 34. NIX PRO Tip • It is easy for NIX rootkits to hide things • But there is a /proc directory • Which is also easy to hide stuff from ll or ls-l, you don’t see a hidden /proc dir • If we know what is in the file in each /proc/<pid> then we can look for the execution line – ls -al /proc | awk '{print $9}' | sort -n > proc-list.txt – for i in {1..40000}; do if test -d /proc/$i; then if ! grep - q ^$i$ proc-list.txt; then ls -al /proc/$i/exe; fi; fi; done | grep "root" | grep -v -f known_good_proc.txt > odd_proc.txt MalwareArchaeology.com
  • 36. Monitor for & Threat Hunting • We need to develop a PROcess to monitor/detect for and/or Threat Hunt for signs of these techniques • Step 1 – Enable the data (enable the logging) – Configure logs per the Windows Logging Cheat Sheet(s) – Enable to collect ‘Process Command Line’ • Step 2 – Create detections for many of these techniques – Process command line is KEY.. It’s in the parameters MalwareArchaeology.com
  • 37. Monitor for & Threat Hunting Step 3 • Come up with a PROcess to scan Running Processes and their loaded Modules – Detect these memory only infections – This should be both for regular detection and for Threat Hunting – Watch for indications of injection MalwareArchaeology.com
  • 38. Static eval files for Strings • You can eval files for known indicators of strings that may indicate injection • The LOG-MD-Premium B9 module not only looks at the structure of the file to determine likely “Good”, “Suspicious”, or “Malware” • But also dumps strings to allow eval of the existence of strings that further indicates the file is malicious MalwareArchaeology.com
  • 39. Example LOG-MD-Premium B9 static file evaluation - Strings • "B9Words":" List of words in file.", • "!This program cannot be run in DOS mode." • "JtRich" • ".text" • "`.rdata" • "@.data" • ".gfids" • "GetProcessHeap" • "FindClose" • "FindFirstFileExA" • "FindNextFileA" • "IsValidCodePage" • "GetCommandLineA" • "GetCommandLineW" • "GetEnvironmentStringsW" • "FreeEnvironmentStringsW" • "SetStdHandle" • "WriteConsoleW" • "ReadConsoleW" • "CreateFileW" • "HeapSize" • "SetEndOfFile" • "_CorDllMain" • "mscoree.dll“ • "Copyright (c) by P.J. Plauger, licensed by Dinkumware, Ltd. ALL RIGHTS RESERVED." MalwareArchaeology.com "string too long" "invalid string position" "bad allocation" "identifier removed" "illegal byte sequence" "interrupted" "invalid argument" "io error“ "is a directory" "message size" "network down" "network reset" "network unreachable" "no buffer space" "no child process" "no link" "no lock available" "no message available“ "no message“ "no protocol option" "no space on device“ "no stream resources" "no such device or address" "no such device" "no such file or directory" "no such process" "not a directory" "not a socket" "not a stream" "not connected" "not enough memory"
  • 40. Monitor for & Threat Hunting Strings • Maybe a PROcess to scan strings for API calls such as; – OpenProcess – VirtualAlloc – VirtualAllocEx – WriteProcessMemory – LoadLibrary – LoadLibraryA – CreateRemoteThread – ResumeThread – ReflectiveLoader() – OpenProcess – GetProcAddress – CreateProcess – ZwUnMapViewOfSection – NtUnmapViewOfSection – GetThreadContext – SetThreadContext – ResumeThread MalwareArchaeology.com
  • 41. Watch for Downloading LOLBin/LOLBaS • Malicious code has to be downloaded • Advanced attackers and Red Teams will use the LOLBin and Scripts LOLBaS to download the payload • Alert on these • Baseline the normal, there will NOT be many • Watch these executions closely MalwareArchaeology.com
  • 42. LOLBINS/LOLBAS that can download • powershell.exe • bitsadmin.exe • certutil.exe • psexec.exe • wmic.exe • mshta.exe • mofcomp.exe • cmstp.exe • windbg.exe • cdb.exe • msbuild.exe • csc.exe • regsvr32.exe • Excel too !!! MalwareArchaeology.com Short list per Cisco Talos • mshta.exe • certutil.exe • bitsadmin.exe • regsvr32.exe • powershell.exe https://blog.talosintelligence.com/2019/11/hunting-for-lolbins.html Process Command Line is KEY Map to MITRE ATT&CK
  • 43. NIX LOLBins - GTFObins • https://gtfobins.github.io/ MalwareArchaeology.com
  • 44. Best options for PROcess tools • Log Management is your BEST friend here – If you have, and can afford to put agents on all your endpoints and collect the needed data • If not, then you will need a PROcess to manually check running process, their modules and signs of injection • LOG-MD-Premium, Systeinternals, Sysmon (ID 8 & 10), using WinRM and ARTHIR, Memory dump with Volatility are possible options MalwareArchaeology.com
  • 46. Conclusion • Create a PROcess to look at running processes and their modules • Look for signs of injection • Log the process command line execution • Watch the LOLBaS utilities • Monitor for the executions discussed in this presentation MalwareArchaeology.com
  • 47. Some tools to consider Please let me know of any others • LOG-MD-Premium – Running Process and Modules, Injection, and B9 static file analysis • Volatility – https://www.volatilityfoundation.org/ – HollowFind Plugin (Win 10 compatible?) • https://github.com/monnappa22/HollowFind • PESieve (Opensource) – https://github.com/hasherezade/pe-sieve • Get-InjectedThread.ps1 – https://gist.github.com/jaredcatkinson/23905d34537ce4b5b1818c3e6405c1d2 • PSReflect – https://github.com/mattifestation/PSReflect MalwareArchaeology.com
  • 48. Some tools to consider Please let me know of any others • GRR – https://github.com/google/grr • Rekall – http://www.rekall-forensic.com/home • InVtero – https://github.com/ShaneK2/inVtero.net – https://github.com/seancomeau/inVtero.net • MemHunter (Old, requires .NET 3.5) – https://github.com/marcosd4h/memhunter MalwareArchaeology.com
  • 49. Resources • Red Canary Presentation – ATT&CK Deep Dive: Process Injection • Article on MITRE ATT&CK Sub-Techniques (coming soon) – https://medium.com/mitre-attack/attack-sub-techniques- preview-b79ff0ba669a • DeepInstinct - Process Injection and Manipulation – https://www.deepinstinct.com/2019/09/15/malware-evasion- techniques-part-1-process-injection-and-manipulation/ • EndGame – Hunting in Memory – https://www.slideshare.net/JoeDesimone4/taking-hunting-to- the-next-level-hunting-in-memory MalwareArchaeology.com
  • 50. Resources LOG-MD.COM • Websites – Log-MD.com The tool – ARTHIR.com Free on GitHub • The “Windows Logging Cheat Sheet(s)” – MalwareArchaeology.com • This presentation and others on SlideShare – Search for MalwareArchaeology or LOG-MD
  • 51. Questions? LOG-MD.COM You can find us at: • Log-MD.com • @HackerHurricane • MalwareArchaeology.com