In In NTDLL I I Trust Process Reimaging and Endpoint Security Solution Bypass
Hack in Paris 2019 Eoin Carroll Senior Security Researcher McAfee ATR
In In NTDLL I I Trust Process Reimaging and Endpoint Security - - PowerPoint PPT Presentation
In In NTDLL I I Trust Process Reimaging and Endpoint Security Solution Bypass Eoin Carroll Senior Security Researcher Hack in Paris 2019 McAfee ATR Attribution sacr bleu Eoin Carroll Steve Povolny Steve Hearnden Cedric Cochin About
Hack in Paris 2019 Eoin Carroll Senior Security Researcher McAfee ATR
Eoin Carroll Steve Hearnden Cedric Cochin Steve Povolny sacré bleu
Semi-Conductor Electronic Engineer Medical Device Electronic Engineer SW Security Engineer Appsec Pentester Security Researcher Security Team Lead Security Mgr Security Architect 2000 2007 2011 2018 @w3knight
as K32GetProcessImageFilename
within the Mitre Attack Defense Evasion Category
signature update
running process attribute verification @ 4
running process attribute verification @ 4
Process Reimaging Definition
“Windows Kernel APIs return stale and inconsistent FILE_OBJECT paths which enable an adversary to bypass Windows Operating System Process attribute verification”
Digital Signature Validation
Digital Signature Validation Process Attribute Verification
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Endpoint Security Solution (ESS)
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Endpoint Security Solution (ESS)
CreateProcess Create_Suspended
1. Process created with trusted binary
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS)
CreateProcess Create_Suspended NtUnmapViewOfSection VirtualAllocEx WriteProcessMemory ResumeThread
1. Process created with trusted binary 2. Process Hollowing with malicious code
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper
CreateProcess Create_Suspended NtUnmapViewOfSection VirtualAllocEx WriteProcessMemory ResumeThread
1. Process created with trusted binary 2. Process Hollowing with malicious code
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess Create_Suspended NtUnmapViewOfSection VirtualAllocEx WriteProcessMemory ResumeThread
1. Process created with trusted binary 2. Process Hollowing with malicious code
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess Create_Suspended NtUnmapViewOfSection VirtualAllocEx WriteProcessMemory ResumeThread NTDLL API for Process Image Query
1. Process created with trusted binary 2. Process Hollowing with malicious code
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess Create_Suspended NtUnmapViewOfSection VirtualAllocEx WriteProcessMemory ResumeThread NTDLL API for Process Image Query
msiexec.exe
1. Process created with trusted binary 2. Process Hollowing with malicious code
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Endpoint Security Solution (ESS)
CreateTransaction CreateFileTransacted
1. Trusted Binary transacted as Malicious PE
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS)
CreateTransaction CreateFileTransacted WriteFile CreateSection
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS)
CreateTransaction CreateFileTransacted WriteFile CreateSection ResumeThread
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE 3. Rollback transaction removes changes from Filesystem
RollBackTransaction NtCreateProcess
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper
CreateTransaction CreateFileTransacted WriteFile CreateSection ResumeThread
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE 3. Rollback transaction removes changes from Filesystem
RollBackTransaction NtCreateProcess
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateTransaction CreateFileTransacted WriteFile CreateSection ResumeThread
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE 3. Rollback transaction removes changes from Filesystem
RollBackTransaction NtCreateProcess
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateTransaction CreateFileTransacted WriteFile CreateSection ResumeThread NTDLL API for Process Image Query
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE 3. Rollback transaction removes changes from Filesystem
RollBackTransaction NtCreateProcess
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe
msiexec.exe Malicious PE Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateTransaction CreateFileTransacted WriteFile CreateSection ResumeThread NTDLL API for Process Image Query
msiexec.exe
1. Trusted Binary transacted as Malicious PE 2. Create Sections from transacted Malicious PE 3. Rollback transaction removes changes from Filesystem
RollBackTransaction NtCreateProcess
Prerequisites
Process Reimaging targets the post-exploitation phase, whereby a threat actor has already gained access to the target system. This is the same prerequisite of Process Hollowing or Doppelganging techniques within the Defense Evasion category of the Mitre ATT&CK framework.
Attack Vectors
1. FILE_OBJECT Filepath changes 2. FILE_OBJECT Filename changes 3. LoadLibrary FILE_OBJECT reuse
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe Endpoint Security Solution (ESS)
CreateProcess
1. Process created with undetected binary
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe msiexec.exe Endpoint Security Solution (ESS)
CreateProcess MoveFileW CreateDirectoryW CopyFileW
1. Process created with undetected binary 2. Process reimaged as msiexec
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe msiexec.exe Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper
CreateProcess MoveFileW CreateDirectoryW CopyFileW
1. Process created with undetected binary 2. Process reimaged as msiexec
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe msiexec.exe Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess MoveFileW CreateDirectoryW CopyFileW
1. Process created with undetected binary 2. Process reimaged as msiexec
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe msiexec.exe Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess MoveFileW CreateDirectoryW CopyFileW NTDLL API for Process Image Query
1. Process created with undetected binary 2. Process reimaged as msiexec
Initial Access Execution Defense Evasion Acting on Objectives
Drive-by-Compromise Phishing Obfuscated Trojan Dropper Dropper Location SynAck.exe msiexec.exe undetected.exe
undetected.exe msiexec.exe Endpoint Security Solution (ESS) Protection failed to detect obfuscated dropper Signatures updated
CreateProcess MoveFileW CreateDirectoryW CopyFileW NTDLL API for Process Image Query
msiexec.exe
1. Process created with undetected binary 2. Process reimaged as msiexec
IDA Graph Displaying Complexity of NtQueryInformationProcess Filename APIs within NTDLL
IDA Graph Displaying Complexity of NtQueryVirtualMemory Filename API within NTDLL
Kernelbase.dll APIs Ntoskrnl.exe API & Structures Win 7 SP1 x64 Ntoskrnl 6.1.7601.17514 Win 8.1 x64 Ntoskrnl 6.3.9600.18946 Win10 RS1 x64 Ntoskrnl 10.0.14393.0 K32GetModuleFileNameEx
NtQueryInformationProcess
EPROCESS +0x448 ImageFilePointer (Win10) EPROCESS +0x3b8 SectionObject (<Win10)
Incorrect Filename Incorrect path Incorrect Filename Incorrect path Correct Filename Incorrect path
GetMappedFileName
NtQueryVirtualMemory
VAD FILE_OBJECT handle
Correct Filename Incorrect path Correct Filename Incorrect path Correct Filename Incorrect path
K32GetProcessImageFileName
NtQueryInformationProcess
EPROCESS SeAuditProcessCreationInfo
Incorrect Filename Incorrect path Incorrect Filename Incorrect path Incorrect Filename Incorrect path
QueryFullProcessImageFileName
NtQueryInformationProcess
EPROCESS +0x448 ImageFilePointer (Win10) EPROCESS +0x3b8 SectionObject (<Win10)
Incorrect Filename Incorrect path Incorrect Filename Incorrect path Correct Filename Incorrect path
Process Reimaging
Process Reimaging Process Doppelganging
Process Reimaging Process Doppelganging Process Hollowing
Process Manipulation Technique Advantages Disadvantages Protection Detection Process Reimaging
Easier to execute No code injection All Windows versions No API signatures No Protection No fileless No trusted path execution location Cannot delete malicious file from disk Track FILE_OBJECT ID from FileCreate EDR tracing Memory scanning (requires trigger)
Process Doppelganging
Fileless Trusted path execution location Delete malicious file from disk Transaction API not legitimate usage Code Injection Microsoft Protection ESS protection Proprietary Techniques Yara Rules EDR tracing Yara Rules Memory scanning (requires trigger)
Process Hollowing
Fileless Trusted path execution location Delete malicious file from disk Noisy APIs Signatures Code Injection ESS protection Proprietary Techniques Yara Rules EDR tracing Yara Rules Memory scanning (requires trigger)
to determine if executing code is from a malicious file on disk
CVSS score 5.0 (Medium) https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N (same score as Doppelganging)
to determine if executing code is from a malicious file on disk
CVSS score 5.0 (Medium) https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N (same score as Doppelganging)
verify trust of a calling process
CVSS score will be higher than 5.0; scoring specific to Endpoint Security Solution architecture
to determine if executing code is from a malicious file on disk
CVSS score 5.0 (Medium) https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:N (same score as Doppelganging)
verify trust of a calling process
CVSS score will be higher than 5.0; scoring specific to Endpoint Security Solution architecture Note: you are vulnerable if you use any of the APIs listed in the “OS/Kernel version and API Matrix” for above use cases
closes its handle for the filename by the time the image is loaded at ImageLoad.
can be leveraged to determine if a process has been reimaged when performing process attribute verification.
Cumulative update for the Process Reimaging FILE_OBJECT filename changes attack vector only
APIs in “OS/Kernel version and API Matrix” at the OS level; therefore, Endpoint Security Solutions are still vulnerable to Process Reimaging
vector executed in the bypass demo video, and this attack vector affects all Windows OS versions
https://securin ingtomorrow.mcafee.com/other-blogs/mcafee-labs/in- ntdll ll-i-trust-process-reimaging-and-endpoin int-security-solu lution-bypass/