A Look at iMessage in iOS 14
googleprojectzero.blogspot.com
googleprojectzero.blogspot.com
Nothing to be found here as far as we know, is still a result that deserves publishing. Let's make it more of the norm.
> I feel it sets a precedent for research broadly
imply it's some sort of first time?
https://en.wikipedia.org/wiki/Series_of_Unsurprising_Results...
https://www.cbc.ca/radio/asithappens/as-it-happens-thursday-...
discussed on HN (2019): https://news.ycombinator.com/item?id=19968679
p.s. Samuel who published the research OP posted is one of the best hackers I've ever met, he helped me code our interview challenge test that we still use (it's that good!)
I disagree, it's a fantastic, approachable disection of what Apple did to mitigate some nasty security holes. Worth the price of entry by far.
I suspect that they wanted to use conditional expressions or something without having to use a "real" programming language with loops or I/O, which risks freezing the interpreter and leaking data.
One of the key points.
> However, it is worth noting that while the high level control flow logic is written in Swift, some of the parsing steps still involve the existing ObjectiveC or C implementations. For example, XML is being parsed by libxml, and the NSKeyedArchiver payloads by the ObjectiveC implementation of NSKeyedUnarchiver.
rantmode=on
While I complain about how constrained NDK happens to be, I imagine that is exactly Google's goal, to force everyone to write as little C and C++ code as possible.
Microsoft seems to be the worst case in this regard, despite the whole security talk, WinDev is pretty much doubling down on C and C++.
I find ironic that Azure Sphere sells security, yet only supports C on their SDK.
rantmode=off
My experience with security advocacy, is that only works with seeing is believing.
So the initial Swift rewrite might also be to prove a point to the team, while libxml and NSKeyedArchiver will eventually come down the roadmap.
From what I understand, MS is gradually moving away from C/C++: https://thenewstack.io/microsoft-rust-is-the-industrys-best-...
Check the praise for C and C++ over here,
https://microsoft.github.io/microsoft-ui-xaml/
https://techcommunity.microsoft.com/t5/internet-of-things/de...
Or how XNA was killed in name of DirectXTK.
Meanwhile the MonoGame, Unity, WaveEngine, and for IoT, Meadow (what Sphere should have been) efforts are all driven by third parties.
Joe Duffy mentions on his RustConf talk that even with Midori proving it was capable to handle production loads (it even powered parts of Bing for a while), it was a no go for Windows team.
Apparently the culture change in WindowsDev will take a couple of generations.
I’m getting the opposite feeling. Just last week they released a way to expose all Windows APIs past and present to C# and Rust, with theoretically any language supported on that same framework.
I can’t speak to the Azure API you mentioned but clearly Microsoft sees the value in non-C languages.
Microsoft does see a value, the WinDev unit not so much.
"Porting the Clipboard sample to C++/WinRT from C#—a case study"
https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-a...
> Unmatched Native Performance > >WinUI is powered by a highly optimized C++ core that delivers blistering performance, long battery life, and responsive interactivity that professional developers demand. Its lower system utilization allows it to run on a wider range of hardware, ensuring your sophisticated workloads run with ease.
https://microsoft.github.io/microsoft-ui-xaml/
It is like the left hand undoes what the righ one is trying to do regarding security improvements.
Historically ASLR on Apple’s platforms has had many weaknesses, mostly stemming from poor randomization across many different subsystems :P
What I’m also really curious to know is what the performance implications will be of isa PAC…
Safe languages don't magically make all code impossible to exploit, they just reduce the attack surface to logical errors, instead of having to deal with UB and memory corruption as well.
The same way that helmets and belts don't save people from dying all in all kinds of accidents, yet they surely help reducing the mortality numbers.
I enjoy languages with helmets and belts.
Randomization is NOT free. Randomization either requires that the values are pre-computed before install (which means delivering and pre-computing N different versions) or it is computed it on device.
If the randomization is computed on-device how to you validate that the binary or a library has not been "substituted" - persistent malware, APT?
The "compute on device" was a feature of very old macOS versions - it was annoying and took quite a lot of resources.
"TOTAL ASLR" depends on a CPU arch if it fully endorses over all addresses position independent code and data (Q: homework for ARM, x86_64...). If the ABI allows violations of this you cannot glide / slide all code and data addresses without significant runtime costs. This will likely result in a compromise.
To be clear, I am not complaining about a lack of ASLR where it would be prohibitive, such as mapping the shared cache at a different address for every process (which, unless done carefully, would kill the benefits of it being in shared memory as the pages would all be dirtied). I am talking more about various instances where Apple has generally used very poor slides for reasons that aren't all that great, leading to the randomization being easy to break.
My comments were entirely about the shared cache region and how it can be moved.
I again ask you to do the homework - please calculate how it could be done better given the address spaces involved. Address spaces going from 32bit to 64bit have gotten better, but this does need to be kept into consideration given the size of the object involved and the API / CPU instructions available (please, I ask you to consider all of the addressing modes available to the ABI for all of the currently supported platforms)
[added]
It is likely the individual objects that compose the share cache region are compiled independently. There are lots of individual objects! Resolving the dependencies of the composite shared object are likely expensive.
Historically I observe that the contextual data available to a static or dynamic linker has been very constrained, which makes relinking / reallocation objects a challenge.
Oh, and because you mentioned it: yes, the shared cache has many objects in it. The process of making it is fairly involved, especially since many optimizations go into it (string deduplication, perfect hashing for Objective-C runtime metadata, shortening intra-cache procedure calls, …) But this is all done once when it is built by Apple's B&I, so it's not a problem on-device.
There has to be some reason.
And, I am sure there is a reason, I just have not seen anything that indicates anything good enough that it is worth drastically reducing the quality of the ASLR they provide.
Assume foo.dylib and bar.dylib are system libraries, both live in the shared cache, and foo links to bar. Both are loaded and mapped to a running user-space process.
If foo links to bar, then there must be a symbol table somewhere in physical memory with an entry that points to bar’s TEXT.
That symbol table is part of the shared cache, right? Doesn’t it already follow that bar’s TEXT needs to be at the same virtual address in every process?
Yes, and this is how the shared cache works. If you wish to map the shared cache elsewhere there would have to be another copy of it in memory, which is why this would be a massive pessimization if done without designing for it. Perhaps you might have some idea as to what would need to change to make this not be as bad.
OpenBSD relinks the kernel with new randomization on every boot ("KARL").
Fun stuff, but probably a nightmare to make it work with signature checking :D
There isn't a "popular" CPU architecture that is 100% PIC for all of the allowed address ranges. There are "optimizations" the compiler can choose for limited addresses "reaches". Please consider independently compiled libraries that are aggregated into something larger, specifically languages that permit subclassing and inheritance. How can they be moved within an address space?
If there is a hierarchy of address availability this means that ASLR cannot be implemented in a pure way - it must involve runtime fix-ups if the base address changes. If the length of an instruction must change because of the addressing mode, what happens? How can you do ALSR? Do you rewrite all instructions (is there space? was space allocated?) or always use the most expensive address mode?
Languages that support subclassing and inheritance don’t represent any special hazard to relocation; ultimately these are built out of data and function symbols that need to be supported even if you’re only compiling C.
> In July and August 2020, government operatives used NSO Group’s Pegasus spyware to hack 36 personal phones belonging to journalists, producers, anchors, and executives at Al Jazeera. The personal phone of a journalist at London-based Al Araby TV was also hacked.
> The phones were compromised using an exploit chain that we call KISMET, which appears to involve an invisible zero-click exploit in iMessage. In July 2020, KISMET was a zero-day against at least iOS 13.5.1 and could hack Apple’s then-latest iPhone 11.
Now if only there was a nice open-source, cross-platform way to do this..... hint..... hint......
:-)
(a) create a sandboxed child process with some code inside it (b) talk to that sandboxed child process (e.g. Firefox and Chrome both have IPC libraries) (c) handle the resulting crashes nicely, restarting child process when necessary
Only Apple can provide the described security for their messenger, but other messengers which face similar challenges (rendering untrusted content) cannot protect themselves.
I wonder when that will happen
And make a version check if failed attempt will crash the software or you only get one attempt. Sometimes the hardest part is finding out what version of exploit to use and that may even have to be done manually.
E.g. a zero-click zero-day exploit that spreads through a zero-click iMessage message could travel the world in a few seconds.
Security is vastly better than it used to be and good zero day exploits are guarded jealously. Making a big worm is a quick way to expose a zero day.
The people who have access to these zero day exploits keep them tight for targeted attacks where they are less likely to be discovered.