You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a couple of places in inflate() where UPDATE is called with state->check as its first parameter, without a guarantee that this value has been initialized (state comes from a ZALLOC in inflateInit). This causes use of uninitialized check value.
"Following the logic" in this method is hard, it's huge. I have a testcase for this, but I don't think I'm allowed to share it. It was obtained using Chromium fuzzers. I'll share the state->mode sequence:
First inflate: HEAD -> BAD.
inflateSync: TYPE (the method returns Z_OK)
Second inflate: TYPEDO -> LEN_ -> LIT -> LEN->LIT->LEN->LIT->LEN->LEN->TYPE->CHECK and it uses the uninitialized value state->check there.
You were correct -- it was possible for inflateSync() to leave inflate in an inconsistent state if header decoding was requested, but no header was ever processed. This commit fixes that: 44e8ac8
Sorry for the late reply, I checked if the problem was solved with your patch but it was not. Now I got permission to share the testcase with you. It is for libtiff but the uninitialized values are in zlib. Please let me know how I could share it with you.
Ping. The commit mentioned does not fix the issue for our testcase. Is there any plan to fix this upstream or should Chromium patch its own version of zlib?
Activity
madler commentedon Mar 30, 2017
No, it's guaranteed if UPDATE is called. You'd need to follow the logic.
npm1 commentedon Mar 30, 2017
"Following the logic" in this method is hard, it's huge. I have a testcase for this, but I don't think I'm allowed to share it. It was obtained using Chromium fuzzers. I'll share the state->mode sequence:
First inflate: HEAD -> BAD.
inflateSync: TYPE (the method returns Z_OK)
Second inflate: TYPEDO -> LEN_ -> LIT -> LEN->LIT->LEN->LIT->LEN->LEN->TYPE->CHECK and it uses the uninitialized value state->check there.
madler commentedon Apr 16, 2017
You were correct -- it was possible for
inflateSync()to leave inflate in an inconsistent state if header decoding was requested, but no header was ever processed. This commit fixes that:44e8ac8
npm1 commentedon May 9, 2017
Sorry for the late reply, I checked if the problem was solved with your patch but it was not. Now I got permission to share the testcase with you. It is for libtiff but the uninitialized values are in zlib. Please let me know how I could share it with you.
npm1 commentedon Jun 26, 2017
Ping. The commit mentioned does not fix the issue for our testcase. Is there any plan to fix this upstream or should Chromium patch its own version of zlib?
madler commentedon Jun 27, 2017
You can send me an email. You can find my address on http://zlib.net/ .
npm1 commentedon Jun 27, 2017
It bounced :( "One of your attachments contained a virus. Your message was not sent."
I guess it thinks the libtiff testcase is somehow dangerous.
madler commentedon Jun 28, 2017
Send me an email without an attachment, and I'll reply with a different email address for you to try.
npm1 commentedon Aug 3, 2017
I will be patching Chromium's copy of zlib because this is marked as a security bug and it has been open for too long.
Zlib patch: prevent uninitialized use of state->check
Zlib patch: prevent uninitialized use of state->check
Revert "Zlib patch: prevent uninitialized use of state->check"
Zlib patch: prevent uninitialized use of state->check
zlib: inflate using wider loads and stores
21 remaining items
zlib: inflate using wider loads and stores
zlib: inflate using wider loads and stores
Resolve madler/zlib#245 in zlib
Resolve madler/zlib#245 in zlib
Merge pull request #14312 from pshipton/libzip
Merge pull request #14313 from pshipton/libzip0.30
Zlib patch: prevent uninitialized use of state->check
Zlib patch: prevent uninitialized use of state->check
Revert "Zlib patch: prevent uninitialized use of state->check"
Zlib patch: prevent uninitialized use of state->check
zlib: inflate using wider loads and stores
Zlib patch: prevent uninitialized use of state->check
Zlib patch: prevent uninitialized use of state->check
zlib: inflate using wider loads and stores
3rdparty(zlib): prevent uninitialized use of state->check