AFFLIB GetLock本地竞争条件漏洞
发布日期:2007-04-27
更新日期:2007-04-28
受影响系统:AFFLIB AFFLIB 2.2.0 - 2.2.8
描述:
BUGTRAQ ID:
23696
CVE(CAN) ID:
CVE-2007-2056
AFFLIB是用于操作高级取证格式(AFF)文件的开源函数库。
AFFLIB在创建用于锁定的临时文件时存在漏洞,本地攻击者可能利用此漏洞获取权限提升。
AFFLIB在/tmp创建锁定文件时其文件名几乎可预测。创建文件时首先执行访问检查,然后打开文件,如果已存在的话就将其截短。由于检查的时间和使用的时间并不相同,因此本地攻击者可以通过符号链接利用文件系统的竞争条件。548-582行说明了这个问题:
int getlock(class imager *im)
{
/* If the file exists and the PID in the file is running,
* can't get the lock.
*/
char lockfile[MAXPATHLEN];
sprintf(lockfile,"/tmp/aimge.%s.lock",im->infile);
if(access(lockfile,F_OK)==0){
/* Lockfile exists. Get it's pid */
char buf[1024];
FILE *f = fopen(lockfile,"r");
if(!f){
perror(lockfile); // can't read lockfile...
return -1;
}
fgets(buf,sizeof(buf),f);
buf[sizeof(buf)-1] = 0;
int pid = atoi(buf);
if(checkpid(pid)==0){
/* PID is not running; we can delete the lockfile */
if(unlink(lockfile)){
err(1,"could not delete lockfile %s: ",lockfile);
}
}
/* PID is running; generate error */
errx(1,"%s is locked by process %d\n",im->infile,pid);
}
FILE *f = fopen(lockfile,"w");
if(!f){
err(1,lockfile);
}
fprintf(f,"%d\n",getpid()); // save our PID.
fclose(f);
return 0;
}
由于攻击者几乎无法控制所覆盖的内容(aimage的进程ID),因此这只能导致拒绝服务。
<*来源:Timothy D. Morgan (
tmorgan@vsecurity.com)
链接:
http://marc.info/?l=bugtraq&m=117770097416093&w=2
*>
建议:
厂商补丁:
AFFLIB
------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://www.afflib.org/index.php浏览次数:2964
严重程度:0(网友投票)