SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Downloaden Sie, um offline zu lesen
Practical Malware Analysis
Ch 11: Malware Behavior
Last revised 4-9-17
Downloaders and Launchers
Downloaders
• Download another piece of malware
– And execute it on the local system
• Commonly use the Windows API
URLDownloadtoFileA, followed by a
call to WinExec
Launchers (aka Loaders)
• Prepares another piece of malware for
covert execution
– Either immediately or later
– Stores malware in unexpected places, such as
the .rsrc section of a PE file
Backdoors
Backdoors
• Provide remote access to victim machine
• The most common type of malware
• Often communicate over HTTP on Port 80
– Network signatures are helpful for detection
• Common capabilities
– Manipulate Registry, enumerate display
windows, create directories, search files, etc.
Reverse Shell
• Infected machine calls out to attacker,
asking for commands to execute
Windows Reverse Shells
• Basic
– Call CreateProcess and manipulate
STARTUPINFO structure
– Create a socket to remote machine
– Then tie socket to standard input, output,
and error for cmd.exe
– CreateProcess runs cmd.exe with its
window suppressed, to hide it
Windows Reverse Shells
• Multithreaded
– Create a socket, two pipes, and two threads
– Look for API calls to CreateThread and
CreatePipe
– One thread for stdin, one for stdout
RATs 

