安全研究

安全漏洞
Xpdf FoFiType1::parse函数栈溢出漏洞

发布日期:2009-12-16
更新日期:2009-12-18

受影响系统:
Xpdf Xpdf 3.00
不受影响系统:
Xpdf Xpdf 3.01
描述:
BUGTRAQ  ID: 37350
CVE(CAN) ID: CVE-2009-4035

Xpdf是便携文档格式(PDF)文件的开放源码查看器。

Xpdf的xpdf/fofi/FoFiType1.cc文件中的FoFiType1::parse()函数存在栈溢出漏洞:

133 void FoFiType1::parse() {
...
163       line = getNextLine(line);
164       for (j = 0; j < 300 && line; ++j) {
165         line1 = getNextLine(line);
166         if ((n = line1 - line) > 255) {
167           n = 255;
168         }
169         strncpy(buf, line, n);

getNextLine可能返回NULL:

117 char *FoFiType1::getNextLine(char *line) {
118   while (line < (char *)file + len && *line != '\x0a' && *line != '\x0d')
{
119     ++line;
120   }
121   if (line < (char *)file + len && *line == '\x0d') {
122     ++line;
123   }
124   if (line < (char *)file + len && *line == '\x0a') {
125     ++line;
126   }
127   if (line >= (char *)file + len) {
128     return NULL;
129   }

因此没有定义(line1 - line),可能生成负值n,该值之后传送给了strncpy,溢出buf缓冲区。

<*来源:Petr Gajdos
        Christian Kornacker
  
  链接:http://secunia.com/advisories/37641/
        https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=541614
        https://www.redhat.com/support/errata/RHSA-2009-1682.html
        https://www.redhat.com/support/errata/RHSA-2009-1681.html
        https://www.redhat.com/support/errata/RHSA-2009-1680.html
*>

建议:
厂商补丁:

RedHat
------
RedHat已经为此发布了一个安全公告(RHSA-2009:1680-01)以及相应补丁:
RHSA-2009:1680-01:Important: xpdf security update
链接:https://www.redhat.com/support/errata/RHSA-2009-1680.html

Xpdf
----
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://cgit.freedesktop.org/poppler/poppler/diff/fofi/FoFiType1.cc?id=4b4fc5c0

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