New issue
Advanced search Search tips
Starred by 1 user
Status: Fixed
Owner:
Closed: Dec 2015
Cc:



Sign in to add a comment
Rar: CmdExtract::UnstoreFile integer truncation memory corruption
Project Member Reported by taviso@google.com, Oct 1 2015 Back to list
The attached file crashes in CmdExtract::UnstoreFile because the signed int64 DestUnpSize is truncated to an unsigned 32bit integer. Perhaps CmdExtract::ExtractCurrentFile should sanity check Arc.FileHead.UnpSize early.

I observed this crash in Avast Antivirus, but the origin of the code appears to be the unrar source distribution. I imagine many other antiviruses will be affected, and presumably WinRAR and other archivers.


This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.
 
fac4f79de05697aa44092cbb5790a0ef
2.0 MB View Download
Project Member Comment 1 by taviso@google.com, Oct 1 2015
Sent analysis and report to dev@rarlab.com as described here http://www.rarlab.com/feedback.htm
Project Member Comment 2 by taviso@google.com, Oct 1 2015
Response from maintainer:

Hello,

Thank you!

You are right, it is needed to add:

  if (Arc.FileHead.PackSize<0)
    Arc.FileHead.PackSize=0;
  if (Arc.FileHead.UnpSize<0)
    Arc.FileHead.UnpSize=0;

in the beginning of CmdExtract::ExtractCurrentFile.

Initially I wanted to fix it earlier in Archive::ReadHeader15,
but then decided that I prefer to see real negative values in archive
listing to understand that archive is corrupt. Also unrar.dll calls
CmdExtract::ExtractCurrentFile directly and can pass invalid values
from user program, so it is better to fix them here.

Eugene

Project Member Comment 3 by taviso@google.com, Oct 1 2015
Maintainer says "I already updated WinRAR 5.30 beta 4 build on the site and of course we'll include it to next beta or release. Now I would not like to openly publish all technical details though, to not help hackers to use this bug. Maybe only something general like: RAR could crash when unpacking .rar archives with corrupt file headers."

I've requested that unrarsrc be updated, and asked about advisories.
Project Member Comment 4 by taviso@google.com, Oct 1 2015
Fixed in unrarsrc-5.3.5, still considering options for informing downstream users (like Avast, and probably many other antiviruses).
Project Member Comment 5 by taviso@google.com, Dec 9 2015
Labels: -Restrict-View-Commit
Status: Fixed
I think this issue is as resolved as it's going to be. There are probably other consumers, but at this point keeping this issue restricted is just getting in the way.
Comment 6 Deleted
Sign in to add a comment