Lateral Movement

Jump to other users inside the machine, don't jump into a hole for a long time.

Check Active Network Connection

Check possibility of hidden network or ports.

# Windows
netstat -antp

# linux
netstat -tulpn

Type of Lateral Movement:

  • Pass-the-Hash, Pass-the-Ticket, Overpass-the-Hash and bypass MFA for access to Windows

  • Lands on system via phishing

Mimikatz to bypass MFA --> use dcsync

lsadump::dcsync /user:<current user>
# get the HASH from [Primary:Kerberos-Newer-Keys *] --> [Credentials] --> [aes256_hmac]

# overpass the hash
sekurlsa::pth /user:<current user> /domain:<domain> /aes256:<HASH>

# cmd appears as another user in the another machine

# access other computer
Enter-PSSession -ComputerName <other computer>

# ref: https://www.youtube.com/watch?v=Fmbp34dBuMc

Linux Lateral Movement with ControlMaster

ControlMaster is a feature that enables sharing of multiple SSH sessions over a single network connection. We have to wait for user to connect to controlmaster then hijact the session.

Check the current compromised linux machine:

Watch the session user logon in the folder ~/.ssh/controlmaster/

there is new file come up like this:

hijack it using this command in the current machine.

Ansible

commonly user to run ansible is high privilege.

controller server must have /etc/ansible/hosts

or

check with ansible command in the server.

Command

playbook

/opt/playbooks

code execution on the target computer with playbooks

run with this command

yaml file sometimes contains password plain text and encrypted password

if encrypted:

upload the ansible hash vault to the compromized machine that install ansible-vault, save it to password.hash

Able to write the playbook.yaml?

add this to make a backdoor in the playbook.yaml

RCE

VIM Backdoor

Option 1

create ~/.vimrc

Option 2

create ~/.vimrc

.vimrunscript contains the bash script.

sometimes when user run sudo vi, it's using vimrc from root directory. but we can create an backdoor of it.

VIM Keylogger

create ~/.vimrc file:

or this payload more advanced:

~/vimrc

reference:

https://highon.coffee/blog/ssh-lateral-movement-cheat-sheet/

Last updated