4 ms·
It’s not just the lack of sandboxing — iMessage uses language-level serialization of object graphs. This design is never suitable for sending across privilege b
by amluto 6y ago
It’s not just the lack of sandboxing — iMessage uses language-level serialization of object graphs. This design is never suitable for sending across privilege boundaries. Apple should replace the format with a reasonable wire format. If this requires updates to apps that integrate with iMessage or breaks interoperability with older iOS versions, so be it.
- SV_BubbleTime 6y agoCan you explain a bit? Are you saying they send messages as Swift objects/structures directly? Instead of a serialization like JSON/CBOR/Proto/Proprietary/etc?
- toyg 6y agoI don’t expect anything as old and critical as iMessage is written on Swift. Chances are it’s all Objective C underneath.
- saagarjha 6y agoI hear that parts of the app have been rewritten in Swift: https://twitter.com/5aelo/status/1340995243320205313 https://twitter.com/5aelo/status/1340995243320205313
- amluto 6y agoSearch through https://googleprojectzero.blogspot.com/2019/08/the-fully-remote-attack-surface-of.html https://googleprojectzero.blogspot.com/2019/08/the-fully-rem... for NSKeyedUnarchiver. This seems to be functionally much like Python’s pickle, Boost.Serialization, Java’s object serialization, etc. These techniques seem clever, and they are genuinely useful for prototyping and for certain applications that inherently have no security concerns, but they are not at all suitable for network use. Fundamentally, for network use, one should define a data format, an API, etc and implement it. Using object serialization is backwards — it’s writing the code and then asking a framework to magically network it, and the result is that it networks it too much. (There are a few systems for writing code and a network protocol simultaneously that treat security as a first-class consideration. The E language comes to mind. I still wouldn’t use E objects to represent data for interoperability reasons if nothing else. But ObjC is not E, and Apple’s design is inexcusable in 2020.)
- saagarjha 6y agoIt’s not clear if this was involved in the exploits mentioned here.
- meibo 6y agoIt has been proven to be a weak point in their implementation with previous exploits, and it's likely to be the case here - it's a good guess at least. Will be interesting to read a write-up.
- saagarjha 6y agoApple has been hardening their software to use NSSecureCoding and similar since then, so I would be surprised if this would still be a problem (since this is fairly easy to check for and fix). My guess is that this is probably a run-of-the-mill overflow or corruption.
- amluto 6y agoThat’s like saying one can harden pickle by specifying magic options and trying to limit the supported classes to a very large list instead of an effectively infinite list. Sure, you can make the the blatantly insecure mechanism harder to exploit, but it’s still a horrible design. I think Apple could address this for real is one of two ways. They could replace the protocol entirely, or they could treat the existing baroque protocol like any other network protocol and write a grammar and parser for it. As an analogy, suppose you had a wire format like XML, and you had the clever idea to process it in a dynamic language like Python or ObjC by looking up each tag in a list of all known types and trying to instantiate it. Sure, it would work, and you would be exploited all the time. NSSecureCoding limits the available types to a large and apparently still open ended list instead of literally every type that the deserializer can make sense of.