Bug 96561 (CVE-2005-2097) - VUL-0: CVE-2005-2097: xpdf denial of service / kpdf fills /tmp filesystem with huge file
Summary: VUL-0: CVE-2005-2097: xpdf denial of service / kpdf fills /tmp filesystem wit...
Status: RESOLVED FIXED
Alias: CVE-2005-2097
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other All
: P5 - None : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard: CVE-2005-2097: CVSS v2 Base Score: 2....
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 09:44 UTC by Berthold Gunreben
Modified: 2021-11-08 14:10 UTC (History)
7 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
corrupted PDF file (62.07 KB, application/pdf)
2005-07-14 09:45 UTC, Berthold Gunreben
Details
xpdf-font-optimize.dif (28.00 KB, patch)
2005-07-21 09:50 UTC, Marcus Meissner
Details | Diff
upstream patch (2.40 KB, patch)
2005-07-27 07:29 UTC, Ludwig Nussel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Berthold Gunreben 2005-07-14 09:44:37 UTC
when opening the attached pdf, kpdf creates a file in /tmp that grows until 
the process is killed (at least up to several GB)
Comment 1 Berthold Gunreben 2005-07-14 09:45:33 UTC
Created attachment 42033 [details]
corrupted PDF file
Comment 2 Dirk Mueller 2005-07-14 10:01:14 UTC
which tmp file? what is the contents of the file? for me it doesn't even open 
something in /tmp:  
 
$ lsof | grep kpdf | grep tmp 
kpdf      20341       dirk  mem       REG        3,5   1337356    
1002175 /var/tmp/kdecache-dirk/ksycoca 
kpdf      20341       dirk   10r      REG        3,5   1337356    
1002175 /var/tmp/kdecache-dirk/ksycoca 
Comment 3 Stephan Kulow 2005-07-14 10:53:24 UTC
same here. Works fine  - two pages  
Comment 4 Berthold Gunreben 2005-07-14 11:07:09 UTC
the file differs from run to run. file tells me that it contains  
  
# file AoCRgp  
AoCRgp: TrueType font data 
 
this is easily reproduceable. Please tell me what information you need. 
Comment 5 Dirk Mueller 2005-07-14 14:26:08 UTC
hmm, it doesn't go away if you update to kpdf 3.4.1 from supplementary? 
Comment 6 Dirk Mueller 2005-07-15 01:11:18 UTC
hmm, no, that won't help. there is a fix for this problem in trunk, probably 
thats what coolo and I use.  
 
Try the kdegraphics-kpdf rpm from:  
 
/work/built/mbuild/g131-dmueller-97/9.3-i386 
 
which contains a backport of the relevant commit.  
Comment 7 Berthold Gunreben 2005-07-15 09:31:47 UTC
looks like the problem is fixed with that package. 
Comment 8 Dirk Mueller 2005-07-15 14:44:44 UTC
ok. this is again fascinating. The patch that fixes the issue is written  
by a suse employee, it was checked into the KDE repository, and still its  
not anywhere near the actual suse package.   
  
I've checked in an updated package to STABLE and PLUS.  
  
Comment 9 Marcus Meissner 2005-07-18 08:27:59 UTC
question is if we can consider this a denial of service 
attack and need to release updated packages? 
 
or is this just a trivial problem? 
Comment 10 Dirk Mueller 2005-07-18 09:05:44 UTC
there are probably many ways to fill /tmp..  
Comment 11 Dirk Mueller 2005-07-18 09:07:09 UTC
but still doing something beyond simply crashing by opening a pdf is a bit 
annoying. Given that this was a pretty prominent pdf files, a lot of users 
probably ran into this bug.  
 
