4 ms·
A process can't change the address space of another process, period. Even if one is a root process. Separation of address spaces is a basic security service pro
by scott_s 15y ago
A process can't change the address space of another process, period. Even if one is a root process. Separation of address spaces is a basic security service provided by the operating system. So I'm also puzzled how they are able to modify memory in Finder's address space.
The closest thing I can think of is that Finder executes arbitrary processes on behalf of the user. That is, when I double click on something, Finder has to do the fork-exec dance to launch that application. A process fork, however, creates an entirely separate address space for the new process. I would be shocked if Finder did not do that. So, yes, I'm also wondering what it is they do.
- simplekoala 15y agoThanks for the clarification. I was thinking may be they were mucking with shared libraries. I found this useful link on digging further. Doesn't seem like too much of black art. http://www.culater.net/wiki/moin.cgi/CocoaReverseEngineering http://www.culater.net/wiki/moin.cgi/CocoaReverseEngineering
- tlrobinson 15y agoNot true, at least on OS X: http://www.slideshare.net/rentzsch/dynamic-overriding http://www.slideshare.net/rentzsch/dynamic-overriding https://github.com/rentzsch/mach_star https://github.com/rentzsch/mach_star I don't know if this is how Dropbox works, but it seems likely.
- scott_s 15y agoThe first chunk of those slides talk about library hijacking. Say, you define your own version of malloc, make sure the application links to your version of malloc, and play your tricks from there. Process isolation has not been violated. The last five slides seem to be doing this: http://www.blackhat.com/presentations/bh-usa-09/DAIZOVI/BHUSA09-Daizovi-AdvOSXRootkits-SLIDES.pdf http://www.blackhat.com/presentations/bh-usa-09/DAIZOVI/BHUS... Slide 4 is the difference: OSX is BSD running on top of Mach. So these techniques use the Mach layer to get around basic process protection. This is terribly insecure.
- tlrobinson 15y agoYeah, the injection stuff was what I was referring to. Apple apparently changed OS X in 10.4.4 to only allow root or procmod group to do this http://guiheneuf.org/mach%20inject%20for%20intel.html http://guiheneuf.org/mach%20inject%20for%20intel.html
- ataranto 15y agoDropbox does in fact use mach_star.
- wmf 15y agoA process can't change the address space of another process, period. Don't forget ptrace.
- scott_s 15y agoI had, but that's not the situation I had in mind. You can only use ptrace on a child process. You can't use ptrace to attach to, say, another user's process.
- wmf 15y agoSee PT_ATTACH, and wouldn't both Finder and Dropbox be running as the user?
- deleted 15y ago[deleted]
- mrb 15y agoYou can attach to any of your processes, that's how debuggers work! Ever used gdb to attach to a running process and debug it on the fly? This is done with ptrace() with the PT_ATTACH flag. Now ptrace is known to be severly limited on Mac OS X, but there are ways around it: http://uninformed.org/index.cgi?v=4&a=3&p=14 http://uninformed.org/index.cgi?v=4&a=3&p=14
- lawnchair_larry 15y ago> A process can't change the address space of another process, period. Even if one is a root process. Separation of address spaces is a basic security service provided by the operating system. That is not even close to true, on any operating system.
- deleted 15y ago[deleted]
- bdonlan 15y ago> A process can't change the address space of another process, period. Even if one is a root process. Separation of address spaces is a basic security service provided by the operating system. So I'm also puzzled how they are able to modify memory in Finder's address space. Sure you can. Every major PC OS (Windows, Mac, Linux) has a debugging API that, in fact, does allow you to read and write the memory of other processes. Windows even has a convenient function to allocate blocks of memory in other processes' address space, and another function to spawn a thread in another process with an arbitrary entry point - which makes this sort of thing relatively easy to do. Mind you, the primitives provided can be a bit difficult to work with, but it's far from impossible.