16 ms·
Remote code execution, git, and OS X
- reedloden 11y agoIsn't this why projects such as Homebrew thrive? For me personally, I just `brew install git`, and I keep it updated that way (`brew update && brew upgrade`)... Sure, Apple should ship a fix, but there are ways around it for now.
- aorth 11y agoYes, indeed, but Mac OS X users who use Homebrew are a subset of all Mac OS X users. The problem is in the default software. Apple's update model isn't good for this type of software, so the fact that it is possible for a user to install secure versions from Homebrew (or compile their own) doesn't matter.
- xyzzy123 11y agoExcept that git is used specifically by users who are downloading and compiling software.
- brightball 11y agoAnd at this point the first instruction for any OSX user who downloads and compiles anything is "Install Homebrew"
- stephenr 11y agoExcept for those who have used it and refuse to use it again. There are prebuilt binaries of up to date git distributed via .pkg. The yeast infection that is Homebrew is unnecessary
- brightball 11y agoThat's kind've harsh. What's the issue? Homebrew was about the best option that's existed on OSX for a few years now I thought...
- stephenr 11y agoThe dependency management is a joke, compile-by-default means it's slow as hell.
- anu_gupta 11y agoI look forward to your release of something better
- stephenr 11y agoSo your world view is that only those with a competing solution are allowed to identify issues in something?
- deleted 11y ago[deleted]
- mwfunk 11y agoIf you're going to be that snarky and nonconstructive about it, you're going to get snarky and nonconstructive comments back. Or at the very least, you're not going to inspire any thoughtful and interesting observations from anyone.
- danieldk 11y agoMost commonly-used dependencies are bottled (precompiled) these days.
- stephenr 11y agoExcept the dependency management solution is terrible, unless you want to compile everything yourself. For example: https://github.com/Homebrew/legacy-homebrew/issues/35995 https://github.com/Homebrew/legacy-homebrew/issues/35995
- atdt 11y agoThe Homebrew installation process uses the system git.
- arm 11y agoYep, since Homebrew requires the Xcode Developer Tools to be installed (which of course includes the outdated Git).
- danieldk 11y agoYes, but if Homebrew is malicious, you'd have more problems than a specially-crafted repository that exploits a git vulnerability. You are installing something that has all user access rights.
- gpvos 11y agoCan you inunstall XCode again once you have installed a compiler, toolchain, and git via Homebrew?
- matt4077 11y agoYou can just install the command line tools without xcode. From those tools, most can be replaced with their homebrew versions so you only need them for bootstrapping. But if you want to do hardware- or OS X related development, you will need to keep the tools around. CUDA, for example, needs clang et. all. They don't take much space, though, and the toolchain is treated a bit better by Apple than utilities like git, vim etc.
- gpvos 11y agoI don't know about homebrew, but macports has clang and other toolchain stuff, so I think it might be possible to uninstall Xcode after installing all necessary tools through macports?
- OJFord 11y agoYou _could_ get recent git by some other means prior to installing homebrew. Anything short of compiling from source wouldn't require ever installing XCLT.
- bronxbomber92 11y agoXcode is distributed and released over the AppStore and can be rev-ed at any frequency, independently of the OS; Apple's update model not does prevent an expedient update. Perhaps the main cause for delay is the associated QA efforts to make sure that other components in the stack which depend on git don't break in the case that git has broken binary compatibility (i.e. changed its public interface).
- atdt 11y agoIf things are tied up in QA, that is a problem in and of itself, because relevance is an important quality for a security bugfix to have. If my system is compromised today, it will do me little good that the bugfix Apple ships next month was tested extensively for compatibility with Xcode. It is too late for there to be an expedient update from Apple. The vulnerability was disclosed to oss-security over a month ago, on March 15[0]. SUSE had a patch out the next day[1]. By March 24, Debian, Ubuntu, Red Hat, CentOS and Oracle had all issued fixes.[2] [0]: http://www.openwall.com/lists/oss-security/2016/03/15/5 http://www.openwall.com/lists/oss-security/2016/03/15/5 [1]: http://lists.opensuse.org/opensuse-security-announce/2016-03/msg00059.html http://lists.opensuse.org/opensuse-security-announce/2016-03... [2]: http://www.securitytracker.com/id/1035290 http://www.securitytracker.com/id/1035290
- bronxbomber92 11y agoI should clarify that I don't know why an update hasn't been pushed. I was only speculating why it might be taking so long.
- ascagnel_ 11y agoGit is not part of the default configuration on OS X. You need to install XCode first.
- sbuk 11y agoI'd argue that the the OS X user who use git are a subset of Mac OS X users. In fact, a similar subset to that which uses Homebrew...
- atdt 11y agoIt's a bit too precarious to be an adequate solution, in my opinion. It depends on /usr/local/bin always being ahead of /usr/bin in $PATH, and on scripts never invoking the system git via its full path, and on Homebrew never accidentally uninstalling git due to a botched upgrade. Not to mention the fact that Homebrew itself uses the system git to install itself.
- tobylane 11y agoWhen would the order of $PATH vary?
- OJFord 11y agoWhen someone's changed it? Which people do _all the time_.
- tobylane 11y agoMine is changed for Heroku, but it only prepends. I've never seen $PATH be rearranged.
- OJFord 11y agoIf you prefix it with something already in there then it's effectively rearranged. You wouldn't do this deliberately, of course, but it happens a lot - people end up with massive PATHs because they blindly prefix when something's gone wrong and it _may_ be the solution.
- dchest 11y agoSure, but your /usr/bin/git is still vulnerable. You're one config mistake (or maybe running a "malicious" script) away from executing.
- jaequery 11y agoI'm pretty sure git isn't the only thing that is (or will be) vulnerable. Vulnerabilities happen, it's a fact of life. You will have to constantly update your systems no matter which OS you run.
- dchest 11y agoDid you read the linked article?
- developer2 11y agoYes we did, and the author appears to be posting with the primary intent of spreading anti-Apple sentiments. The opening paragraph begins by insulting startups for being full of Macs. The rest of the post is full of snide comments. They go off on a tangent about System Integrity Protection and the fact that OS X is not Linux ("Apple... keeps you from twiddling", "Well, sorry. You also can't chmod", "I'll just strace it to see what it execs! Oh wait, this isn't Linux."). This could easily have been posted as a simple statement of the CVEs in question and the version of git shipped with latest OS X patch. Not difficult to post facts about a specific issue without insulting an entire operating system - and taking cheap shots at the people that use it. >> If you rely on machines like this, I am truly sorry. I feel for you. I don't feel sorry for myself. Odd that a stranger finds it necessary to offer me their sympathy, let alone condescending pity.
- chris_wot 11y agoThe opening paragraph reads: "Sometimes I think about all of those pictures which show a bunch of people in startups. They have their office space, which might be big, or it might be small, but they tend to have Macs. Lots of Macs. A lot of them also use git to do stuff, perhaps via GitHub, or via some other place entirely. There are lots of one-off repos all over the place." If you can see a cheap shot in that paragraph, then you are reading things that aren't there. A blog post gives a certain amount of freedom for the author to elaborate on a theme. You seem a bit defensive. I'm not sure why, but I certainly don't think that Rachel was attacking those who use Macs.
- raimue 11y agoIsn't this the perfect setting where an attacker will ask you to replace this binary with a custom binary with an additional backdoor? In the best case the attacker would fake an email that looks like it came from your IT department. Even if you were suspicious, a quick search on the web would confirm that Apple really ships a vulnerable binary. So you believe the email is real. Then you go along and replace the binary with the malicious binary provided in the mail. The fixed binary needs to be shipped by Apple.
- xyzzy123 11y ago$ brew install git $ git --version git version 2.8.1
- tadfisher 11y agoNow grep your system for `/usr/bin/git`.
- xyzzy123 11y ago$ grep -rc /usr/bin/git /usr/bin/ /usr/local/bin/ /usr/sbin/ /sbin/ | grep -v ':0' | wc -l 0
- emmelaich 11y agoer.. find /usr/bin/ /usr/local/bin/ /usr/sbin/ /sbin/ |grep -w git
- fjarlq 11y agoBut that merely enumerates pathnames that contain the word "git", not programs that might still invoke the vulnerable version of git directly via "/usr/bin/git".
- mitchty 11y agoSo then give find a proper predicate: $ find /usr -name git -type f -xdev -exec {} -v \;
- fjarlq 11y agoNo... tadfisher's point was that even if a fixed version of git is installed, some other program -- say, a wrapper script for git -- might still invoke OS X's vulnerable version if it directly references "/usr/bin/git". So, such a system could become compromised if that wrapper script was used to access an untrustworthy repo. All your invocation of find does is enumerate every file (or directory) under /usr named "git" and execute it with the -v option. In addition to dumping a lot of error messages, all that would do is eventually run "/usr/bin/git -v" and inform you that yep, your system still has the vulnerable version of git installed. In other words, tadfisher's point, which I now wish had been made explicitly, is that simply installing the fixed version of git is possibly insufficient to secure your system. You also ought to either disable /usr/bin/git or convince yourself that no program will invoke it. Disabling /usr/bin/git is probably easier.
- _ZeD_ 11y agoRemember when I said El Capitan? Apple is doing something new which basically keeps you from twiddling certain system-level programs without going to fantastic lengths. Not even root is enough to do it. Can someone explain it to me?
- mateuszf 11y agoSome parts of the system are write protected. You have to disable that as a root and restart system, then you are allowed to modify these parts.
- Someone 11y agohttps://support.apple.com/en-us/HT204899 https://support.apple.com/en-us/HT204899, https://en.wikipedia.org/wiki/System_Integrity_Protection https://en.wikipedia.org/wiki/System_Integrity_Protection, https://derflounder.wordpress.com/2015/10/01/system-integrity-protection-adding-another-layer-to-apples-security-model/ https://derflounder.wordpress.com/2015/10/01/system-integrit...
- chris_wot 11y agoSo what Apple have designed is a "system integrity protection" system that actively prevents you from mitigating security issues. Only a very large company could come up with such an amazingly awful idea. I can just imagine the meeting where this was decided that it would "protect" users where someone said "Freeze all the system binaries even from the end users, that will make them more secure!".
- bndr 11y agoWhy the hate for OS X? Fedora 22 and Fedora 23 have only git 2.4.11 and 2.5.5 in their repositories.
- foota 11y agopresumably because you can easily update git on Fedora
- bndr 11y agoWhen I do `dnf update git` I get at most 2.4.11/2.5.5, the only way I can get the latest is to compile from source. EDIT: OK. So the fixes were backported
- foota 11y agoFrom what it sounded like in the article though you can't even easily replace the OSX binary for git, even if you compile it yourself.
- bigger_cheese 11y agoAccording to https://bodhi.fedoraproject.org/updates/FEDORA-2016-6554eff611 https://bodhi.fedoraproject.org/updates/FEDORA-2016-6554eff6... "Notes about this update: Security fix for CVE-2016-2315, CVE-2016-2324 (by updating to 2.5.5)." So looks like they have backported the security fixes
- chm 11y agoDebian stable is still on 2.1. https://packages.debian.org/jessie/git https://packages.debian.org/jessie/git ~ git --version git version 2.1.4
- Daviey 11y agoSecurity fixes were cherry picked... http://metadata.ftp-master.debian.org/changelogs//main/g/git/git_2.1.4-2.1+deb8u2_changelog http://metadata.ftp-master.debian.org/changelogs//main/g/git...
- dkopi 11y agoI Clicked on the link expecting to read about a vulnerability. This is actually about blasting OS X for not having updated versions of software. Software updates are super important of course, and apple should be better at pushing the latest software updates, but I wish the title reflected that.
- fabulist 11y agoI disagree that it is clickbait. There is a schema people use for announcing security vulnerabilities ("<issue> in <software> version <number> through <bigger number>"), and the RCE issue was recent, so to those familiar it was clear that it was exposition rather than disclosure. For those unfamiliar, now you know
- imron 11y ago> This is actually about blasting OS X for not having updated versions of software. No it's not, it's blasting OS X for shipping software with a known remote execution vulnerability, and not allowing the user to easily upgrade that software themselves due to new OS-wide security policies.
- dkopi 11y agoGood point. I stand corrected.
- Kristine1975 11y ago
- jnardiello 11y agoI might be wrong here, but using brew will NOT remove git shipped with xcode, so you are still vulnerable.
- scottydelta 11y agoyes, that is why you set path variable in your bash_profile so that when you do 'which git', you are not pointed to /usr/bin/git but /usr/local/bin/git. you might also want to do sudo chmod a-x to /usr/bin/git.
- rndstr 11y agoWhat about scripts that explicitly call /usr/bin/git?
- jaequery 11y agoIt's really a moot point as this was AND still is a common problem no matter the OS. I fail to see any releases of any OS that's secure out of the box.
- dchest 11y agoVulnerable git ships with Xcode, not OS X "out of the box". (What point is moot?)
- caf 11y agoDid Apple not backport the security fixes to the version of git they ship?
- dchest 11y agoLooks like no: https://opensource.apple.com/source/Git/Git-58/src/git/revision.c https://opensource.apple.com/source/Git/Git-58/src/git/revis... Function is path_name, nlen type should be size_t and there shouldn't be integer overflow in the first loop.
- dchest 11y agoHmm, wait, it's Git-58, not Git-63. Edit: OK, Xcode 7.2 security notes mentions Git vulnerability CVE-2015-7082 (older than the ones in questions), and Xcode 7.3 doesn't mention any fixed vulnerabilities in Git, so I guess it's vulnerable and NOT patched.
- tbrock 11y agoSensationalism at it's finest. Just use the homebrew version, it will eventually get fixed in OSX proper.
- hoppa_liza 11y agoThere are several replies in this thread as to why this is not a complete solution.
- deleted 11y ago[deleted]
- 0x0 11y agoSame with ssh, have they patched UseRoaming yet and if so how long did that take?
- mukundmr 11y agoIf you execute csrutil disable && reboot, you will be able to disable System Integrity protection and do what you want including fixing /usr/bin/git. What is the problem?
- valleyer 11y agoYou need to do that from the Recovery OS, by the way.
- cyphar 11y agoYou can use an nvram command to do it from the main OS. nvram boot-args="rootless=0" EDIT: Actually, it looks like that no longer works. Dammit.
- bdash 11y agoI believe that toggling a boot-arg only disabled SIP on early developer betas of OS X 10.11. For shipping releases of El Capitan you need to use csrutil from the recovery partition as a parent comment mentioned.
- atdt 11y agoThe problem is that System Integrity protection was put in place for my benefit and marketed to me as a feature that had been "designed to help prevent potentially malicious software from modifying protected files and folders on [my] Mac", and now that I have it and paid money for it (or the Apple hardware it runs on), I find out that it is making me less secure by preventing me from removing a software component which has a remote code execution vulnerability, and that the only way around that is to disable the feature is by using Recovery to update my computer's NVRAM.
- comex 11y agoYes. (a) You are not a typical user; (b) disabling SIP takes five minutes plus whatever productivity loss is caused by rebooting; (c) it isn't actually necessary to disable SIP to make git inaccessible, as described later in the post; (d) even if it were, you would get most of the protection by just installing your own git in a different location and changing PATH; and (e) the vulnerability in question is incredibly minor anyway, considering the percentage of the time that most people follow checking out a repository by intentionally running arbitrary code from it, which (f) would at least partially justify Apple not backporting the patch, but then again, nobody in this thread has even verified that they haven't.
- urza 11y agoI have my git repo on debian stable and git --version git version 2.1.4 Should I be worried?
- omnibrain 11y agoAs long as you have the latest version (2.1.4-2.1+deb8u2) from the repository you should be safe, as Debian usually backports security patches. You can check the changelog: http://metadata.ftp-master.debian.org/changelogs//main/g/git/git_2.1.4-2.1+deb8u2_changelog http://metadata.ftp-master.debian.org/changelogs//main/g/git...
- fauigerzigerk 11y agoWhy does debian do that instead of upgrading everyone to the latest git version?
- mjn 11y agoDebian 'stable' releases mainly target people who like fixed upgrade cycles. No feature/API/etc. changes for the lifetime of a release, only security patches. Means that you can have your servers routinely applying updates with relatively little worry that something is going to stop working because of a change. Even minor feature changes can break things, especially when run in scripts, so they prefer not to risk non-security updates, even small ones. Then you upgrade to the next release at a time scheduled to debug any problems that come up. I believe RHEL releases work somewhat similarly. For my developer machine I prefer rolling updates, so I run Debian 'testing' on that one, which is basically a snapshot of what is going to be the next stable release, with daily updates (there are also distros like Arch that only do rolling release). There's also a kind of in-between option: http://backports.debian.org/ http://backports.debian.org/
- fauigerzigerk 11y agoWhat if I want to decide for each individual package if it should get (a) upgraded to the latest version (b) upgraded to the latest version that the developer considers API compatible (c) kept frozen Is there a way to do that with the debian package management system?
- mattbillenstein 11y agoDid they also have a problem with that bash shellshock vuln years ago? I remember OSX running a really old version of bash at one time.
- acdha 11y agoThat's a somewhat more complicated issue: they're shipping the last version of bash using GPL v2. Upgrading would be a significant legal question and I'd be surprised if the long run outcome wasn't removing bash.
- Daviey 11y agoInitially I was shocked that the vendor has files on the system that cannot be changed by the user.. but now I think there is more to it. The real thing that is bugging me, is finding out what /usr/bin/git really is.. which this article doesn't answer. Is it a standalone immutable executable that the file system is aware of, or something else? Right now, I wish I had a mac.
- cyphar 11y agoThere's a security feature on El Capitan that essentially makes certain files and directories on your host system immutable. Presumably it's some set of filesystem flags, but not even root can change them. There's a magic nvram command you can use to disable the security feature (which if you're a developer you'll have to do eventually since you can't touch anything in /lib or /usr/bin or /bin). The command in question is: nvram boot-args="rootless=0" It seems to me that this is related to that feature. Although, I don't get why it looks like the two files are hardlinked but you can modify one -- maybe it's because this magic was only applied to the /usr/bin directory (and thus a hardlink to the file can still be modified). That's a bit dumb IMO, but I can imagine this being a bug in the OS X kernel. Unfortunately, I'm not sure how to actually create such files (maybe if I disable System Integrity Protection, create a file and hardlink to it and then re-enable SIP). If I figure it out on my friends' MacBook I'll comment below. EDIT: Okay, so it might not be what I said earlier. If I do something along the lines of: 1. Disable SIP (csrutil disable in recovery). 2. Create a file in /usr/bin and hardlink it to a non-SIP location (like $HOME). 3. Re-enable SIP (csrutil enable). 4. Try to change the permissions on either of the hardlinks. It will fail. So presumably SIP correctly propagates permissions to all dentries. I'm not sure what's happening then.
- Daviey 11y agoPerfect, thank you!
- pilif 11y ago> It will fail. So presumably SIP correctly propagates permissions to all dentries. I'm not sure what's happening then. /usr/bin/git is a small wrapper that invokes the actual git from either the command line developer tools or from xcode (whatever you have selected with `xcode-select`)
- pjmlp 11y agoBest part: > So, what's the big deal? Crappy C code gets exploited every day, and we upgrade it, and then we're "safe" until the next huge hole that's been there forever is reported. (In the meantime, people party with their private stash of vulnerabilities.)
- blub 11y agoI looked at the offending function, and it would be trivial to rewrite it in C++ in an easy to understand and safer way. It probably wouldn't be as safe as Rust, but still a lot better. A lot of Linux C utilities would benefit from such a treatment.
- joushou 11y agoA rewrite in C++ would not make it any safer. Rewriting it to make it easier to understand could make it safer, but you do not need a different language for that.
- blub 11y agoYes it would, because this is basically string processing where C is the worst possible language one could use. I've detailed in another comment how std::string could be used.
- joushou 11y agoYou're talking about naked char[]. You can just as easily make a struct{ int len; char* str; } in C, and combined with the "n" variants of string operations, would work just fine with common tools. Again, C++ does not make anything safer, and its types can easily be replicated in any other language.
- kccqzy 11y agoI believe this is called pascal style strings and GCC has builtin support for it.
- fniephaus 11y agoSame problem is valid for Python. The subprocess module on El Capitan has a bug that has caused me a lot of trouble recently: http://bugs.python.org/issue26083#msg258011 http://bugs.python.org/issue26083#msg258011 You'll need to put an updated subprocess.py in your Python path, editing the one provided by OS X is prevented by the System Integrity Protection... ¯\_(ツ)_/¯
- StreamBright 11y agoAre you not using virtualenv? I always use virtual environments as much as possible to avoid being locked in on an older version (for example Python in this case).
- fniephaus 11y agoOf course you can also use virtualenv, but if Apple kept software that ships with OS X up-to-date I wouldn't have to deal with this at all.
- cname 11y agoIt seems like this is an issue with most operating systems. Regarding Python in particular, RedHat/CentOS seems particularly "bad". My take is that the OS-installed tools, such as git or Python, are generally for use by the system and not for use by me for software development.
- joelkesler 11y agoNot everyone has Xcode installed. For those of us who have only installed the Command Line Tools, you will find the Apple supplied git at /Library/Developer/CommandLineTools/usr/bin/git so the command to disable this vulnerable version is: sudo chmod -x /Library/Developer/CommandLineTools/usr/bin/git
- joelkesler 11y agoI would recommend also installing an updated git through homebrew and using that instead.
- cm2187 11y agoThe windows equivalent of homebrew (chocolatey) is great but has many out of date packages.
- deleted 11y ago[deleted]
- chris_wot 11y agoI'm still trying to understand why Apple install XCode command line utilities into an area of the system that is protected by SIP. There is nothing hugely special about their tools - every other app apparently has to install into a different location as best practice, so I don't understand why Apple don't follow their own guidelines!
- amake 11y ago> I'm still trying to understand why Apple install XCode command line utilities into an area of the system that is protected by SIP. They don't. Plenty of comments explain where the Xcode git actually is.
- chris_wot 11y agoAnd as has also been asked - why do they symlink to the /usr/bin directory in the first place then? They have three perfectly reasonable directories they can install into, which is what they recommend that application developers do when installing their software: /Applications /Library /usr/local So why do they feel the need to link git into /usr/bin? They could link it into /usr/local/bin - the $PATH variable includes this directory already. You state that plenty of comments explain where the Xcode git actually is, but that misses the point entirely. Why is it linked into /usr/bin?
- yAnonymous 11y agoSame as always. Apple only care about security when people start screaming. I can't wait until a worm or similar wide-spread disaster hits the Apple eco-system and just deletes the system when it's done spreading.
- benley 11y agoSo ... has anybody actually checked to see if Apple has patched the vulnerability in git without bumping the version number, like pretty much every linux distribution does for their stable releases?
- chris_wot 11y agoYou're joking, right? When I use software and I look at the version number, I like to know that it is what it says it is. If they are going to patch the vulnerability, then I want to know if they have done so. Besides which, this whole question is missing the point somewhat. There is no easy way of updating the system supplied tools like git, even if you wanted to. The latest version of git is v2.8, and I think it would be grand if we could use a version less than 6 months old! Hell, the same goes with any other system software.
- comex 11y agoInability to manually update the copy of a tool located in /usr is par for the course with most Linux distributions - in that case the kernel won't stop you from replacing the files (unless your distro has the root FS mounted RO), but the package manager will typically replace them right back the next time there's a minor update (same for OS X updates pre-SIP), and it's easy to accidentally break things. Instead, the recommended method is to generally install non-distro software in /usr/local or elsewhere and put the location on your PATH. Which, of course, works just as well on OS X, and it's what Homebrew and MacPorts do. I don't see the problem.
- chris_wot 11y agoRight, if its so easy then why don't Apple update git more frequently then?
- chris_wot 11y agoSee, this I don't understand. We have open source distributions who provide massive amounts of packages, for free, on a continual basis and don't have any where near the amount of profits that Apple has. Yet Apple, who have a lot of users and must update severe security flaws, don't have a reasonable way of updating system software. Instead, we get the updates once ever so often and these security updates don't even come close to fixing all the security bugs in the software on my OS X operating system. It's really not very good. Vendors such as Apple and Microsoft are far, far too slow in releasing updates.
- chetanahuja 11y agoSo... to try and get an answer to the unanswered question in the blogpost. The files are probably hardlinks to a single "superbinary" image somewhere. The actual code is probably checking the value of argv[0] to dispatch to the actual git code (or whatever command name was invoked). The question is, why is Apple doing this? Is it some sort of diskspace saving scheme (to avoid duplicating common boilerplate code)? I suspect some part of this answer includes the words "for security" but it's already been proven to be BS at this point.
- comex 11y agoNah, the binary doesn't actually contain git. It's just a stub (in /usr/bin) that locates Xcode on the system (in /Applications/Xcode.app by default but configurable) and execs the real git binary from there. See also: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html https://developer.apple.com/library/mac/documentation/Darwin...
- chetanahuja 11y agoOK great. So now the question is why? I've seen this "multiplexed binary" scheme implemented elsewhere in more constrained circumstances but it doesn't really make sense to me for a desktop OS to be doing it.
- comex 11y agoBased on some Googling and my memory... the history of toolchain installation on OS X is a big mess. In the old days, pre-2011, you would manually download the Xcode installer from Apple's site (after a free registration), and it would install stuff into both /Developer and /usr. IIRC /usr/bin/gcc was good enough for native compilation, but for iOS you would have to locate the compiler under /Developer/Platforms/something-or-other. (Today, with LLVM's ability to target multiple architectures in one compiler, the toolchain binaries are the same and only the sysroot depends on target.) Then in 2011, Xcode was moved to the then-new Mac App Store, but the app you got on the store was just an installer (blatantly ignoring the App Store rules, and later sandboxing restrictions, that apply to everyone else), and the installation path was the same. Oh, and the store version was initially $4.99, which pissed everyone off until it was made free in the next minor update. In 2012, Xcode was overhauled so that /Applications/Xcode.app was directly installed by the App Store and the toolchain was located inside the app bundle. This was a big improvement in part because it made the App Store's delta app updates work properly for Xcode - previously you had to keep the installer app around so it could delta update that, which doubled disk cost, and then you still had to run the installer and wait for it to re-copy the whole IDE and toolchain. It also made it easier to have multiple copies of Xcode installed side by side, and uninstallation was now a matter of dragging the app to the trash, like any other. But if you wanted standard Unix builds to work (as opposed to building within Xcode or manually specifying the compiler path), you now had to download the separate "Command Line Tools Package", which could be done either from within Xcode or directly from Apple's developer site (the latter welcomed as it saved bandwidth and disk for anyone who didn't want to download the several-GB Xcode package), and it would install a duplicate toolchain to /usr. Finally, in 2013, the shim binaries in /usr/bin were introduced; this system has lasted to the present and has a few advantages: - The Command Line Tools can now be mostly segregated into /Library/Developer/CommandLineTools rather than getting mixed up in /usr with the rest of the OS - however, the installer still dumps headers into /usr/include. - If the user has the full Xcode installed, it isn't necessary to install the Command Line Tools, as the shims will just execute the binary from /Applications/Xcode.app (or wherever Xcode is installed - you can switch globally or using an environment variable). That is, unless you need /usr/include to exist. - Of course, installing outside of /usr/bin made it easier to introduce SIP. - Convenience: the shims are shipped with the base OS, so if you try to run a developer command and neither Xcode nor the Command Line Tools are installed, rather than 'command not found', you get a nice GUI dialog that downloads and installs the latter in one click. (Well, "nice"; if you have a configure script that probes for the compiler by trying to run it, but doesn't depend on it, and you don't want to install it, you now have to deal with a GUI dialog popping up every time you run configure. At least, this is my experience with the similar shim that exists for javac. This should be improved.) I suppose the advantages of the first three points could mostly have also been accomplished if Apple built some system into /etc/profile or whatever to automatically add the relevant toolchain to the PATH. Why Apple decided to go with shims instead I can only guess at, but all in all it's a decent system, and it's nice that each toolchain is now mostly self-contained in one directory so they're easy to manage. Compared to most Linux distros, where compilers are just distro packages but there's no easy way to install a package to an alternate path or have multiple versions installed simultaneously (unless you build from source), I'd say it's an improvement.
- bertan 11y agoWhy just disable Apple's version? You can install brew git and then link XCode git to homebrew version.
- milliams 11y ago> So you have lots of people running Macs and running git. Great, right? Peace, love, and free software? I'm confused about how 'Macs' and 'free software' go together?
- nsajko 11y agoSo OS X El Capitan sucks. As evidenced by removing from (advanced) users the control necessary to secure their systems. Is it feasible for Mac users to downgrade to older OS X?
- anon1385 11y ago"Advanced" users would know how to turn off System Integrity Protection if they wanted. It makes absolutely no sense to downgrade OS X versions to avoid SIP. It's quicker to just disable SIP than to downgrade the OS.
- kfrz 11y agoJust wiped OSX off my MBP 11,2 and rocking Ubuntu minimal. Happy days.
- terhechte 11y agoRunning Ubuntu in VMware and doing all the critical stuff there is also a good solution as you still get perfect hardware support through the underlying OSX layer.
- OJFord 11y ago> They are basically screwed until Apple deigns to > deliver a patched git unto them Actually, no. Don't use the tools that come pre-installed. All you have to do* is: brew install git *and make sure that brew installs are prioritised in your $PATH. Which you should do anyway.
- raimue 11y agoThen you will get caught by some GUI that uses /usr/bin/git. Be aware changes to PATH in your shell startup files do not affect graphical applications at all. Just installing git from Homebrew or MacPorts is not enough to be safe from this remote code execution.
- verbify 11y agoThe article made it look like you were basically fucked. I stopped using guis for git about a week into starting using git. Just avoid guis, use homebrew, and you'll avoid this problem.
- fvargas 11y agoYosemite and El Capitan prioritize /usr/local/bin over /usr/bin, so if you install the latest version of git via Homebrew, you're mostly okay. If you're using Mavericks or older, it is as described above. That said, any program that invokes /usr/bin/git directly instead of /usr/bin/env git would still be vulnerable. It's not as big of a problem as the article makes it out to be so long as you install a newer version of git. If you're really concerned, the filesystem restrictions mentioned can be bypassed by booting into safe mode. Though it's still not a good idea to mess with the default program installations since Apple may depend on that particular version of git for some program.
- OJFord 11y agoDoes it come pre-installed? I thought it came only with XCode Command-Line Tools. Which personally I don't have (anything I use is from Homebrew). If it is there without XCLT, then anyone reading this is more than capable of removing it, and dealing with anything that subsequently can't find it.
- z3t4 11y agoWhy doesn't Apple use Linux !? And why doesn't people install Linux on their Apple machines!?
- Kristine1975 11y agoSo if I understand correctly: 1. OS X ships with a "git" command in /usr/bin that merely looks for the real "git" command inside Xcode or somewhere else and executes it. 2. The vulnerability is inside the real "git" (shipped with Xcode/the Command Line Tools) that Apple apparently cannot be bothered to update. 3. The author complains about not being able to make /usr/bin/git non-executable because of SIP. Why not just make the real "git" command non-executable and be done with it? And since /usr/bin/git apparently just delegates, the git vulnerability at least won't endanger most users, since they don't have the real (old, vulnerable, thanks Apple) git installed.
- rnikander 11y agoI wonder how hard it is to defeat ASLR, once you find a buffer overrun: https://en.wikipedia.org/wiki/Address_space_layout_randomization https://en.wikipedia.org/wiki/Address_space_layout_randomiza...
- cs702 11y agoCompanies like Apple and Microsoft prevent you from modifying the software installed on your computer to improve your security. Ironically, when they do that, they also make it difficult, impractical, or impossible for you to upgrade or disable vulnerable software (in this case, an old, insecure version of git with remote-code-execution vulnerability). People like Richard Stallman have been warning about this sort of thing for decades.
- chris_wot 11y agoWatch out! I made that point and I got flayed alive for it.
- joushou 11y agoI'd like to point out, however, that installing a new version of git is not in any way blocked by either Microsoft or Apple. If you install git with homebrew, you get the newest version, which will take precedence over the Xcode variety unless you mess with your $PATH. Tricking you into using the old version would require execution rights on the machine. You can also remove the /usr/bin/* binaries if you boot the machine without the system integrity features. You can boot back to normal after the modification. It is inconvenient that these dev tools are not updated frequently (bash, zsh, and many other command line tools are terribly out of date), but it is not terribly difficult to install a fresh version in parallel.
- falcolas 11y ago> Tricking you into using the old version would require execution rights on the machine Not really, they just need to be able to modify a single file owned by the user (.bashrc), or just the current shell session (again, with a variable owned by the user). Re-ordering `/usr/bin` and `/usr/local/bin` in $PATH isn't that hard.
- coredog64 11y agoI would argue it's not even that difficult. In the README.md, put some kind of note that there's a bug in the current version of git (and maybe point to some random Google group posting) and mention that on OS X it's better to use the XCode version.
- e40 11y agoOn all my Mac's I use the MacPorts version of git, which it keep up to date, compared to the Apple version. It's a non-issue for anyone that does.
- splicer 11y agoOn git-scm.com, it says the latest build for OS X is 2.8.1. However, if you actually go to https://git-scm.com/download/mac https://git-scm.com/download/mac to try to download it, they give you the 2.6.4 installer.
- peff 11y agoThis is being worked on: https://github.com/git/git-scm.com/pull/741 https://github.com/git/git-scm.com/pull/741
- mcintyre1994 11y agoI have a macbook with command line tools installed and I have homebrew installed. I think I installed Python on brew, but which git tells me I'm using /usr/bin/git for that. Is there a list somewhere of dangerously old software Apple have shipped to me that I should reinstall with brew immediately?
- mikegerwitz 11y agoIt's a shame that Git uses GPLv2; this would not be permitted under v3. Unless, I suppose, Apple does actually provide a means of replacing these programs. Of course, the overall issue of not being able to modify the software on your own system still holds.
- raimue 11y agoWhat makes you think GPLv3 would forbid something like Apple's SIP? Which clause are you referring to?
- mikegerwitz 11y agoPlease correct me if I'm misunderstanding, as I'm not familiar with the system. GPLv3[0] introduced protections again Tivoization: -- "“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM)." -- [0]: https://www.gnu.org/licenses/gpl.html https://www.gnu.org/licenses/gpl.html You can install your own version of Git, yes. But Apple, as a distributor, cannot prevent you from installing a replacement for the software that it distributes. If, wherever they provide the source code to Git, they do provide a method to replace the currently install software, then that wouldn't be a problem. Now, I did find this: https://opensource.apple.com/source/Git/Git-17/Makefile https://opensource.apple.com/source/Git/Git-17/Makefile Which does indeed have an install target. Can anyone tell me if this replaces the original program, or at least provides information necessary to remove it?
- makecheck 11y agoApple clearly has some frequency of updates (10.11.x updates, security updates, etc.) so the fact that they’re a corporation or using closed-source, etc. is not necessarily relevant. If they want to patch something tomorrow, they can. Since they haven’t changed this package, there may be another reason besides security. For example, some important group at Apple or a big customer may have created a dependency on "git" functionality, and they want to carefully test any change on a large scale before proceeding. Just because it isn’t wise for important things to depend on fragile environments doesn’t mean they can ignore those environments when making changes. The problem with simple versions is that an update seems to be all or nothing: you can’t easily fix a small security hole when starting from a few versions ago because you have to consider anything else that changed. Ideally, systems are designed in enough layers that small updates really are practical without affecting other features.
- peff 11y agoMinor nit: this post mentions v2.7.1 as safe from these vulnerabilities, but it is not. v2.7.4 is the first safe version (this mistake was inherited from the bogus oss-security post that is linked in the article).
- wheeliedart 11y agoI couldn't have said it better. Will comply and aspire to inspire. and no ut omnes. I'm out of my league here, any direction on any level no advice refused Thank You in advance for you help and considerations. Reciprocation to ensue. quiet and listening
- joushou 11y agoBTW, for the curious, I just realized that you can easily disable the bundled git on OS X: sudo chmod a-x /Applications/Xcode.app/Developer/usr/bin/git Done. Running /usr/bin/git will now proxy you a permission denied error.
- John_Rae_Teous 11y agohttp://millamok.millyclub.cpa.clicksure.com http://millamok.millyclub.cpa.clicksure.com