Open chubbymaggie opened 7 years ago
Thanks. Can you please enlighten me why this is a security vulnerability? If I understand correctly, both patches say that it is illegal to decrement a pointer to an array before the array's start, even if we never dereference the decremented pointer (and just plan to increment it again later). But on all machines I know (including x86 and arm), it is legal. So where's the problem? And how can it lead to a security vulnerability? I don't see any suggestion in these reports that the code actually dereferences the out-of-bounds pointer, right?
I found an interesting case where compilers (gcc) assumed that a pointer cannot point before the beginning of the object: https://lwn.net/Articles/278137/ I also found the original report which suggested that these crc32.c and inftrees.c could have a problem: https://wiki.mozilla.org/images/0/09/Zlib-report.pdf I'm not sure yet, though, if this is really a problem. It seems to me there's a big gap between an optimizer optimizing away parts of an overflow detection "if" statement (this is where the "security" aspect of this issue came in?), and a compiler which miscompiles the code in crc32.c and inftrees.c.
Yes, your understanding is correct and undefined behaviors can sometimes lead to security vulnerabilities under certain compiler optimization options. These two vulnerabilities fall under that category, I guess.
Also, if you get time, please check these two research papers to understand more about such vulnerabilities.
Hi,
While scanning for unpatched (or 1-day) vulnerabilities in popular open source libraries. I found the following 2 unpatched vulnerabilities in
opensolaris_crc32.c
andinftrees.c
:CVE id
: CVE-2016-9843affected file
: osv/bsd/sys/cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.cvulnerability details (NVD)
: https://nvd.nist.gov/vuln/detail/CVE-2016-9843upstream patch
: https://github.com/madler/zlib/commit/d1d577490c15a0c6862473d7576352a9f18ef811CVE id
: CVE-2016-9840affected file
: osv/bsd/sys/cddl/contrib/opensolaris/uts/common/zmod/inftrees.cvulnerability details (NVD)
: https://nvd.nist.gov/vuln/detail/CVE-2016-9840upstream patch
: https://github.com/madler/zlib/commit/6a043145ca6e9c55184013841a67b2fef87e44c0Hope this is helpful.
Regards, Mahin