AJ, approve an update? 
Comment 12 Dirk Mueller 2005-07-18 09:07:41 UTC
AJ, approve an update? 
Comment 13 Dirk Mueller 2005-07-18 09:09:53 UTC
(my idea of an update would be to sync kpdf to the version from upcoming KDE 
3.4.2 which includes among many other fixes the one necessary for this). Of 
course the single commit only would do it as well - its already in the suse 
pdf package btw.  
Comment 14 Dirk Mueller 2005-07-18 09:10:11 UTC
suse pdf -> suse xpdf  
Comment 15 Marcus Meissner 2005-07-18 09:16:33 UTC
then we will probably have to update *pdf* ... :( 
Comment 16 Andreas Jaeger 2005-07-18 09:22:05 UTC
Just add the one fix that's needed.

Please use: SM-Tracker-1803
Comment 17 Stephan Kulow 2005-07-18 09:48:52 UTC
We really need to be careful here when we treat it as security bug. The same  
bug is most likely in the sles8 xpdf and in cups (there it might really hurt  
actually).  
 
If we agree it's no security problem, but a nice to fix kpdf problem, we can 
go on and update 9.3's kpdf with more than this fix. 
Comment 18 Dirk Mueller 2005-07-18 11:20:57 UTC
cups uses xpdf 2.0 - unlikely to be affected, though not impossible.  
 
the patch correcting this issue comes from suse xpdf actually, its a commit of 
all the custom patches over plain xpdf from the suse xpdf. to find out which 
of the 22 patches actually fixes this particular issue is nontrivial.  
 
Furthermore I don't see why we ship patches against xpdf but don't want them 
to be included in the update kpdf package? 
 
security-team: do we treat it as security bug or not? 
 
 
Comment 19 Klaus Singvogel 2005-07-18 13:20:11 UTC
Sorry, but I want to cross-check about the presence of the patch in cups. 
Dirk: which suse xpdf patch are you talking about? 
Comment 20 Marcus Meissner 2005-07-18 15:11:36 UTC
I think the bug is only in xpdf 3 versions ... fortunately, which limits the 
number of packages.  (Splash*.c, right?) 
  
I would classify this as a remote denial of service problem, so it is a  
security problem.  
Comment 21 Marcus Meissner 2005-07-21 09:50:16 UTC
The whole handling of this bug is substandard. 
 
vendor-sec not notified. 
 
no one bothered to find out the real patch that helps. 
 
no one cced takashi 
Comment 22 Marcus Meissner 2005-07-21 09:50:52 UTC
Created attachment 42729 [details]
xpdf-font-optimize.dif

trial and error shows that this patch helped.
Comment 23 Marcus Meissner 2005-07-21 09:53:14 UTC
notified vendor-sec 
Comment 24 Ludwig Nussel 2005-07-25 15:49:16 UTC
CAN-2005-2097 
Comment 25 Ludwig Nussel 2005-07-27 07:29:55 UTC
Created attachment 43513 [details]
upstream patch
Comment 26 Takashi Iwai 2005-07-27 11:22:15 UTC
The patch #22 should fix this problem since it changes the code to avoid temp
files.  But it alone can't be applied cleanly.  It's applied after another patch.
(also kpdf has different indentation, so it can't be applied as it is.)

The patch #25 has nothing to do with patch #22.  It fixes the size of code table
detected from the font.  It will still create temp files, and they remain if the
app  crashes or quits unexpectedly.
Comment 27 Dirk Mueller 2005-07-27 11:30:55 UTC
yeah, finally I found a gdb that works, so debugging this problem became easy. 
it comes from this chunk of code in FoFiTrueType::writeTTF: 
 
          k = locaTable[j].origOffset; 
          if (checkRegion(pos + k, n)) { 
            (*outputFunc)(outputStream, (char *)file + pos + k, n); 
          } else { 
            for (k = 0; k < n; ++k) { 
              (*outputFunc)(outputStream, "\0", 1); 
            } 
 
by interpreting trailing garbage in the pdf file as a ttf font, it tries to 
fixup the broken glyph table (which contains all kinds of weirdnesses 
including negative lengths), it almost always falls into the !checkRegion 
case, which writes out a huge amount of 0 bytes.  
 
The xpdf-font-optimize avoids this code path by patching out the single 
location in the source where this obscure writeTTF method is used.  
Comment 28 Dirk Mueller 2005-07-27 11:40:18 UTC
suse xpdf was never affected, cups is not affected because this code path does   
not exist in xpdf 2.x.    
   
For KDE, the versions affected by this bug is kpdf as included in KDE 3.3.1 up   
to including KDE 3.4.1. older or newer versions are not affected, so the only   
version for SUSE that is affected is SL 9.3, which includes KDE 3.4.0. no   
other SLES or SL version affected as far as I can see. Therefore I wonder if  
it wouldn't be better to backport the xpdf improvements of kpdf 3.4.2 (which  
is essentially the suse patchset of xpdf, as shipped in SL starting with  
SL9.1) to fix this bug, or if I should apply the minimal upstream patch. 
[security-team answer here] 
  
gpdf includes the vulnerable code as well, but I haven't investigated how 
they're affected. CC'ing them.  
Comment 29 Ludwig Nussel 2005-07-27 13:47:57 UTC
Feel free to include the patch you prefer as long as it fixes the problem. 
Comment 30 Stanislav Brabec 2005-07-27 16:54:13 UTC
For gpdf: Only 9.3 and STABLE/PLUS are affected. Patch submitted.

Using half of the patch in comment #25 (for FoFiTrueType.cc, file
SplashOutputDev.cc does not exist).
Comment 31 Dirk Mueller 2005-07-28 13:09:12 UTC
updated kdegraphics3 for 9.3 submitted.  
Comment 32 Marcus Meissner 2005-08-08 08:08:12 UTC
public disclosure probably on Tuesday 9.8.2005 / 15:00 GMT. 
Comment 33 Marcus Meissner 2005-08-10 14:53:40 UTC
approved gpdf and kdegraphics3-pdf patch.  
 
marking fixed 
Comment 34 Thomas Biege 2009-10-13 21:33:25 UTC
CVE-2005-2097: CVSS v2 Base Score: 2.1 (AV:L/AC:L/Au:N/C:N/I:N/A:P)