{"id":11646,"date":"2015-07-12T10:55:55","date_gmt":"2015-07-12T14:55:55","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=11646"},"modified":"2015-08-31T20:41:59","modified_gmt":"2015-09-01T00:41:59","slug":"system-integrity-protection-a-k-a-rootless","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/07\/12\/system-integrity-protection-a-k-a-rootless\/","title":{"rendered":"System Integrity Protection (a.k.a. Rootless)"},"content":{"rendered":"<p><a href=\"http:\/\/asciiwwdc.com\/2015\/sessions\/706\">WWDC 2015 Session 706<\/a> (<a href=\"https:\/\/developer.apple.com\/videos\/wwdc\/2015\/?id=706\">video<\/a>, <a href=\"http:\/\/devstreaming.apple.com\/videos\/wwdc\/2015\/706nu20qkag\/706\/706_security_and_your_apps.pdf?dl=1\">PDF<\/a>, <a href=\"https:\/\/twitter.com\/landonfuller\/status\/609031649779539968\">tweets<\/a>):<\/p>\n<blockquote cite=\"http:\/\/asciiwwdc.com\/2015\/sessions\/706\"><p>And for the same reason that you shouldn&rsquo;t put all of your eggs in the same basket, you shouldn&rsquo;t rely on a single layer of protection to defend the device, because no matter how bulletproof, or water resistant, or shock absorbent this layer is, when it starts failing you, then it&rsquo;s complete game over.<\/p>\n<p>Instead, you should rely on multiple layers of protection, ideally with different security properties that will delay the advance of an attacker and reduce your attack surface.<\/p>\n<p>[&#8230;]<\/p>\n<p>So the reality is that once you have code running on the Mac, it&rsquo;s actually not that hard to become root, and once you are root, you have full control of the machine.<\/p>\n<p>Which means that any piece of malware is actually one password, or one vulnerability away from taking full control of the device.<\/p>\n<p>[&#8230;]<\/p>\n<p>We need a layer that will eliminate the power of root on the machine and protect the system by default, as it was installed by Apple on the machine.<\/p>\n<p>[&#8230;]<\/p>\n<p>This is what System Integrated Protection is.<\/p>\n<p>It is a new security policy that applies to every single process running on the system.<\/p>\n<p>[&#8230;]<\/p>\n<p>If you install anything in \/bin, or \/sbin, or anywhere under \/usr like \/usr\/bin, \/usr\/lib, \/usr\/libexec, then you need to move this content into the appropriate subfolder of the \/usr\/local folder, because that&rsquo;s the only location that is now available to third-parties.<\/p>\n<p>[&#8230;]<\/p>\n<p>For one, the task-for-pid and the processor-set-tasks SPI will now fail if they are called on a restricted process.<\/p>\n<p>And will set an 0 to EPERM.<\/p>\n<p>Which means that if part of your product relies on being able to attach to a system process at runtime, for instance, the Finder, and that you expect to be able to inject code into the Finder, that is not going to work anymore.<\/p>\n<p>[&#8230;]<\/p>\n<p>And finally, if you use dtrace, all dtrace probes that target a restricted process will not be matched anymore, which means you won&rsquo;t be able to see an interaction between the process and the kernel.<\/p>\n<p>[&#8230;]<\/p>\n<p>If you try to invoke lldb even as root and try to attach to the Finder, then this is going to fail.<\/p>\n<p>[&#8230;]<\/p>\n<p>Now, because root can actually set a NVRAM setting and we can&rsquo;t trust root to do the right thing here, it means we cannot have the configuration mechanism in the OS itself.<\/p>\n<p>If you want to change the configuration, you need to reboot your machine in Recovery OS, and you can do so by holding the Command+R key on boot.<\/p>\n<p>Then all you have to do is launch the Security Configuration application from the Utilities menu, and check the System Integrity Protection box, apply and reboot.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/danielpunkass\/status\/616344268488200193\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/danielpunkass\/status\/616344268488200193\"><p>It&rsquo;s awful restrictive. I ended up needing to disable it to even to attach to Dock with lldb.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/landonfuller\/status\/609040246924263424\">Landon Fuller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/609040246924263424\"><p>Add Dropbox &#8211; which used Finder code injection &#8211; to the list of things that&rsquo;d be impossible to ship on today&rsquo;s OS X.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/landonfuller\/status\/609074388156182528\">Landon Fuller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/609074388156182528\"><p>Mac OS&rsquo; original support for running multiple applications at once started life as a 3rd-party Finder extension.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/knweiss\/status\/609145745673990144\">Karsten Weiss<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/knweiss\/status\/609145745673990144\"><p>However, one of DTrace&rsquo;s selling points is\/was that you can use it anytime on a production system (without reboot).<\/p><\/blockquote>\n\n<p><a href=\"http:\/\/www.shirt-pocket.com\/blog\/index.php\/shadedgrey\/uncovering_our_rootlessness\/\">Dave Nanian<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.shirt-pocket.com\/blog\/index.php\/shadedgrey\/uncovering_our_rootlessness\/\"><p>In our investigation, we&rsquo;ve found that a new Extended Attribute -- com.apple.rootless -- is used to mark files and folders with this new protection. No process other than certain Apple-signed-and-authored ones can remove or write this attribute, and files and folders marked with this attribute cannot be changed.<\/p><p>[&#8230;]<\/p><p>Since we can&rsquo;t write the com.apple.rootless EA, SuperDuper removes it during the copy. That means the backup -- while fully functional and bootable -- is <strong>not<\/strong> an &ldquo;exact copy&rdquo; of the source. Specifically, SuperDuper! must disable the system protection feature on the backup, and  <strong>cannot<\/strong> recreate it when you restore.<\/p><p>[&#8230;]<\/p><p>It&rsquo;s easy to regain full system protection features: you simply need to reinstall the OS from the App Store. You can do this at your leisure, but doing it as soon as possible means you&rsquo;re less vulnerable (even though that vulnerability is quite small). It&rsquo;s a painless process, and it writes the fresh OS <em>under<\/em> your existing applications and data. As an added benefit, it will speed up your boot process, since it&rsquo;ll recreate certain caches that non-special-Apple-programs can no longer update.<\/p><\/blockquote>\n<p>Rootless also affects <a href=\"http:\/\/c-command.com\/dropdmg\/\">DropDMG<\/a>, since it installed its <a href=\"http:\/\/c-command.com\/dropdmg\/help\/command-line-tool\">command-line tool<\/a> in a folder that is now off-limits. I&rsquo;ve released a <a href=\"http:\/\/c-command.com\/forums\/showthread.php\/4491-DropDMG-Public-Beta-and-Mac-OS-X-10-11-El-Capitan\">public beta<\/a> that adds compatibility with Mac OS X 10.11.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/ameaijou\/status\/618299344156889088\">Gwynne Raskind<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/618299344156889088\"><p>Getting compilers and associated tools to be independent of the traditional UNIX path structure is brutally hard.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/rosyna\/status\/618300482432299009\">Rosyna Keller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/rosyna\/status\/618300482432299009\"><p>rootless is likely going to cause issues with badly misbehaving Linux\/POSIX software.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/schwa\/status\/618299060907212800\">Jonathan Wight<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/schwa\/status\/618299060907212800\"><p>also seen issues with some python modules (lxml) too. Ended up filing bugs all over the place and told &ldquo;not our problem&rdquo;<\/p><\/blockquote>\n\n<p>I&rsquo;m worried about compatibility with LaTeX, as well as the long tail of Unix tools, which will probably not be adapted for a long time, if ever.<\/p>\n\n<p>Update (2015-07-12): <a href=\"https:\/\/twitter.com\/ameaijou\/status\/620267805187817472\">Gwynne<\/a> <a href=\"https:\/\/twitter.com\/ameaijou\/status\/620271014501482497\">Raskind<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/620267805187817472\"><p>Also notice that the EA mentioned by Dave Nanian is, at least conceptually, just a reimplementation of chflags(SF_IMMUTABLE);<\/p><\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/620271014501482497\"><p>chflags() can only unset SF_* in single-user mode, whereas the EA appears to be gated by entitlements. The result is the same.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/landonfuller\/status\/620312325547933696\">Landon Fuller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/620312325547933696\"><p>Real difference is unrelated to security: EA is tied to Apple&rsquo;s code signing approval rather than local admin control.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/ameaijou\/status\/620312717841137664\">Gwynne Raskind<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/620312717841137664\"><p>That&rsquo;s what inspired a new impl in the first place: Local admin control is assumed to be too stupid to be safe.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/ameaijou\/status\/620313701648695296\">Gwynne Raskind<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/620313701648695296\"><p>I actually think it&rsquo;d be much harder to social-engineer users into turning off SF_IMMUTABLE than into booting Recovery<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/ameaijou\/status\/620315876986761216\">Gwynne Raskind<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/ameaijou\/status\/620315876986761216\"><p>Use of the existing options for this kind of control would keep them from being able to bypass it for themselves.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/landonfuller\/status\/620316193946099713\">Landon<\/a> <a href=\"https:\/\/twitter.com\/landonfuller\/status\/620316850694434816\">Fuller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/620316193946099713\"><p>Yes, and keeping it Apple-only makes it easy to flip a switch and make it mandatory, like iOS.<\/p><\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/620316850694434816\"><p> I have to assume that&rsquo;s the end-game. They&rsquo;re whitelisting\/grandfathering in user reqs that would cause blow-back while at the same time making it impossible for new entrants to introduce new requirements. Hard to see any other end-game<\/p><\/blockquote>\n\n<p>Update (2015-07-15): <a href=\"http:\/\/www.shirt-pocket.com\/blog\/index.php\/shadedgrey\/from_hells_heart_ioh_never_mind\/\">Dave Nanian<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.shirt-pocket.com\/blog\/index.php\/shadedgrey\/from_hells_heart_ioh_never_mind\/\"><p>Apple fixed the problem with copying the &ldquo;com.apple.rootless&rdquo; attribute in the Public Beta! So, with the release of our Beta 2 (download below), we&rsquo;ve included the ability to copy with that EA preserved, and thus system protection is maintained on the copy as well. Plus, there&rsquo;s no need to erase when restoring.<\/p><p>This is all great news for users: basically, copying will work as it always has.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/landonfuller\/status\/615236323998175232\">Landon Fuller<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/landonfuller\/status\/615236323998175232\"><p>The &ldquo;security&rdquo; of blocking code injection vs. the loss of productivity in only being able to use solutions Apple invents.<\/p><\/blockquote>\n<p><a href=\"http:\/\/blog.binaryage.com\/el-capitan-update\/\">BinaryAge<\/a> (<a href=\"https:\/\/twitter.com\/binaryage\/status\/615188535268745216\">tweet<\/a>):<\/p>\n<blockquote cite=\"http:\/\/blog.binaryage.com\/el-capitan-update\/\"><p>Both TotalFinder and TotalSpaces2 work by injecting code into processes that are part of OSX. They change the way those processes work, but they don&rsquo;t change the underlying system - they just add features whilst they are running. If you quit TotalFinder or TotalSpaces2, those processes restart and system returns to its original state.<\/p><p>However, in El Capitan OSX 10.11, this kind of modification will be disallowed by a new feature called &ldquo;System Integrity Protection&rdquo;. It is also known as &ldquo;Rootless&rdquo;. The feature prevents both modifications to your system files, and to system processes whilst they are running (even if you enter your password for administrator access).<\/p><p>So in a normally configured Mac, TotalFinder and TotalSpaces2 cannot run.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/medium.com\/@FredericJacobs\/the-fight-for-root-13934b12e831\">Frederic Jacobs<\/a>:<\/p>\n<blockquote cite=\"https:\/\/medium.com\/@FredericJacobs\/the-fight-for-root-13934b12e831\"><p>What Apple is doing with this new OS X is the same thing they&rsquo;ve been doing on iOS, protecting the boot chain by signing the whole boot process. This prevents (in theory) an attacker from hijacking the boot process to inject persistent malware. But unfortunately, this makes it really difficult to monitor your own machine against compromise. The only forensic analysis you can apply on such a system are black box analysis techniques since you can&rsquo;t have any insights about what&rsquo;s going on outside of user space. Malware becoming incredibly hard to track down if it used an exploit to enter kernel space. The hope is that it would not be able to find a persistence mechanism given that the boot chain is signed.<\/p>\n<p>[&#8230;]<\/p>\n<p>For now you can still disable most of these protections as a user\/developer, but most of your users won&rsquo;t (and it&rsquo;s probably safer for them not to). As on iOS, the Mac&rsquo;s distribution channels might be entirely controlled by Apple some day. It will be increasingly difficult to provide any feature that is not blessed by Apple. Something like randomizing your MAC address or <em>verifying<\/em> that your filesystem is encrypted like it should be might become impossible. How much of a &ldquo;general-purpose computer&rdquo; does it become if Apple acts as a gatekeeper to what operations can be ran on it?<\/p><\/blockquote>\n\n<p>Update (2015-07-16): <a href=\"https:\/\/twitter.com\/wspr\/status\/621579789095337984\">Will Robertson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/wspr\/status\/621579789095337984\"><p>The MacTeX people are already on top of the changes in El Capitan -- TeX Live will in the future be located inside \/Library<\/p><\/blockquote>\n\n<p>Update (2015-07-29): <a href=\"https:\/\/twitter.com\/chockenberry\/status\/626139269187305472\">Craig Hockenberry<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/chockenberry\/status\/626139269187305472\"><p>The OS X &ldquo;rootless&rdquo; mode has benefits, but it&rsquo;s going to make things very tough for <a href=\"http:\/\/louie.land\/blog\/tinkering.html\">the next generation of designers<\/a>.<\/p><\/blockquote>\n\n<p>Update (2015-08-13): See also <a href=\"http:\/\/atp.fm\/episodes\/128\">Accidental Tech Podcast #128<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>WWDC 2015 Session 706 (video, PDF, tweets): And for the same reason that you shouldn&rsquo;t put all of your eggs in the same basket, you shouldn&rsquo;t rely on a single layer of protection to defend the device, because no matter how bulletproof, or water resistant, or shock absorbent this layer is, when it starts failing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[146,738,47,371,323,31,1137,317,30,32,1199,48,369,1235,1221],"class_list":["post-11646","post","type-post","status-publish","format-standard","hentry","category-technology","tag-backup","tag-conference","tag-dropbox","tag-dropdmg","tag-dtrace","tag-ios","tag-ios-9","tag-lldb","tag-mac","tag-macapp","tag-mac-os-x-10-11","tag-security","tag-superduper","tag-system-integrity-protection","tag-wwdc"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=11646"}],"version-history":[{"count":10,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11646\/revisions"}],"predecessor-version":[{"id":11924,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11646\/revisions\/11924"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=11646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=11646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=11646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}