整个应该从CSAW 2015 stringipc来看

这道core看起来似乎跟上面那个stringipc是一模一样
但是总会有不同
区别就首先不让读写0xffffffff80000000往前的地址
这直接导致我们不能覆写cred
上次的第一个思路就没了
然后它又用的是最新的内核
新的内核中专门对劫持vdso的攻击手段
所以要介绍一个新的思路
劫持prctl函数,它能够让我们从局部地址读写一直到任意代码执行
prctl有5个参数,prctl将参数原封不动传给了security_task_prctl函数去处理。
security_task_prctl最后定位到一个虚表,调用hp->hook.task_prctl。
最后长这个样子
int(*task_prctl)(int option, unsignedlong arg2, unsignedlong arg3,
unsignedlong arg4, unsignedlong arg5);
那么我们要劫持task_prctl指针去哪?
我们首先要介绍这么一个函数
叫 call_usermoderhelper()
这函数是干嘛的
就相当于用户态的execve()
所以我们最后都要试图去调用这个函数
但是我们看到task_prctl函数的第一个参数类型是int
64位参数传过去会被截断
所以我们需要找一个函数,这个函数里面包装了call_usermoderhelper
我们又把目光聚焦到__orderly_poweroff函数上
staticint __orderly_poweroff(bool force)
{
int ret;
ret = run_cmd(poweroff_cmd);
if(ret && force) {
pr_warn("Failed to start orderly shutdown: forcing the issue\n");
/*
* I guess this should try to kick off some daemon to sync and
* poweroff asap. Ornot even bother syncing if we're doing an
* emergency shutdown?
*/
emergency_sync();
kernel_power_off();
}
这个函数中我们发现里面会调用run_cmd函数
这个函数中就会最后去执行call_usermoderhelper函数
而且参数poweroff_cmd居然是一个全局变量
所以我们可以很容易的去控制那个变量最后去利用。
这个题网上脚本很多,所以我们就好好调一下。
中间有别的事隔了太久了 不想看了
鸽鸽鸽
先把直接用的脚本贴过来
这个脚本应该是solid_core出题人的exp吧
里面当然有注释
也是嫖来的
平凡之路
#include<stdio.h>
#include<sys/prctl.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#include<sys/auxv.h>
#define CSAW_IOCTL_BASE 0x77617363
#define CSAW_ALLOC_CHANNEL CSAW_IOCTL_BASE+1
#define CSAW_OPEN_CHANNEL CSAW_IOCTL_BASE+2
#define CSAW_GROW_CHANNEL CSAW_IOCTL_BASE+3
#define CSAW_SHRINK_CHANNEL CSAW_IOCTL_BASE+4
#define CSAW_READ_CHANNEL CSAW_IOCTL_BASE+5
#define CSAW_WRITE_CHANNEL CSAW_IOCTL_BASE+6
#define CSAW_SEEK_CHANNEL CSAW_IOCTL_BASE+7
#define CSAW_CLOSE_CHANNEL CSAW_IOCTL_BASE+8
struct alloc_channel_args {
size_t buf_size;
int</

这篇博客介绍了通过CSAW2015中的一个内核漏洞,详细阐述了如何利用该漏洞进行内存操作,包括读取VDSO地址、获取内核基址、劫持prctl函数指针,最终实现调用call_usermodehelper执行任意命令。过程中涉及的关键步骤包括爆破VDSO地址、修改内核函数指针、执行命令的流程等。
最低0.47元/天 解锁文章
922

被折叠的 条评论
为什么被折叠?



