Re:7-Zip: From Uninitialized Memory to Remote Code Execution
by landave on Thursday May 03, 2018 @12:56PM
(#16987638)
You missed my point. It is trivial to find out what the magic number is. What is more important though: How exactly is the magic number matched? From what you have written, one might be tempted to simply check whether a file begins with this magic number. And this would be wrong. If you take a look at the matching in CPP/7zip/Archive/Rar/RarHandler.cpp:
7-Zip finds the magic number if it appears within some searchHeaderSizeLimit, i.e., the file does not need to start (at offset 0) with the magic number. For example, 7-Zip will extract a RAR file which begins with [00 52 61 72 21 1A 07 00] (instead of [52 61 72 21 1A 07 00]) just fine.
[ Parent
| on HN ]
Re:7-Zip: From Uninitialized Memory to Remote Code Execution
by codetrotter on Thursday May 03, 2018 @01:03PM
(#16987691)
Oh, I did not expect that. Yes you are right, one must be careful about these things.