(Remote Administration Tools)
• Ex: Poison Ivy
Botnets
• A collection of compromised hosts
– Called bots or zombies
Botnets v. RATs
• Botnet contain many hosts; RATs control
fewer hosts
• All bots are controlled at once; RATs
control victims one by one
• RATs are for targeted attacks; botnets are
used in mass attacks
Credential Stealers
Credential Stealers
• Three types
–Wait for user to log in and steal
credentials
–Dump stored data, such as password
hashes
–Log keystrokes
GINA Interception
• Windows XP's Graphical Identification and
Authentication (GINA)
– Intended to allow third parties to customize
logon process for RFID or smart cards
– Intercepted by malware to steal credentials
• GINA is implemented in msgina.dll
– Loaded by WinLogon executable during logon
• WinLogon also loads third-party customizations
in DLLs loaded between WinLogon and GINA
GINA Registry Key
• HKLMSOFTWAREMicrosoftWindows NT
CurrentVersionWinlogonGinaDLL
• Contains third-party DLLs to be loaded by
WinLogon
MITM Attack
• Malicious DLL must export all functions
the real msgina.dll does, to act as a MITM
– More than 15 functions
– Most start with Wlx
–Good indicator
–Malware DLL exporting a lot of Wlx
functions is probably a GINA interceptor
WlxLoggedOutSAS
• Most exports simply call through to the real
functions in msgina.dll
• At 2, the malware logs the credentials to the
file %SystemRoot%system32driverstcpudp.sys
GINA is Gone
• No longer used in Windows Vista and later
• Replaced by Credential Providers
• Link Ch 11c
Custom Credential Provider Rootkit on
Windows 7
• Two sets of login buttons
• Only steals passwords from second set
• Code is provided to filter out the original set
Hash Dumping
• Windows login passwords are stored as LM
or NTLM hashes
– Hashes can be used directly to authenticate
(pass-the-hash attack)
– Or cracked offline to find passwords
• Pwdump and Pass-the-Hash Toolkit
– Free hacking tools that provide hash dumping
– Open-source
– Code re-used in malware
– Modified to bypass antivirus
Pwdump
• Injects a DLL into LSASS (Local Security
Authority Subsystem Service)
– To get hashes from the SAM (Security Account
Manager)
– Injected DLL runs inside another process
– Gets all the privileges of that process
– LSASS is a common target
• High privileges
• Access to many useful API functions
Pwdump
• Injects lsaext.dll into lsass.exe
– Calls GetHash, an export of lsaext.dll
– Hash extraction uses undocumented Windows
function calls
• Attackers may change the name of the
GetHash function
Pwdump Variant
• Uses these libraries
– samsrv.dll to access the SAM
– advapi32.dll to access functions not already
imported into lsass.exe
– Several Sam functions
– Hashes extracted by SamIGetPrivateData
– Decrypted with SystemFunction025 and
SystemFunction027
• All undocumented functions
Pass-the-Hash Toolkit
• Injects a DLL into lsass.exe to get hashes
– Program named whosthere-alt
• Uses different API functions than Pwdump
Keystroke Logging
• Kernel-Based Keyloggers
– Difficult to detect with user-mode
applications
– Frequently part of a rootkit
– Act as keyboard drivers
– Bypass user-space programs and protections
Keystroke Logging
• User-Space Keyloggers
– Use Windows API
– Implemented with hooking or polling
• Hooking
– Uses SetWindowsHookEx function to notify malware
each time a key is pressed
– Details in next chapter
• Polling
– Uses GetAsyncKeyState & GetForegroundWindow
to constantly poll the state of the keys
Polling Keyloggers
• GetAsyncKeyState
– Identifies whether a key is pressed or
unpressed
• GetForegroundWindow
– Identifies the foreground window
– Loops through all keys, then sleeps briefly
– Repeats frequently enough to capture all
keystrokes
Identifying Keyloggers in Strings Listings
• Run Strings
• Terms like these will
be visible
Persistence Mechanisms
Three Persistence Mechanisms
1.Registry modifications, such as Run key
• Other important registry entries:
– AppInit_DLLs
– Winlogon Notify
– ScvHost DLLs
2.Trojanizing Binaries
3.DLL Load-Order Hijacking
Registry Modifications
• Run key
– HKEY_LOCAL_MACHINE SOFTWARE Microsoft
Windows CurrentVersion Run
– Many others, as revealed by Autoruns
• ProcMon shows all registry modifications
when running malware (dynamic analysis)
• Can detect all these techniques
Process Monitor
APPINIT DLLS
• AppInit_DLLs are loaded into every
process that loads User32.dll
– This registry key contains a space-delimited
list of DLLs
– HKEY_LOCAL_MACHINE SOFTWARE Microsoft
Windows NT CurrentVersion Windows
– Many processes load them
– Malware will call DLLMain to check which
process it is in before launching payload
Winlogon Notify
• Notify value in
– HKEY_LOCAL_MACHINE SOFTWARE Microsoft
Windows
– These DLLs handle winlogon.exe events
– Malware tied to an event like logon, startup,
lock screen, etc.
– It can even launch in Safe Mode
SvcHost DLLs
• Svchost is a generic host process for services
that run as DLLs
• Many instances of Svchost are running at once
• Groups defined at
– HKEY_LOCAL_MACHINE SOFTWARE Microsoft
Windows NT CurrentVersion Svchost
• Services defined at
– HKEY_LOCAL_MACHINE System
CurrentControlSet Services ServiceName
Process Explorer
• Shows many
services running in
one svchost
process
• This is the netsvcs
group
ServiceDLL
• All svchost.exe DLL contain a Parameters
key with a ServiceDLL value
– Malware sets ServiceDLL to location of
malicious DLL
Groups
• Malware usually adds itself to an existing
group
– Or overwrites a non-vital service
– Often a rarely used service from the netsvcs
group
• Detect this with dynamic analysis
monitoring the registry
– Or look for service functions like
CreateServiceA in disassembly
Trojanized System Binaries
• Malware patches bytes of a system binary
• To force the system to execute the malware
the next time the infected binary is loaded
• DLLs are popular targets
• Typically the entry function is modified
• Jumps to code inserted in an empty portion of
the binary
• Then executes DLL normally
DLL Load-Order Hijacking
KnownDLLs Registry Key
• Contains list of specific DLL locations
• Overrides the search order for listed DLLs
• Makes them load faster, and prevents load-
order hijacking
• DLL load-order hijacking can only be used
– On binaries in directories other than System32
– That load DLLs in System32
– That are not protected by KnownDLLs
Example: explorer.exe
• Lives in /Windows
• Loads ntshrui.dll from System32
• ntshrui.dll is not a known DLL
• Default search is performed
• A malicious ntshrui.dll in /Windows will
be loaded instead
Many Vulnerable DLLs
• Any startup binary not found in /System32
is vulnerable
• explorer.exe has about 50 vulnerable DLLs
• Known DLLs are not fully protected,
because
– Many DLLs load other DLLs
– Recursive imports follow the default search
order
DLL Load-Order Hijacking Detector
• Searches for DLLs that appear multiple
times in the file system, in suspicious
folders, and are unsigned
• From SANS (2015) (link Ch 11d)
Privilege Escalation
No User Account Control
• Most users run Windows XP as
Administrator all the time, so no privilege
escalation is needed to become
Administrator
• Metasploit has many privilege escalation
exploits
• DLL load-order hijacking can be used to
escalate privileges
Using SeDebugPrivilege
• Processes run by the user can't do
everything
• Functions like TerminateProcess or
CreateRemoteThread require System
privileges (above Administrator)
• The SeDebugPrivilege privilege was
intended for debugging
• Allows local Administrator accounts to
escalate to System privileges
• 1 obtains an access token
• 2 AdjustTokenPrivileges raises privileges to
System
Covering Its Tracks—

