Lateral Movement Detection Using ELK Stack
Total Page:16
File Type:pdf, Size:1020Kb
Lateral movement detection using ELK stack A Thesis Presented to the Faculty of the Department of Information and Logistics Technology University of Houston In Partial Fulfillment Of the Requirements for the Degree Master of Science Information System Security By Utkarsh Jain May 2018 Lateral movement detection using ELK stack ________________________________ Utkarsh Jain APPROVED: ________________________________ Wm. Arthur Conklin, PhD Committee Chair Associate Professor Information and Logistics Technology ________________________________ Chris Bronk, PhD Assistant Professor Information and Logistics Technology ________________________________ Denise M Kinsey, PhD Assistant Professor Information and Logistics Technology ________________________________ ________________________________ George Zouridakis, PhD Dan Cassler Associate Dean of Research and Graduate Studies Interim Chair, Department of College of Technology Information and Logistics Technology Abstract In recent time, it is becoming increasingly difficult to prevent initial infiltration of a network, making it important to always consider and improve detection of an ongoing incident. Any attacker spends most energy, time and is additionally the most defenseless against detection when the attacker is trying to move laterally from system to system to escalate privileges. This research takes into consideration, majority of tools and techniques used by adversaries to move in a windows-based network laterally. It showcases the execution of these tools and suggests how usage of such tools can be detected using logging. Hence, this research is an attempt at creating a solution which helps in detection of lateral movement happening inside a windows-based network by collecting logs and analyzing them using ELK stack as the logging tool. Table of Contents Contents INTRODUCTION ............................................................................................................................ 1 LATERAL MOVEMENT .................................................................................................................. 3 DIFFERENT TECHNIQUES USED FOR LATERAL MOVEMENT .......................................................... 5 Using Psexec ........................................................................................................................... 5 Exploitation of Remote Services ............................................................................................. 6 Remote desktop protocol ......................................................................................................... 6 Remote registry ....................................................................................................................... 7 Windows Admin Shares........................................................................................................... 7 Windows Remote Management ............................................................................................... 8 PowerShell .............................................................................................................................. 8 Port-scans ............................................................................................................................... 9 WMI......................................................................................................................................... 9 Scheduled tasks ..................................................................................................................... 10 Token stealing ....................................................................................................................... 10 Pass the hash......................................................................................................................... 11 Pass the Ticket ...................................................................................................................... 11 Active directory ..................................................................................................................... 12 Stolen credentials .................................................................................................................. 12 Breached host analysis ......................................................................................................... 13 Network sniffing .................................................................................................................... 13 ARP spoofing ........................................................................................................................ 13 Email pillaging...................................................................................................................... 14 Application Deployment Software ........................................................................................ 14 Distributed Component Object Model .................................................................................. 15 Logon Scripts ........................................................................................................................ 15 Replication Through Removable Media ............................................................................... 16 SSH Hijacking ....................................................................................................................... 16 Taint Shared Content ............................................................................................................ 17 Third-party Software ............................................................................................................. 18 ELK STACK ................................................................................................................................ 19 Technical specification of ELK stack .................................................................................... 23 Data sources supported ..................................................................................................... 23 Data storage capabilities ................................................................................................... 23 Processing capabilities of ELK ......................................................................................... 26 Event management and Visualization capabilities ........................................................... 29 Exposed APIs (Application Programming Interface) ....................................................... 31 Resilience .......................................................................................................................... 32 Implementation and configuring ELK stack ......................................................................... 34 Deployment of ELK .......................................................................................................... 35 Creating New Connectors ................................................................................................. 40 PowerShell Logging .............................................................................................................. 42 Setup of PowerShell Logging in ELK stack ..................................................................... 43 Requirements ................................................................................................................ 43 Installation of Windows Management Framework (WMF) ......................................... 43 Setting up Enhanced PowerShell Logging ................................................................... 45 Ship PowerShell logs to ELK ....................................................................................... 47 Understanding PowerShell logs on ELK .......................................................................... 48 DETECTING LATERAL MOVEMENT ............................................................................................. 49 Test case 1: Using Psexec ..................................................................................................... 50 Test Case 2: PowerShell (Remote Command Execution) ..................................................... 53 Test Case 3: WinRM ............................................................................................................. 55 Test Case 4: WinRS ............................................................................................................... 57 Test Case 5: WMIC (Windows Management Instrumentation Command Line) ................... 60 Test Case 6: wmiexec.vbs ..................................................................................................... 62 Test Case 7: PWDumpX........................................................................................................ 64 Test Case 8: Quarks PwDump .............................................................................................. 66 Test Case 9: WCE ................................................................................................................. 67 Test Case 10: WCE ............................................................................................................... 69 Test Case 11: Golden Ticket (mimikatz) ............................................................................... 71 Test Case 12: Silver Ticket (mimikatz) ................................................................................. 73 Test Case 13: AT Command ................................................................................................