Linux Local Enumeration

#Local Enumeration

#System Information

  • In the Meterpreter session

getuid
	Server username: uid=0, gid=0, euid=0, egid=0
sysinfo
    Computer     : 192.218.227.3
    OS           : Debian 9.5 (Linux 5.4.0-131-generic)
    Architecture : x64
    BuildTuple   : i486-linux-musl
    Meterpreter  : x86/linux
shell
/bin/bash -i
cd /root
  • In the /bin/bash session

hostname
	victim-1
cat /etc/issue
	Debian GNU/Linux 9
	
cat /etc/*release
  • 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

  • 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

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

  • Enumerate local system information

  • Check if the target is a VM or a container

#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

#Some Post Exploitation imp modules

  • Enumerate ssh directories

  • Enumerate users' .ecrypts directories

  • Enumerate WiFi credentials

  • Check for PPTP VPN chap-secrets credentials

Last updated