Linux

After gaining user, you can run these checks to discover more information

You can always run linpeas.sh, but if you don't want to deal with the text diarrhea, you can run these checks instead

Permissions

Check user and group permissions

Check your identity and find files and directories you have permissions to and GTFO - https://gtfobins.github.io/

$ id
$ find / -user <user> -type f 2>/dev/null
$ find / -user <user> -type d 2>/dev/null
$ find / -group <group> -type f 2>/dev/null
$ find / -group <group> -type d 2>/dev/null

Check Sudo permissions

Shows all command this user can run as sudo

$ sudo -l

Check for configs that are preserved with env_keep which can be used to preload custom files

Check SUID and SGID

Find all binaries with sticky bit set and GTFO - https://gtfobins.github.io/#+suid

$ find / -perm -u=s -type f 2>/dev/null
$ find / -perm -g=s -type f 2>/dev/null

Check Capabilities

Gets capabilities of binaries and GTFO - https://gtfobins.github.io/#+capabilitiese

Discovering Services

Check Local Services

Check for local services running on the victim machine

Find all listening services and use SSH port forwarding to forward the service to your machine

On the victim machine, add the attacker's public key in /home/victim/.ssh/authorized_keys

For SSH tunneling, run this on the attacker

Or use FRPC to expose the local service directly. In the example below, we expose a serivce running on port 3001 on the victim to port 6000 globally

Copy frpc and frpc.ini to the victim and run:

On the attacker server, start frps

Check Cronjobs

Run pspy64 to check running process (likely cron)

https://github.com/DominicBreuker/pspy

Information from Artifacts

Check configuration files in

  • /etc/mysql/my.cnf

  • /etc/apache2/apache2.conf

  • /etc/apache2/sites-enabled/000-default.conf

  • etc/nginx/sites-available/default.conf

  • etc/nginx/nginx.conf

Check mail

  • /var/mail

  • /var/spool/mail

Check interesting folders

  • /opt

  • /var/backups

Check for most recently modified files

Check Audit Log

If in group adm, check

  • /var/logs/audit

Run aureport --help to visualize the audit logs

Check mounts

Check the mounts /dev/sda*

Check library loads in Binary

Check binaries being used that do not use absolute path. We can highjack the binaries loaded using relative paths

Check memory dump

Kill the running process

Get the data from the crash log

Check Processes running in /proc

Last updated