User-Mode Rootkits
User-Mode Rootkits
• Modify internal functionality of the OS
• Hide files, network connections,
processes, etc.
• Kernel-mode rootkits are more powerful
• This section is about User-mode rootkits
IAT (Import Address Table) Hooking
• May modify
– IAT (Import Address Table) or
– EAT (Export Address Table)
• Parts of a PE file
• Filled in by the loader
– Link Ch 11a
– This technique is old and easily detected
IAT Hooking
Inline Hooking
• Overwrites the API function code
• Contained in the imported DLLs
• Changes actual function code, not
pointers
• A more advanced technique than IAT
hooking

Weitere ähnliche Inhalte

Was ist angesagt?

CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static TechniquesCNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static TechniquesSam Bowne
 
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisCNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisSam Bowne
 
How to Hunt for Lateral Movement on Your Network
How to Hunt for Lateral Movement on Your NetworkHow to Hunt for Lateral Movement on Your Network
How to Hunt for Lateral Movement on Your NetworkSqrrl
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgSam Bowne
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware AnalysisAndrew McNicol
 
Practical Malware Analysis Ch12
Practical Malware Analysis Ch12Practical Malware Analysis Ch12
Practical Malware Analysis Ch12Sam Bowne
 
Basic Dynamic Analysis of Malware
Basic Dynamic Analysis of MalwareBasic Dynamic Analysis of Malware
Basic Dynamic Analysis of MalwareNatraj G
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorSam Bowne
 
Metasploit
MetasploitMetasploit
Metasploithenelpj
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applicationsNiyas Nazar
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static AnalysisHossein Yavari
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeSam Bowne
 
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in Assembly
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in AssemblyPractical Malware Analysis: Ch 6: Recognizing C Code Constructs in Assembly
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in AssemblySam Bowne
 
Password Cracking
Password CrackingPassword Cracking
Password CrackingSagar Verma
 
Malware- Types, Detection and Future
Malware- Types, Detection and FutureMalware- Types, Detection and Future
Malware- Types, Detection and Futurekaranwayne
 
Practical Malware Analysis: Ch 15: Anti-Disassembly
Practical Malware Analysis: Ch 15: Anti-DisassemblyPractical Malware Analysis: Ch 15: Anti-Disassembly
Practical Malware Analysis: Ch 15: Anti-DisassemblySam Bowne
 

Was ist angesagt? (20)

CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static TechniquesCNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
 
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic AnalysisCNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
CNIT 126 2: Malware Analysis in Virtual Machines & 3: Basic Dynamic Analysis
 
How to Hunt for Lateral Movement on Your Network
How to Hunt for Lateral Movement on Your NetworkHow to Hunt for Lateral Movement on Your Network
How to Hunt for Lateral Movement on Your Network
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware Analysis
 
Practical Malware Analysis Ch12
Practical Malware Analysis Ch12Practical Malware Analysis Ch12
Practical Malware Analysis Ch12
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
Basic Dynamic Analysis of Malware
Basic Dynamic Analysis of MalwareBasic Dynamic Analysis of Malware
Basic Dynamic Analysis of Malware
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware Behavior
 
Metasploit
MetasploitMetasploit
Metasploit
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static Analysis
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: Shellcode
 
malware analysis
malware  analysismalware  analysis
malware analysis
 
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in Assembly
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in AssemblyPractical Malware Analysis: Ch 6: Recognizing C Code Constructs in Assembly
Practical Malware Analysis: Ch 6: Recognizing C Code Constructs in Assembly
 
Password Cracking
Password CrackingPassword Cracking
Password Cracking
 
Malware- Types, Detection and Future
Malware- Types, Detection and FutureMalware- Types, Detection and Future
Malware- Types, Detection and Future
 
Secure Session Management
Secure Session ManagementSecure Session Management
Secure Session Management
 
Malware analysis
Malware analysisMalware analysis
Malware analysis
 
Practical Malware Analysis: Ch 15: Anti-Disassembly
Practical Malware Analysis: Ch 15: Anti-DisassemblyPractical Malware Analysis: Ch 15: Anti-Disassembly
Practical Malware Analysis: Ch 15: Anti-Disassembly
 

Ähnlich wie Practical Malware Analysis: Ch 11: Malware Behavior

CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorSam Bowne
 
CNIT 126 12: Covert Malware Launching
CNIT 126 12: Covert Malware LaunchingCNIT 126 12: Covert Malware Launching
CNIT 126 12: Covert Malware LaunchingSam Bowne
 
CNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsCNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsSam Bowne
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat HuntingGIBIN JOHN
 
CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)Sam Bowne
 
CNIT 152: 12b Windows Registry
CNIT 152: 12b Windows RegistryCNIT 152: 12b Windows Registry
CNIT 152: 12b Windows RegistrySam Bowne
 
CNIT 152 12. Investigating Windows Systems (Part 3)
CNIT 152 12. Investigating Windows Systems (Part 3)CNIT 152 12. Investigating Windows Systems (Part 3)
CNIT 152 12. Investigating Windows Systems (Part 3)Sam Bowne
 
CNIT 152 12 Investigating Windows Systems (Part 2)
CNIT 152 12 Investigating Windows Systems (Part 2)CNIT 152 12 Investigating Windows Systems (Part 2)
CNIT 152 12 Investigating Windows Systems (Part 2)Sam Bowne
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfRohitGautam261127
 
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsCNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsSam Bowne
 
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
Windows internals
Windows internalsWindows internals
Windows internalsPiyush Jain
 
Windows Malware Techniques
Windows Malware TechniquesWindows Malware Techniques
Windows Malware TechniquesLee C
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2Royce Davis
 
Fileless Malware Infections
Fileless Malware InfectionsFileless Malware Infections
Fileless Malware InfectionsRamon
 

Ähnlich wie Practical Malware Analysis: Ch 11: Malware Behavior (20)

CNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware Behavior
 
CNIT 126 12: Covert Malware Launching
CNIT 126 12: Covert Malware LaunchingCNIT 126 12: Covert Malware Launching
CNIT 126 12: Covert Malware Launching
 
CNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows ProgramsCNIT 126 7: Analyzing Malicious Windows Programs
CNIT 126 7: Analyzing Malicious Windows Programs
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
 
CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)
 
CNIT 152: 12b Windows Registry
CNIT 152: 12b Windows RegistryCNIT 152: 12b Windows Registry
CNIT 152: 12b Windows Registry
 
CNIT 152 12. Investigating Windows Systems (Part 3)
CNIT 152 12. Investigating Windows Systems (Part 3)CNIT 152 12. Investigating Windows Systems (Part 3)
CNIT 152 12. Investigating Windows Systems (Part 3)
 
CNIT 152 12 Investigating Windows Systems (Part 2)
CNIT 152 12 Investigating Windows Systems (Part 2)CNIT 152 12 Investigating Windows Systems (Part 2)
CNIT 152 12 Investigating Windows Systems (Part 2)
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 152: 12 Investigating Windows Systems (Part 2 of 3)
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
Ch0 1
Ch0 1Ch0 1
Ch0 1
 
unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdf
 
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows ProgramsCNIT 126 Ch 7: Analyzing Malicious Windows Programs
CNIT 126 Ch 7: Analyzing Malicious Windows Programs
 
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
 
Windows internals
Windows internalsWindows internals
Windows internals
 
Botnets Attacks.pptx
Botnets Attacks.pptxBotnets Attacks.pptx
Botnets Attacks.pptx
 
Windows Malware Techniques
Windows Malware TechniquesWindows Malware Techniques
Windows Malware Techniques
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2
 
Fileless Malware Infections
Fileless Malware InfectionsFileless Malware Infections
Fileless Malware Infections
 

Mehr von Sam Bowne

3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities Sam Bowne
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the ApplicationSam Bowne
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)Sam Bowne
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic CurvesSam Bowne
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-HellmanSam Bowne
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1Sam Bowne
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android ApplicationsSam Bowne
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3Sam Bowne
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard ProblemsSam Bowne
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)Sam Bowne
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis MethodologySam Bowne
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated EncryptionSam Bowne
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)Sam Bowne
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)Sam Bowne
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream CiphersSam Bowne
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data CollectionSam Bowne
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers Sam Bowne
 

Mehr von Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 

