hak5.org_LinuxUnixBSDPost-ExploitationCommandList_copy-20130228.pdf

(274 KB) Pobierz
Linux/Unix/BSD Post­Exploitation
Command List
If for any reason you cannot access/edit these files in the future, please contact
mubix@hak5.org
You can download these files in any format using Google   Doc’s
File­>Download As method
If you are viewing this on anything other than Google Docs, you can get
access to the latest links to the Linux/Unix/BSD, OS X, Obscure, Metasploit, and
Windows docs here: 
http://bit.ly/nuc0N0
DISCLAIMER: Anyone can edit these docs, and all that entails and implies
Linux/Unix/BSD Post Exploitation Command List ­ Page: 1
Table of Contents
Table of Contents
Information
Blind Files
System
Networking
User accounts
Credentials
Configs
Determine Distro
Installed Packages
Package Sources
Finding Important Files
Covering Your Tracks
Avoiding history filesmys
Obtain users’ information
Escalating
Looking for possible opened paths
Maintaining control
Reverse Shell
Fun if Windows is present and accessible
Stuff to be sorted
Deleting and Destroying
Execute a remote script
Fork Bomb
Linux/Unix/BSD Post Exploitation Command List ­ Page: 2
Information
Blind Files
(things to pull when all you can do is blindly read) LFI/dir traversal (Don’t forget %00!)
File
/etc/resolv.conf
Contents and Reason
Contains the current name servers (DNS) for the
system. This is a globally readable file that is less
likely to trigger IDS alerts than /etc/passwd
Message of the Day.
Debian ­ current version of distro
List of local users
List of users’ passwords’ hashes (requires root)
Will give you some directory context
/etc/motd
/etc/issue
/etc/passwd
/etc/shadow
/home/xxx/.bash_history
System
Command
uname ­a
ps aux
top ­n 1 ­d
Description and/or Reason
Prints the kernel version, arch, sometimes distro, ...
List all running processes
Print process, 1 is a number of lines
id
arch, uname ­m
w
Your current username, groups
Kernel processor architecture
who is connected, uptime and load avg
Linux/Unix/BSD Post Exploitation Command List ­ Page: 3
who ­a
gcc ­v
mysql ­­version
perl ­v
ruby ­v
python ­­version
df ­k
mount
last ­a
lastcomm
lastlog
lastlogin (BSD)
getenforce
uptime, runlevel, tty, proceses etc.
Returns the version of GCC.
Returns the version of MySQL.
Returns the version of Perl.
Returns the version of Ruby.
Returns the version of Python.
mounted fs, size, % use, dev and mount point[
mounted fs
Last users logged on
Get the status of SELinux (Enforcing, Permissive or
Disabled)
Informations from the last system boot
prints all PCI buses and devices
prints all USB buses and devices/h
prints CPU information
dmesg
lspci
lsusb
lscpu
lshw
ex
cat /proc/cpuinfo
cat /proc/meminfo
du ­h ­­max­depth=1 /
which nmap
(note: can cause heavy disk i/o)
locate a command (ie nmap or nc)
locate bin/nmap
Linux/Unix/BSD Post Exploitation Command List ­ Page: 4
locate bin/nc
jps ­l
java ­version
Returns the version of Java.
Networking
● hostname ­f
● ip addr show
● ip ro show
● ifconfig ­a
● route ­n
● cat /etc/network/interfaces
● iptables ­L ­n ­v
● iptables ­t nat ­L ­n ­v
● ip6tables ­L ­n ­v
● iptables­save
● netstat ­anop
● netstat ­r
● netstat ­nltupw (root with raw sockets)
● arp ­a
● lsof ­nPi
to resume it → “cat /proc/net/*” (more discreet)
what does the above mean? ­> It means that all the information given by the above commands can be
found by looking into the files under /proc/net , and that this approach is less likely to trigger monitoring
or other stuff.
User accounts
local accounts: cat /etc/passwd
○ password hashes in /etc/shadow on Linux
○ password hashes in /etc/security/passwd on AIX
○ groups in /etc/group (and/or /etc/gshadow on Linux)
all accounts: getent passwd
○ should dump local, LDAP, NIS, whatever the system is using
○ same with getent group
Samba’s own database: pdbedit ­L ­w or pdbedit ­L ­v
Linux/Unix/BSD Post Exploitation Command List ­ Page: 5
Zgłoś jeśli naruszono regulamin