Date: Fri, 4 Nov 2011 16:45:11 -0400 From: "Jason A. Donenfeld" <Jason@...c4.com> To: oss-security@...ts.openwall.com Cc: Josh Bressers <bressers@...hat.com>, kseifried@...hat.com Subject: Re: Re: CVE request for Calibre Aaaa boy this has been quite the saga. Everybody should check out https://bugs.launchpad.net/calibre/+bug/885027 for a good example of how * not* to respond to security bug reports. Quite amusing. It's been a fun couple of days writing weaponized exploit after exploit.<http://git.zx2c4.com/calibre-mount-helper-exploit/tree/> In the end though, it looks like he agreed to fix it, "@Jason: Well, if you do not wish to help, that leaves me with no choice but to remove the mount helper." So where does that leave us with the CVEs? Well, there are the issues that were "released" with a "version" of Calibre, and then the trove of bugs he introduced in the middle. I'll try to recap and separate which is which: 1. Ability to create root owned directory anywhere. The mount helper calls mkdir(argv, ...). 2. Ability to remove any empty directory on the system. 3. Ability to create user_controlled_dir/.created_by_calibre_mount_helper anywhere on the filesystem. 4. Ability to delete user_controlled_dir/.created_by_calibre_mount_helper anywhere on the filesystem. 5. Ability to inject arguments into 'mount' being exec'd. On lines 78, 81, and 83, the final two arguments to mount are user controlled. On lines 1033, 106, 108, 139, and 141, the last argument to unmount/eject is user controlled. The "exists()" check can be subverted via race condition or by creating an existing file in the working directory with a filename equal to the desired injected argument. 6. Ability to execute any program as root. The mount helper makes use of execlp on lines 78, 81, 83, 103, 106, 108, 139, and 141, and the first argument does not start with a / character. Because of this, execlp will search PATH for the executable to run. PATH is user controlled, and thus it is trivial to write a program that spawns a shell and give it "mount" as a filename, and direct PATH to its directory. 7. Ability to mount any device to anywhere. This leads to local root, since you can mount over /etc/ or /etc/pam.d/ or choose-your-own-adventure. --- bugs introduced along the saga: --- 8. Race with checking for /dev 9. Race with checking for /media 10. Race with symlinks 11. Another race with symlinks 12. Another race with symlinks 13. ... 14. Probably more things. Probably CVEs are only assigned for issues 1-7, though? Should these be grouped together in anyway, or should there be 7 CVEs assigned? On Thu, Nov 3, 2011 at 19:21, Kurt Seifried <kseifried@...hat.com> wrote: > On 11/03/2011 05:14 AM, Dan Rosenberg wrote: > >> Oh, and I suppose there's a very obvious but critical #6: > >> > >> 6. An unprivileged user an mount/unmount/eject whatever he wants, with > >> root permissions. Danger. > >> > >> This may help to "confirm": > >> https://bugs.launchpad.net/calibre/+bug/885027/ > >> > >> > >> As well, the maintainer has already issued a fix. From the bug report: > >> "Fixed in branch lp:calibre. The fix will be in the next release. > >> calibre is usually released every Friday.", which means the above > >> source link, that went to the trunk, now shows the fixed result. The > >> old broken code is still available here: > >> > http://bazaar.launchpad.net/~kovid/calibre/trunk/view/9675/src/calibre/devices/linux_mount_helper.c > >> > >> Note that the maintainer has chosen only to address #5. > >> > > I'd recommend holding off on the CVE assignments for now, since these > > issues are currently in progress and the final tally of issues isn't > > complete. > > > > -Dan > I took a quick look at that, I'm not clear on which ones have > beenaddressed , if you could comment on the original issues, which are > addressed and link to code commit I can start assigning CVEs. > > -- > > -Kurt Seifried / Red Hat Security Response Team > > -- Jason A. Donenfeld Deep Space Explorer +1-513-476-1200 www.jasondonenfeld.com
Powered by blists - more mailing lists
Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.