-
Notifications
You must be signed in to change notification settings - Fork 6
Heap Buffer Overflow on bchunk v1.2.1 and v1.2.0 #2
Comments
Below is the output from gdb exploitable having the following crash hash value for v1.2.0 and v1.2.1 respectively and determining that the issue is exploitable as well.
|
This patch should fix both this issue and #3, but I should test this with your payload.
Can be reproduced if TRACK number is long enough, for example:
There are only 2 heap allocations, and the other one seems to be fine. So this and #4 (comment) should do. |
Very nice fix there @yegortimoshenko ! I find it really amazing how you fixed the issue so quickly before I can react and provide you with more information. 👍 The issue should be fixed, but just to be sure, please try the attached payload. |
This payload results in error code 3, as expected:
So yes, this should be fixed. Thanks for reporting and figuring this out @kongwenbin! Once I test #4 I'll post patches to Red Hat mailing list (https://bugzilla.redhat.com/show_bug.cgi?id=1507576), hopefully it will propagate to other distros from here. NixOS already has these patches in master, Gentoo should merge them soon. |
No worries! The plan sounds good, many thanks to you too @yegortimoshenko ! By the way, since the issues are fixed already, do I proceed to close the issues now? Or do I need to wait until all the distros has finish merging? Thanks. |
Closing all the 3 issues since they are fixed! |
@hessu would it be possible to get these fixes upstreamed in a new release of bchunk? |
@hessu: if you are not interested i maintaining bchunk anymore, I could fork it, apply these patches and clean it up further, without changing any of the behavior, of course. Would need some sort of approval from you in order to get my fork packaged by distributions. |
@yegortimoshenko right. The question is whether to revert Homebrew/homebrew-core#20471 which is contingent on whether this will ever actually be fixed upstream. |
@ilovezfs Now I remember why I've stopped using Homebrew even when I was still a Mac user, it's because you break users' computers all the time. Just so that you know, some virtual machines and game console emulators only read ISO, and don't support BIN+CUE, including VMWare Fusion and VirtualBox. Some people have album rips in BIN+CUE and need to convert it to actually play it. These vulnerabilities are not exploitable on Darwin, as Darwin heap is not executable, and the only way to make it executable is via an explicit If patched version doesn't build on Darwin, I'd be happy to help, if you show me logs. |
@yegortimoshenko deleting the bchunk formula doesn't break anyone's existing installations and it's trivial to add the formula to your own tap. Please don't spread misinformation. |
@ilovezfs Whenever someone removes something that is publicly facing, it's breakage. In this case you might delay it until someone buys a new Mac, reinstalls macOS, or just wipes all Homebrew packages (something I've personally done multiple times). People rely on it being there, and will be taken by suprise. It's an essential piece of software that is required to handle a very popular format for use in some (also popular) programs. And users are not supposed to know how to write package declarations in order to install software. On to the patches: I've looked up Homebrew/homebrew-core@61ca0be and these patches are meant to apply on top of upstream's tarball, not Debian's. It is located at http://he.fi/bchunk/bchunk-1.2.0.tar.gz. |
which is not the same thing as "you break users' computers all the time." |
@yegortimoshenko hmm I'm getting
|
Patches for me:
I'll make a cleaner version of the second patch, maybe that will fix it? Hold on. |
@ilovezfs Here's a new version of CVE-2017-15955 patch that should apply without any warnings: |
@yegortimoshenko yep that's the output I get from GNU patch 2.7.5. However, not from 2.5.8. Also note that the patch doesn't actually fully apply.
So I think the nix package may still be vulnerable. |
i.e. the diff ends up missing the part at the bottom
|
@ilovezfs Thank you a lot, good catch! I'll submit the fixed patch in Gentoo and Nix. |
@yegortimoshenko no problem. BTW, there's probably some switch to pass to 2.7.5 to make that a hard error instead of exiting 0. Another question: any reason you're not applying the Debian
|
@ilovezfs We should patch that too, thank you! This fixes an off-by-one error (i.e. in case with two-track bin/cue, one of the tracks gets an extra sector while the other gets truncated). |
Debian has one more patch, but it appears to just be cosmetics https://gist.github.com/ilovezfs/d15f03df971edee317a24132d212aead |
Hi guys! Thanks for the patches. I'll merge the security fixes and release upstream version 1.2.1 in the near future; cannot commit to a date though right now. |
Oh well, just went and did it now. Thank you for the patches, again. 1.2.2 is now available in upstream (https://github.com/hessu/bchunk and the crummy old http://he.fi/bchunk/). Also merged the two debian patches which had been lurking around. |
@hessu Thank you for a prompt release! |
Thanks @hessu! You're awesome :) |
@pravi you'll probably want to upgrade Debian to 1.2.2. :) |
I had not really realised that bchunk is actually still being actively used by someone. Should probably throw it at coverity and see what it finds, and do a bit of a code review; maybe I've learned something about writing software in the past 19 years and could improve it a bit by now. |
I discovered an instance of heap buffer overflow bug on bchunk v1.2.1 and v1.2.0. This issue was discovered and can be replicated on a 32-bit Ubuntu machine, for instance I discovered the issue on
Linux ubuntu 4.10.0-32-generic #36~16.04.1-Ubuntu SMP Wed Aug 9 09:18:53 UTC 2017 i686 i686 i686 GNU/Linux
The following is some stack trace information, please kindly advise how and where can I share the full output with more details and also the POC files to replicate the issue:
I have emailed the author a few days ago but I don't think he still maintain the code, since v1.2.0 was published in 2004. However, this project's v1.2.1 was published in 2016 so I believe that this is still maintained. This seems to be the only active upstream for bchunk. If this is not the right place to report the issue, please kindly point me to the right direction, thanks a lot!
The text was updated successfully, but these errors were encountered: