CVE漏洞复现-CVE-2021-22555 Linux Netfilter 权限提升漏洞

CVE-2021-22555 Linux Netfilter 权限提升漏洞

漏洞描述

近日,互联网公开了Linux Netfilter权限提升漏洞的POC及EXP,相关CVE编号:CVE-2021-22555。该漏洞在kCTF中被用于攻击kubernetes pod容器实现虚拟化逃逸,该漏洞已在Linux内核代码中存在15年,Netfilter是Linux 2.4.x引入的一个子系统,它作为一个通用的、抽象的框架,提供一整套的hook函数的管理机制,使得诸如数据包过滤、网络地址转换(NAT)和基于协议类型的连接跟踪成为了可能。Linux Netfilter模块在实现IPT_SO_SET_REPLACE(或IP6T_SO_SET_REPLACE)setsockopt时存在堆越界写入漏洞,本地攻击者通过该漏洞实现权限提升。

漏洞危害

攻击者可以通过利用此漏洞进行本地权限提升与容器逃逸

漏洞影响

一个影响2006年(Linux kernel v2.6.19-rc1 发布)至今(Linux kernel v5.12-rc8)的所有Linux内核版本的漏洞,可导致本地提权与容器逃逸

漏洞复现

EXP下载地址:https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555

上传EXP到目标机器上,执行以下命令进行编译并进行提权

gcc -m32 -static -o exploit exploit.c
./exploit
theflow@theflow:~$ gcc -m32 -static -o exploit exploit.c
theflow@theflow:~$ ./exploit
[+] Linux Privilege Escalation by theflow@ - 2021

[+] STAGE 0: Initialization
[*] Setting up namespace sandbox...
[*] Initializing sockets and message queues...

[+] STAGE 1: Memory corruption
[*] Spraying primary messages...
[*] Spraying secondary messages...
[*] Creating holes in primary messages...
[*] Triggering out-of-bounds write...
[*] Searching for corrupted primary message...
[+] fake_idx: ffc
[+] real_idx: fc4

[+] STAGE 2: SMAP bypass
[*] Freeing real secondary message...
[*] Spraying fake secondary messages...
[*] Leaking adjacent secondary message...
[+] kheap_addr: ffff91a49cb7f000
[*] Freeing fake secondary messages...
[*] Spraying fake secondary messages...
[*] Leaking primary message...
[+] kheap_addr: ffff91a49c7a0000

[+] STAGE 3: KASLR bypass
[*] Freeing fake secondary messages...
[*] Spraying fake secondary messages...
[*] Freeing sk_buff data buffer...
[*] Spraying pipe_buffer objects...
[*] Leaking and freeing pipe_buffer object...
[+] anon_pipe_buf_ops: ffffffffa1e78380
[+] kbase_addr: ffffffffa0e00000

[+] STAGE 4: Kernel code execution
[*] Spraying fake pipe_buffer objects...
[*] Releasing pipe_buffer objects...
[*] Checking for root...
[+] Root privileges gained.

[+] STAGE 5: Post-exploitation
[*] Escaping container...
[*] Cleaning up...
[*] Popping root shell...
root@theflow:/# id
uid=0(root) gid=0(root) groups=0(root)
root@theflow:/#

漏洞修复

1、漏洞修复建议
建议受影响的用户及时升级 Linux 内核到安全版本

2、临时缓解措施:
根据RedHat建议,用户可通过以下命令禁止非特权用户执行CLONE_NEWUSER、CLONE_NEWNET来缓解该漏洞带来的影响:

echo 0 > /proc/sys/user/max_user_namespaces 
CVE-2021-22555是一个内核组件kernel-netfilter漏洞,属于Linux Kernel的堆溢出和特权提升类型的漏洞。它影响的版本范围是从Linux Kernel v2.6.19-rc1到v5.12-rc8。这个漏洞是在2006年由commit 9fa492cdc160cd27ce1046cb36f47d3b2b1efa21引入的,并在2021年由commit b29c457a6511435960115c0f548c4360d5f4801d进行修复。关于具体的漏洞细节和修复措施,你可以参考原文链接进行查询。123 #### 引用[.reference_title] - *1* [所学漏洞总结](https://blog.csdn.net/weixin_45540609/article/details/119995708)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *2* [一个内核网络漏洞详解|容器逃逸](https://blog.csdn.net/lianhunqianr1/article/details/119746033)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *3* [关于内核堆溢出漏洞的分析](https://blog.csdn.net/m0_59598029/article/details/128859432)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

怰月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值