6 ms·
Get root on macOS 13.0.1 the macOS Dirty Cow bug
- MaxLeiter 4y agoThe project zero bug linked in the post (which I recommend reading first) has more details on the exploit https://bugs.chromium.org/p/project-zero/issues/detail?id=2337 https://bugs.chromium.org/p/project-zero/issues/detail?id=23...
- MichaelZuo 4y ago"Will this be useful for jailbreak? Probably not. This - as far as I can tell - affects userspace processes only. Jailbreaks require a kernel exploit. (The Apple Security release notes says that this bug may allow “arbitrary code with kernel privileges”, but I can’t see how.) You might still do something cool on iOS with this, but I’m not sure what you’d overwrite: codesigning should protect all executables and libraries. (I have not tested this: let me know if you find anything!)" Looks like system integrity protection? or some other mechanism preventing this?
- waynecochran 4y agoAs root the machine is yours to do what you will -- as I have unfortunately learned the hard way many many moons ago.
- anyfoo 4y agoNot on iOS or macOS (unless SIP is disabled), no.
- pieresqi 4y agoThen it's not root...
- waynecochran 4y agoOK ... so w MacOS there is a user w more power than root? There has to be some entity that can ultimately install a new kernel and subsystem.
- anyfoo 4y agoIt’s more that there is far more protecting the system (and also e.g. data from different apps against each other, or things like access to your screen content), than the current user. Some of this is because we’re in a world where Macs and iPhones are far more likely to be single user machines than the UNIX machines of lore. See the PDF in my other answer.
- AgentME 4y agoThere could be code in the system that directs IO and only allows write requests to parts of the OS if they include a signature from Apple. I'm not sure if "a user with more power than root" would be the right way to describe that. The code would have a permission that "root" doesn't, but I wouldn't call the code "a user". It's a Unix idea that "a specific set of permissions" and "a user" are synonyms. Systems can exist where some permissions aren't represented as users.
- olliej 4y agoNo, there is no more powerful user, it’s just that the root user no longer has arbitrary control - it means that if an attacker compromises a root owned process the attacker can’t turn around and control the kernel. The kernel has a number of things it can do: if you try to do a special thing it could force authentication itself - eg a “root”/admin user can still do the action, but a process with “root privileges” cannot, it can require the process attempting the action have correct entitlements, it can simply reject the operation entirely, etc. it can do all of the above: I recall there being some operations that can only be performed by specific apps, with specific entitlements, as special users, with immediate authentication (startup items and the like)
- anyfoo 4y agoroot is essentially a POSIX concept, and from a POSIX perspective this is still root, it’s just that the POSIX security model is by far not the only thing in play here.
- waynecochran 4y agoCan't you disable SIP as root? What can't you do as root? You could replace the kernel. I guess I am use to the Linux world where I build kernels and install as root.
- LoganDark 4y agoWith SIP you can only reboot the machine into recovery mode, but the user would then have to go into the recovery mode terminal and run `csrutil disable` to disable SIP. You can't disable SIP on a live system and you can't automate actions in recovery mode.
- anyfoo 4y agoYou cannot do these with all security enabled, no. There are lots of other things that are prevented by SIP and/or Secure Boot. One of the principles is that being root should not mean that the kernel can be readily attacked without further bugs. That also means no /dev/kmem etc., and on top of that POSIX file permissions are by far not the only thing that is protecting access to the file system. If you want to go down the rabbit hole: https://help.apple.com/pdf/security/en_US/apple-platform-security-guide.pdf https://help.apple.com/pdf/security/en_US/apple-platform-sec...
- waynecochran 4y agoThat is a deep hole. I see there is a chain of certificates of trust for fine grain control to all the system parts beginning with the boot sequence. A lot more complicated than Unix systems of yore.
- counttheforks 4y agoApple goes through a lot of effort to keep control of the system out of their customer's hands.
- acdha 4y agoIt's a delicate balance because Apple has to support a lot of people and at this point there are literally decades of experience showing that many people, including administrators and developers, will make mistakes or bad decisions due to social engineering or simply greed (how many people installed malware because they thought it was cheaper than paying $20 for a software license?). SIP is a good compromise: it prevents malware from gaining completely control of the system but someone with physical access and administrator privileges can disable it for the few situations where that's desirable. That's not a high bar when you need it but it probably has a 100000:1 ratio of time preventing someone's day from getting worse to actually preventing legitimate work.
- forgotmypw17 4y agoHow crazy is it that getting root on your own device is an accomplishment? Edit: I didn't realize this post is about a privilege escalation exploit, not about getting root on your own device necessarily. My point still stands though.
- count 4y agoMany, many macOS devices are not 'your own' devices, and have access to many development backends and infrastructures.
- TheRealPomax 4y agoThat has nothing to do with this. Everyone can become root on their mac by typing their password. This exploit shows that you you can compile a bit of code that can then bypass that and run anything it wants with full root permissions.
- andix 4y agoOnly if you have admin permissions. If you don’t have them, you need to type in the password of an admin to become root.
- dvzk 4y agoIn most cases, yes, but that's not what the parent meant. In managed environments, it's common to not have root login access, and local privilege escalation is sometimes more critical than normal.
- fathyb 4y agoThis is a privilege escalation exploit, it gets a root shell from a non-root process. You can get root privileges on macOS using su/sudo.
- jackson1442 4y agoit's privilege escalation, the script is not being run as sudo also you can enable root by going to Directory Utility -> (unlock) -> Edit -> Enable Root User. Haven't found a need for this though.
- jeffbee 4y agoWhy can't C programmers stop themselves from writing something like: size = (unsigned)(expression); ? The contradiction is stark. If a variable deserves the name `size` it deserves the type `size_t` as well.
- TheRealPomax 4y agoI think the real question is "if this is so bad, why does the language allow it". Because asking why people use the language in a way it was designed for has the obvious "because they can, and the language allows them to" as answer.
- duped 4y agoThere's nothing fundamentally bad about the code above. It's a smell but could make sense. Like for example if I'm writing an interpreter that runs on devices with limited memory size_t might be bigger than I need for the length of a buffer in user code, and using a shorter integer might be a useful optimization. This is really an example where you have a sharp tool and need training/oversight/experience to use it safely. And even with those things, mistakes happen. The same is true of power tools as memory unsafe systems code.
- anyfoo 4y agoMany things "could make sense", but often do not in the common case. Your optimization is a good example for something where jumping through explicit hoops would not only be palpable, but even help signify the intent of your code optimization, while protecting common code from nasty surprises. Otherwise, we could also go back to earlier C days and, for example, let the compiler be silent about assigning a pointer of the wrong type without an explicit cast. That makes sense a lot of times, but still I want the compiler to tell me that I passed a struct foo* where a struct bar* was needed, or worse, a struct foo**.
- KerrAvon 4y agoIt blew my mind (in a bad way) when i went from CodeWarrior to GCC, and suddenly basic pointer typechecking was a minor warning that you had to enable instead of a hard compile error that was on all the time. My takeaway was that Unix people were lax because they didn’t have to worry about corrupting system data structures like we did on classic MacOS, AmigaOS, Windows pre-NT, etc.
- loeg 4y ago"Dirty Cow" is a reference to the similar Linux COW bug CVE-2016-5195: https://en.wikipedia.org/wiki/Dirty_COW https://en.wikipedia.org/wiki/Dirty_COW .
- musicale 4y ago> Apple for the test case[1] and patch. (I didn’t change anything: I just added the command line parameter to control what to overwrite.) Nice of Apple to provide the exploit code. ;-) [1] https://github.com/apple-oss-distributions/xnu/blob/xnu-8792.61.2/tests/vm/vm_unaligned_copy_switch_race.c https://github.com/apple-oss-distributions/xnu/blob/xnu-8792...
- super_mario 4y agomacOS Catalina 10.15.7 is also affected and there is no official patch from Apple.