Kürzlich hochgeladen

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Kürzlich hochgeladen (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

Practical Malware Analysis: Ch 11: Malware Behavior

  • 1. Practical Malware Analysis Ch 11: Malware Behavior Last revised 4-9-17
  • 3. Downloaders • Download another piece of malware – And execute it on the local system • Commonly use the Windows API URLDownloadtoFileA, followed by a call to WinExec
  • 4. Launchers (aka Loaders) • Prepares another piece of malware for covert execution – Either immediately or later – Stores malware in unexpected places, such as the .rsrc section of a PE file
  • 6. Backdoors • Provide remote access to victim machine • The most common type of malware • Often communicate over HTTP on Port 80 – Network signatures are helpful for detection • Common capabilities – Manipulate Registry, enumerate display windows, create directories, search files, etc.
  • 7. Reverse Shell • Infected machine calls out to attacker, asking for commands to execute
  • 8. Windows Reverse Shells • Basic – Call CreateProcess and manipulate STARTUPINFO structure – Create a socket to remote machine – Then tie socket to standard input, output, and error for cmd.exe – CreateProcess runs cmd.exe with its window suppressed, to hide it
  • 9. Windows Reverse Shells • Multithreaded – Create a socket, two pipes, and two threads – Look for API calls to CreateThread and CreatePipe – One thread for stdin, one for stdout
  • 10. RATs 
 (Remote Administration Tools) • Ex: Poison Ivy
  • 11. Botnets • A collection of compromised hosts – Called bots or zombies
  • 12. Botnets v. RATs • Botnet contain many hosts; RATs control fewer hosts • All bots are controlled at once; RATs control victims one by one • RATs are for targeted attacks; botnets are used in mass attacks
  • 14. Credential Stealers • Three types –Wait for user to log in and steal credentials –Dump stored data, such as password hashes –Log keystrokes
  • 15. GINA Interception • Windows XP's Graphical Identification and Authentication (GINA) – Intended to allow third parties to customize logon process for RFID or smart cards – Intercepted by malware to steal credentials • GINA is implemented in msgina.dll – Loaded by WinLogon executable during logon • WinLogon also loads third-party customizations in DLLs loaded between WinLogon and GINA
  • 16. GINA Registry Key • HKLMSOFTWAREMicrosoftWindows NT CurrentVersionWinlogonGinaDLL • Contains third-party DLLs to be loaded by WinLogon
  • 17. MITM Attack • Malicious DLL must export all functions the real msgina.dll does, to act as a MITM – More than 15 functions – Most start with Wlx –Good indicator –Malware DLL exporting a lot of Wlx functions is probably a GINA interceptor
  • 18. WlxLoggedOutSAS • Most exports simply call through to the real functions in msgina.dll • At 2, the malware logs the credentials to the file %SystemRoot%system32driverstcpudp.sys
  • 19. GINA is Gone • No longer used in Windows Vista and later • Replaced by Credential Providers • Link Ch 11c
  • 20. Custom Credential Provider Rootkit on Windows 7 • Two sets of login buttons • Only steals passwords from second set • Code is provided to filter out the original set
  • 21. Hash Dumping • Windows login passwords are stored as LM or NTLM hashes – Hashes can be used directly to authenticate (pass-the-hash attack) – Or cracked offline to find passwords • Pwdump and Pass-the-Hash Toolkit – Free hacking tools that provide hash dumping – Open-source – Code re-used in malware – Modified to bypass antivirus
  • 22. Pwdump • Injects a DLL into LSASS (Local Security Authority Subsystem Service) – To get hashes from the SAM (Security Account Manager) – Injected DLL runs inside another process – Gets all the privileges of that process – LSASS is a common target • High privileges • Access to many useful API functions
  • 23. Pwdump • Injects lsaext.dll into lsass.exe – Calls GetHash, an export of lsaext.dll – Hash extraction uses undocumented Windows function calls • Attackers may change the name of the GetHash function
  • 24. Pwdump Variant • Uses these libraries – samsrv.dll to access the SAM – advapi32.dll to access functions not already imported into lsass.exe – Several Sam functions – Hashes extracted by SamIGetPrivateData – Decrypted with SystemFunction025 and SystemFunction027 • All undocumented functions
  • 25.
  • 26. Pass-the-Hash Toolkit • Injects a DLL into lsass.exe to get hashes – Program named whosthere-alt • Uses different API functions than Pwdump
  • 27. Keystroke Logging • Kernel-Based Keyloggers – Difficult to detect with user-mode applications – Frequently part of a rootkit – Act as keyboard drivers – Bypass user-space programs and protections
  • 28. Keystroke Logging • User-Space Keyloggers – Use Windows API – Implemented with hooking or polling • Hooking – Uses SetWindowsHookEx function to notify malware each time a key is pressed – Details in next chapter • Polling – Uses GetAsyncKeyState & GetForegroundWindow to constantly poll the state of the keys
  • 29. Polling Keyloggers • GetAsyncKeyState – Identifies whether a key is pressed or unpressed • GetForegroundWindow – Identifies the foreground window – Loops through all keys, then sleeps briefly – Repeats frequently enough to capture all keystrokes
  • 30.
  • 31. Identifying Keyloggers in Strings Listings • Run Strings • Terms like these will be visible
  • 33. Three Persistence Mechanisms 1.Registry modifications, such as Run key • Other important registry entries: – AppInit_DLLs – Winlogon Notify – ScvHost DLLs 2.Trojanizing Binaries 3.DLL Load-Order Hijacking
  • 34. Registry Modifications • Run key – HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows CurrentVersion Run – Many others, as revealed by Autoruns • ProcMon shows all registry modifications when running malware (dynamic analysis) • Can detect all these techniques
  • 36. APPINIT DLLS • AppInit_DLLs are loaded into every process that loads User32.dll – This registry key contains a space-delimited list of DLLs – HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows NT CurrentVersion Windows – Many processes load them – Malware will call DLLMain to check which process it is in before launching payload
  • 37. Winlogon Notify • Notify value in – HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows – These DLLs handle winlogon.exe events – Malware tied to an event like logon, startup, lock screen, etc. – It can even launch in Safe Mode
  • 38. SvcHost DLLs • Svchost is a generic host process for services that run as DLLs • Many instances of Svchost are running at once • Groups defined at – HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows NT CurrentVersion Svchost • Services defined at – HKEY_LOCAL_MACHINE System CurrentControlSet Services ServiceName
  • 39. Process Explorer • Shows many services running in one svchost process • This is the netsvcs group
  • 40.
  • 41. ServiceDLL • All svchost.exe DLL contain a Parameters key with a ServiceDLL value – Malware sets ServiceDLL to location of malicious DLL
  • 42. Groups • Malware usually adds itself to an existing group – Or overwrites a non-vital service – Often a rarely used service from the netsvcs group • Detect this with dynamic analysis monitoring the registry – Or look for service functions like CreateServiceA in disassembly
  • 43. Trojanized System Binaries • Malware patches bytes of a system binary • To force the system to execute the malware the next time the infected binary is loaded • DLLs are popular targets • Typically the entry function is modified • Jumps to code inserted in an empty portion of the binary • Then executes DLL normally
  • 44.
  • 46. KnownDLLs Registry Key • Contains list of specific DLL locations • Overrides the search order for listed DLLs • Makes them load faster, and prevents load- order hijacking • DLL load-order hijacking can only be used – On binaries in directories other than System32 – That load DLLs in System32 – That are not protected by KnownDLLs
  • 47. Example: explorer.exe • Lives in /Windows • Loads ntshrui.dll from System32 • ntshrui.dll is not a known DLL • Default search is performed • A malicious ntshrui.dll in /Windows will be loaded instead
  • 48. Many Vulnerable DLLs • Any startup binary not found in /System32 is vulnerable • explorer.exe has about 50 vulnerable DLLs • Known DLLs are not fully protected, because – Many DLLs load other DLLs – Recursive imports follow the default search order
  • 49. DLL Load-Order Hijacking Detector • Searches for DLLs that appear multiple times in the file system, in suspicious folders, and are unsigned • From SANS (2015) (link Ch 11d)
  • 51. No User Account Control • Most users run Windows XP as Administrator all the time, so no privilege escalation is needed to become Administrator • Metasploit has many privilege escalation exploits • DLL load-order hijacking can be used to escalate privileges
  • 52. Using SeDebugPrivilege • Processes run by the user can't do everything • Functions like TerminateProcess or CreateRemoteThread require System privileges (above Administrator) • The SeDebugPrivilege privilege was intended for debugging • Allows local Administrator accounts to escalate to System privileges
  • 53. • 1 obtains an access token
  • 54. • 2 AdjustTokenPrivileges raises privileges to System
  • 56. User-Mode Rootkits • Modify internal functionality of the OS • Hide files, network connections, processes, etc. • Kernel-mode rootkits are more powerful • This section is about User-mode rootkits
  • 57. IAT (Import Address Table) Hooking • May modify – IAT (Import Address Table) or – EAT (Export Address Table) • Parts of a PE file • Filled in by the loader – Link Ch 11a – This technique is old and easily detected
  • 59. Inline Hooking • Overwrites the API function code • Contained in the imported DLLs • Changes actual function code, not pointers • A more advanced technique than IAT hooking