VED进化过程
赛博堡垒之前的文章中介绍了Linux内核安全的现状和挑战以及云原生和车联网方案中第三方Linux内核安全方案的场景。赛博堡垒致力于为运行(GNU)-Linux系统的平台和基础架构构建全栈安全方案,在这个过程中我们从PaX/GRsecurity中学习了很多东西,从2010年开始我们持续研究了不同场景下的Linux内核漏洞利用的方法,有些案例是公开的而有些则是并未公开,到2021年赛博堡垒(HardenedVault)成立后我们开始着手研究如何能在部署简易度,性能开销,稳定性以及安全性之间达到平衡,这也是VED目标,这也让VED从一开始就是针对企业生产环境而设计和实现的,比如:
* 根据漏洞利用方法通用性进而判断是否应该减少某些代码模块的检测范围
* VED和Linux内核对于企业生产环境来说是一个整体,我们也通过VaultFuzzer对生产环境应用高度依赖的Linux内核子系统进行压力测试以达到较高的代码覆盖率
* 安全方案扮演业务系统守护者的角色,VED通过VSPP自防护特性加强了自身的防护能力以避免类似Tetragon事件的发生。
理论上讲,VED的特性可以兼容包括LKRG,AKO甚至Linux内核rootkit在内的任意LKM框架,我们在LKM的版本最终选定基于开源并且长期维护的LKRG。我们针对公开的漏洞利用和客户提供的0day漏洞利用方法进行了分析。
赛博堡垒制作了一个用于测试漏洞利用的AMI,读者有兴趣可以在AWS上进行测试,选择区域:US East (N.Virginia),之后进行搜索"vault exploit test":
赛博堡垒也在AWS提供了代号为“超越合规“的安全加固版本Hardened Linux (Ubuntu for both x86_64 and arm64),这个版本提供默认的安全加固,通过CIS/STIG最佳实践更容易的帮助用户实现合规(比如PCI-DSS,GDPR等),也默认提供了ModSecurity(Web防火墙),VED(Vault Exploit Defense)社区版以及其他安全特性。
LKRG 特性
* 检查SMEP/SMAP的开启和关闭(p_ed_pcfi_cpu)
* pCFI(pSMEP/pSPC): 检测栈上返回地址是否为内核代码段, 以及栈的指针, 大小
* 提权检测: 检查credentials是否被数据污染,修改提权(p_ed_enforce_validation)
* 内核代码段完整性检测,模块加载检测
* addr_limit (针对老版本内核)
* 隐藏内核模块
VED 特性
* wCFI: 检查栈上返回地址是否为正确callsite
* wCFI: Callee可能被特定函数重用的检测(依赖于关闭tail-call优化和直接调用)
* VSPP (Vault self-protection): 检查kprobe是否被关闭, 检查关键 hook 点是否被关闭, 卸载 ved 模块函数的执行流检查
* 只读timer: 检查部分安全相关的只读数据有没有被污染, 导致安全特性被bypass
提权检测
kprobe point: native_write_cr4, commit_creds, override_creds, revert_creds,call_usermodehelper_exec,call_usermodehelper, set_current_groups, sys_set*id, sys_capset
触发点: 这些内核函数可以重用以进行权限提升,检查它们是否由可用的调用站点调用。
特性: L1 + L2 + V1 + L3 + (V2)括号表示部分函数使用
VED自防护
kprobe point: disable_kprobe, p_exploit_detection_exit, text_poke
触发点: 被重用的代码路径。
特性: L1 + L2 + V1 + L3 + V1 + V3
后漏洞利用检测
kprobe point: mark_inode_dirty, sys_unshare, cap_task_prctl, sys_add_key, security_ptrace_access, generic_permission, security_bprm_committed_creds, security_bprm_committing_creds, wake_up_new_task, sys_ptrace
触发点: 提权发生后进行新建进程时、或运行时namespace/capability/credentials检测。
特性: L1 + L2 + V1 + V3
Timer & schedule
LKRG timer
kprobe point: schedule, lookup_fast, __queue_work, wake_up_new_task
触发点: 提升检测漏洞利用频率。
特性: L1 + L2 + V1 + L3 + L5 + L6 + V1
间隔: 默认15秒
VED ro guard
只读数据: mmap_min_addr, kptr_restrict, kprobes_all_disarmed
触发点: cyclical check if these essential date was corrupted
特性: L4 + V4
间隔:1秒
编译和使用
make && insmod ved.ko
资料引用
HardenedVault
VED community version:
https://github.com/hardenedvault/ved
CVE-2022-1015/CVE-2022-1015-1016
https://blog.dbouman.nl/2022/04/02/How-The-Tables-Have-Turned-CVE-2022-1015-1016
CVE-2022-25636
https://github.com/Bonfee/CVE-2022-25636
CVE-2022-0492
https://thehackernews.com/2022/03/new-linux-kernel-cgroups-vulnerability.html
https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/
CVE-2022-0185 - Winning a $31337 Bounty after Pwning Ubuntu and Escaping Google's KCTF Containers
https://www.willsroot.io/2022/01/cve-2022-0185.html
[CVE-2021-42008] Exploiting A 16-Year-Old Vulnerability In The Linux 6pack Driver
https://syst3mfailure.io/sixpack-slab-out-of-bounds
Exploiting CVE-2021-43267
https://haxx.in/posts/pwning-tipc/
CVE-2021-34866 Writeup - 202111
https://blog.hexrabbit.io/2021/11/03/CVE-2021-34866-writeup/
v5.11
https://ctftime.org/writeup/30589
The Art of Exploiting UAF by Ret2bpf in Android Kernel
https://conference.hitb.org/hitbsecconf2021sin/materials/D1T1%20-%20%20The%20Art%20of%20Exploiting%20UAF%20by%20Ret2bpf%20in%20Android%20Kernel%20-%20Xingyu%20Jin%20&%20Richard%20Neal.pdf
Kernel Pwning with eBPF: a Love Story (CVE-2021-3490)
https://www.graplsecurity.com/post/kernel-pwning-with-ebpf-a-love-story
apt install libbpf-dev gcc libfuse-dev
Sequoia: A deep root in Linux's filesystem layer (CVE-2021-33909)
https://www.qualys.com/2021/07/20/cve-2021-33909/sequoia-local-privilege-escalation-linux.txt
https://www.qualys.com/2021/07/20/cve-2021-33909/cve-2021-33909-exploit.tar.gz
CVE-2021-22555: Turning x00x00 into 10000$
https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.html
Blue Klotski (CVE-2021-3573) and the story for fixing
https://f0rm2l1n.github.io/2021-07-23-Blue-Klotski/
https://a13xp0p0v.github.io/2021/02/09/CVE-2021-26708.html
CVE-2021-26708: https://github.com/jordan9001/vsock_poc
CVE-2021–20226 a reference counting bug which leads to local privilege escalation in io_uring.
https://flattsecurity.medium.com/cve-2021-20226-a-reference-counting-bug-which-leads-to-local-privilege-escalation-in-io-uring-e946bd69177a
HardenedVault
https://hardenedvault.net/
原文始发于微信公众号(赛博堡垒):VED (Vault Exploit Defense)开源实现
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论