"gfax是网络传真程序的GHOME前端。 gfax在处理临时文件时存在漏洞,本地攻击者可能此漏洞提升自己的权限。 gfax的src/mgett_setup.c文件中的delete_crontab_entry()函数以不安全的方式处理了临时文件: /* if it's NULL then nuke the faxrunq crontab entry. */ if ((fin = fopen("/etc/crontab", "r")) == NULL) { do_message(_("\nCan't open /etc/crontab\n")); return; } if ((fout = fopen("/tmp/crontab", "w")) == NULL) { do_message(_("\nCan't create /tmp/crontab\n")); return; } while (fgets(buf, 128, fin) != NULL) { fputs(buf, fout); fclose(fout); fclose(fin); /* now copy the new file back to /etc */ if ((fin = fopen("/tmp/crontab", "r")) == NULL) { do_message(_("\nCan't open /tmp/crontab\n")); return; } if ((fout = fopen("/etc/crontab", "w")) == NULL) { do_message(_("\nCan't create /etc/crontab\n")); return; } while ((c = fgetc(fin)) != EOF) fputc(c, fout); fclose(fout); fclose(fin); remove("/tmp/crontab"); 这可能导致向/etc/crontab文件中写入任意命令。如果/tmp/crontab已存在的话(非root用户所有),就会被截短并删除,但所有者仍保持为非root用户,因此第一个和第二个拷贝之间就存在竞争条件,允许向/etc/crontab附加任意行。"
"gfax是网络传真程序的GHOME前端。 gfax在处理临时文件时存在漏洞,本地攻击者可能此漏洞提升自己的权限。 gfax的src/mgett_setup.c文件中的delete_crontab_entry()函数以不安全的方式处理了临时文件: /* if it's NULL then nuke the faxrunq crontab entry. */ if ((fin = fopen("/etc/crontab", "r")) == NULL) { do_message(_("\nCan't open /etc/crontab\n")); return; } if ((fout = fopen("/tmp/crontab", "w")) == NULL) { do_message(_("\nCan't create /tmp/crontab\n")); return; } while (fgets(buf, 128, fin) != NULL) { fputs(buf, fout); fclose(fout); fclose(fin); /* now copy the new file back to /etc */ if ((fin = fopen("/tmp/crontab", "r")) == NULL) { do_message(_("\nCan't open /tmp/crontab\n")); return; } if ((fout = fopen("/etc/crontab", "w")) == NULL) { do_message(_("\nCan't create /etc/crontab\n")); return; } while ((c = fgetc(fin)) != EOF) fputc(c, fout); fclose(fout); fclose(fin); remove("/tmp/crontab"); 这可能导致向/etc/crontab文件中写入任意命令。如果/tmp/crontab已存在的话(非root用户所有),就会被截短并删除,但所有者仍保持为非root用户,因此第一个和第二个拷贝之间就存在竞争条件,允许向/etc/crontab附加任意行。"