BLASTPASS SANS HackFest Hollywood 2023 (Video)

Presented by: Christopher Crowley

Presentation

The BLASTPASS SANS HackFest Hollywood 2023 video presentation focuses on a zero-day exploit in iOS devices, covering concepts such as zero-day exploits, forced entry attacks, PassKit, buffer overflow, memory corruption, sandbox evasion, and Point Authentication Code (PAC). The presentation also delves into specific vulnerabilities, including invalid table creation, memory corruption, and CVE-2023-4683, as well as exploit development, attack surface targeting, ASLR and pack details, and cybersecurity hardening measures.

Featured Clips

"We don't know this part of it, we don't know that part of it."
"If you want to connect to me on LinkedIn, that's my link shortener to my LinkedIn profile."
"When these sorts of attacks are no longer feasible, I hope that the world will be a better place because if it's not a better place, then we're all in a lot of trouble."

Full Transcript / Content

--- Page 1 --- Thank you very much. Really appreciate it. Basically, I have a tremendous amount of stuff that I need to go through. A lot of this is about my comprehension of this particular attack. It is something that involves a lot of uncertainty. So I'm going to say over and over again, well, we don't know this part of it, we don't know that part of it. And so in order to actually have the comprehension, I will dip back to other things that are related or relevant in order to try to explain how that would work. So this particular exploit is related to CVE 41061 and 41064. And of course, I just want to thank everybody for being here, listening, those of you online. I actually last minute had an opportunity to come to this event and speak at it. And I want to thank SANS and all of you for help. And I want to thank all of you for helping to make that happen. So if you don't know me, I've been working in computers for a long time. When I was 15 years old, I got a job doing Alteryx and VMS systems administration in a place near where I lived. And I basically ran tape backup with a bunch of Uber geeks who had quit Bolt, Baranak, and Newman because it had gotten too corporate. So that was sort of like where I started in my computer stuff. My work as a consultant, and I've worked across a large number of different sectors and worked with organizations. Both small and large in these different sectors, I've been teaching for the SANS Institute for an extended period of time. I teach a class on cybersecurity operations. I teach mobile device pen testing for SANS in the red team curriculum. That's the SEC 575. At various times, I've taught a whole bunch of other classes like 401, 503, 511, 504, 560, 580. So I have sort of a broad spectrum of capability. And I bounce between different things in order to solve whatever the most coherent and relevant problem is at that moment in time for whoever I'm working for. And so it's something that I really struggle to maintain comprehension of a broad spectrum of problems in cybersecurity. If you want this slide deck, of course, Steve said earlier, you can get it. You can also download it from my website. And there's a whole bunch of information that's in here. And one of the things about this particular one is this is not a sort of spec. It's not speculated. This was actually used by a, you know, an organization that was targeting individuals. And this information, I hope that you can comprehend it and help to defend yourself, your families, your organizations, because this sort of attack is the thing that is unfortunately getting people killed, being used to put people in jail. That is being used to to influence and manipulate people. Right. --- Page 2 --- So when these sorts of attacks are no longer feasible, I hope that the world will be a better place because if it's not a better place, then we're all in a lot of trouble. Right. I never use Twitter, but my Twitter handle is Secret Montance. And if you want to connect to me on LinkedIn, that's my link shortener to my LinkedIn profile. So a little bit of background in terms of the comprehension of how this particular attack is working, there was a write up that I did in 2021 on the forced entry attack that Citizen Labs published related to a zero click zero day. And the reason why I'm mentioning it is because the study of that particular attack allows me to have enough comprehension of this attack to be able to speculate confidently on what different things they're doing, because there's so much uncertainty on this particular one. So there are a couple of things that I did on a talk for SANS, and these are links back to that. There's a Citizen Lab forced entry post that has a lot of details and then a second one that has even more details that describe what's going on. There was also the original Apple security update from 2021 that you can go back to that has some more details. All of these link shortener links I'm providing for reference if you want to study it more. And they're all case sensitive if you're using that to go and look at this for the research. I need to do this kind of quickly. And I have a lot of details that I want to pull in. So that's why I'm providing all these reference details for you to go back to. If you don't really understand it in my first pass through, hopefully you'll be able to read the details or ask me later in order to understand it. So this is a zero click zero day. Zero day, of course, we're familiar with the idea that there's an exploit that's released in the wild, that there's no there's no patch for it. Zero click is no interaction from the user in order to be able to trigger this. And so this came out. We actually had one on 12 iOS 12. This particular one was from 2021. And then we'll look at one here in just a moment for iOS 16, fully patched at the time that it actually came out. So this was originally the forced entry one from 2021. And Citizen Lab is an organization that is based out of Toronto. It's the Monk School, and they have been studying the adversarial tradecraft of NSO for an extended period of time. And so I'm going to go a little bit into the concepts of threat actors and attribution in order to have a comprehension of what why this matters and how we understand these things. OK, now, for me, if someone were attacking me, whether it's NSO or NSA, I'm really --- Page 3 --- probably going to just leverage the same sort of defensive repertoire, depending upon who the threat actor is and the actual attribution. Doesn't matter that much for me. But for some organizations, the ability to differentiate that it was a specific threat actor or not helps with investigation. It helps with identifying resources that might be used by the command and control after the fact. And it also helps in terms of a comprehension of the various technologies that are leveraged by the attacker, where you could actually then go look for adjacent and related attacks that would help you to understand what's out there currently. OK, so this is really something that is usually some in the defensive space, but I absolutely think that there's value in having a good comprehension of adversary tradecraft and the offensive side if that's what you're doing for work. Now, in terms of the the Citizen Lab post, they cited that they saw that the Pegasus implant was installed afterwards. Pegasus is a product that is offered by NSO. So an Israeli company and Citizen Lab says we saw this come in and we've been studying this for a while now, oftentimes they will suppress specific details in an OPSEC maneuver to not let NSO know all of what they understand in this particular attack in terms of resources and attack capability. OK, now a little bit in terms of attribution in general. This is a simplified diagram from a U.S. Defense Science Board write up. This is the executive summary one figure one that is in a paper from about ten years ago, and it describes adversary capability in these terms, a ten dollar club actor can reuse a vulnerability in an exploit that was built by somebody else, a million dollar club actor is capable of actually developing an exploit in order to be able to leverage that and attack things. This is zero day type capability and a billion dollar club actor in their assessment is capable of creating vulnerabilities that they can then leverage later. Creating vulnerabilities in a supply chain or a manipulation of individuals or a compromise of code in a in a company where there's actually source that's there. OK, zero days happen and we need to be able to deal with this. We also need to be able to effectively comprehend who is the sort of organization that could do this, who could come up with it. And when I get into some of the technical details, what's actually there, then we will actually be able to see how complicated this is in order to to accomplish it. So lots of details that you could go look at and the specifics related to to the attack, to the this particular attack. But I want to talk about the sort of thing where they're actually doing the attribution and pinpointing it to a specific organization. And in this case, and this is the one from 2021, they talked about a specific table where the exploit was deleting details --- Page 4 --- from a table, but they failed to delete things from a secondary table. And this is something that NSO saw. I'm sorry that Citizen Labs saw in a couple of specific cases and then attributed it to NSO. So this is how Citizen Lab has said in the past. We think it's this particular company. And so they said this was a process that was created. And this is something that they saw. Now, in this one, which, by the way, the original post was September 7th of this year. What they said is basically nothing in terms of how they know that it was NSO, except for the fact that we assess it to be this company and we see that there was Pegasus after the fact. That's all. That's all. That's what we have to go on from this particular one. And in the past, what they have done is published additional information after the fact. So they're attributing it. And I think that we can go based on their past experience with this organization. I think that we can simply trust that this is a valid assessment. I actually requested more details. Of course, they didn't give it to me. They don't know who I am. They don't care. I'm like, hey, I'm doing this talk, give me more details. I want to talk about it. And, you know, zero response. OK, so my confidence in their details is the past details that they've provided, and they're very specifically working with, you know, tracking this particular adversary in their tradecraft. So there are two CVEs that I'm going to talk about originally related to that I'm going to talk about that are originally related to this. And then there's one other CVE that I need to pull in in order to explain how it actually works. OK, so there is credit from Apple on the CVE of 41064. Now, this 41064 is actually the image I.O. flaw. And I'll talk about image I.O. in a bit and how this flaw works. And then the 41061, which is the Blastdoor circumvention. And just by show of hands for the people in the room, how many of you know what the Blastdoor service is on iOS? Nobody, right? I mean, like this is this is real. This is very real. This is a thing that they actually put in an iOS 14. And I'm going to talk about the details of what it does and how it works and how it's supposed to protect us. In order to be able to get a zero click zero day onto iOS, you have to get around this extremely restrictive sandboxing capability that's in place on the operating system. OK, and then I'll go into the CVE 2023 4864, which is where the actual source of the flaw is that gets triggered in the image I.O. Now, image I.O. on iOS is where images are placed, OK? So for the wallet, this is what we have to go on. --- Page 5 --- A validation issue was addressed. With improved input validation, like that's pretty much what Apple just published related to this particular thing, and they credited and credited themselves for the 16.6.1. So we found this particular thing on how they were able to circumvent the kit. Anyone know what pass kit is an iOS pass kit? Pass kit is a way that you can actually manage passes within your iPhone. So let's say you bought a movie ticket and then the movie ticket gets texted to you and then you use that ticket when you go into the movie theater later. Pass kit is managing that data interchange. So there's a whole API that's available for developers for pass kit to be able to actually have this resource. The image I.O. is actually a buffer overflow, which we know that buffer overflow allows for the writing of data to memory where the allocation of space was inadequate, according to the to the program, right? This is where I start to get an understanding. I mean, because when I see this stuff come out, usually it's just like, OK, I'll just take that for granted. Yeah, that works. OK, well, how does it work? What is the mechanism that's actually in place? So this particular patch that I referenced, Citizen Lab says that they saw that there were malicious images that were sent and this is in their blog post that I referenced. And they say that the corresponding pass kit flaw was part of the was part of the exploit chain. If you want to read the details of it, you can go and read that. But it's very sparse in terms of what's actually there. So the idea would be that we send a text message. The text message is received by the phone. The phone then processes that text message, probably needs to do some thumbnail generation in order to show the user what's there that goes to pass kit for parsing the data that's provided in that message that then goes to image IO, which is where the memory corruption buffer overflow is, which then triggers an exploit chain in order to be able to continue with that. But in order to do this, we need to get the zero click capability. Now, zero click is just sort of the aspect of getting into a phone because there is no service that's available to actually exploit. If you want to sort of see more about the full attack surface of mobile devices. There's a talk that I gave in 2020. It's on the Sands website. It was something that actually somebody asked me to do it initially privately. And then there were some complications for doing that. So I just gave a public talk and I was like, Mary, you can go and you can go and look at it. And what I'm trying to do for people in this particular talk is to come up with --- Page 6 --- the entire gamut of what could be attacked with respect to a mobile device. And this includes cellular infrastructure and the real time operating system for the mobile device itself, the applications that are on there and so on. But this is a very specific one in terms of the in terms of the remote code execution is that you would need to get the text message into folks. Maybe you remember stage fright. Does anyone know stage fright as a as a named exploit? This was one that actually targeted Android. And it was almost this exact same circumstance. It was an image processing flaw in the lib stage fright code that is available on Android devices that would process content. Malicious movie was the specific attack that Joshua Drake provided. Twenty. Seventeen. Eighteen. That actually demonstrated that particular flaw, you know, huge problems. People were disabling all sorts of stuff to automatic download on SMS messages because of the stage fright flaw. This is very similar sort of thing. But unlike in that Android where it appeared to be a potential for having a very broadly targeted circumstance, this one is very, very targeted, this one, because NSO has developed it. They only. Released it to customers who are paying NSO in order to be able to use their exploit code. Like I said earlier, this then usually becomes a nation state, which is getting NSO code and infrastructure in order to be able to target very specific individuals to be able to monitor their private communication. Now, just as an aside for me, this is one of the reasons where I'm always like, should I talk about this stuff? Should I really be spending my time working on explaining to larger groups of people the details of how this works? I do actually think there's value in getting that information out there. I do actually think there's value for each of you, at least to understand a little bit of how this would work. So in terms of circumventing blast or. iOS added this capability in iOS 14, it is a tainted data processor that is intended to deal with SMS messages because SMS messages are the primary vector in of non user interaction for attackers. This is the attack surface on a mobile device that needs to be protected. So a lot of my understanding of what Blastor does is a Google Project Zero write up that's here that I will summarize for you. And in this particular case, the Citizen Lab name for this exploit is Blast Pass. So they're blasting pass Blast Door using the Passkit exploit in order to be able to get into the into the phone. This graphic is from the Samuel Gross write up originally that from that link that was just there, I pulled out a couple of relevant details of the workflow of how the Blast Door process is protecting things. It actually ingests the content, pulls the content down from from the transfer. --- Page 7 --- It does parsing of the of the message text on the phone. It checks to see if there are specific attachments. If there are attachments on the message, it makes a decision about some serialized data and whether it's there on the on the on the message and then processes it accordingly. But at a certain point, it's going to decide, OK, this thing looks like it's all right, now it might need to go get some help from another program in order to be able to process the message that's inbound in order to render the information to the user so the user can decide what to do with that message. And this is all set up in a heavily sandboxed, highly protected process that is intended to deal with this tainted data. Now, in 2021, we saw the the exploit sequence and again, there's no more details in the 2023 exploit, so I'm going back to the 21 write up in order to have a better understanding of what this might look like. So in the 21 forced entry write up, it actually exploited the IAM Transcoder agent and it had a couple of different crashes for IAM Transcoder agent that were listed in the logs. The first one was for malformed PSD files. And in the in the message sequence that they showed, there were 27 different messages sent. And I speculated on that write up that it was like, this is probably grooming memory, this is probably sending stuff in to get it set up so that, you know, when the exploit actually occurs, the stuff that they want to have in memory is is probably already there. Similarly, the second one is the JBIG2 data in a PDF file. And this there were only four of them sent. So, again, this seems feels more like the trigger of the exploit, whereas the first one is a lot more sort of spraying of information that's in there and into memory. Now, in terms of PassKit right now, I don't have much else except for the review of what PassKit does, the review of the wallet content on the specific XML specifications that's there, and sadly, this is sort of an end to my comprehension of this attack sequence at the moment. But the one thing that I do know, that this would be item number four on the list that I'm about to show you, which would substantiate all the things that Project Zero said that you would need to do in order to get past the blast door. OK, so the necessary things would be a memory corruption vulnerability, which is the buffer overflow, which I haven't talked about yet. Some sort of remote ASLR breaking. Now, Blastor actually has a bunch of protections against that. If you have a crash of Blastor, every time that Blastor restarts, it actually doubles off the startup time and delay to basically make it so it's much harder. --- Page 8 --- If someone's trying to brute force this, it just keeps slowing down and slowing down and slowing down and making it harder and harder. OK, the code execution, we don't actually know exactly. And when I get into the into the write up of the WebP vulnerability, which is the underlying vulnerability, the only thing that I can show you is a proof of concept about how to create a a malformed table that would cause memory corruption. We don't actually have the specific code execution and then the pack point authentication codes. Now, again, some of you may know what point authentication codes are. Some of you don't know what they are. This is a capability that was introduced in ARM version eight dot three, which specifically is intended to protect against calling functions from non authorized areas of memory. So the point of authentication code needs to be coordinated between the developer and the processor. But essentially, it's a hardware driven defensive capability, which is specifically intended to protect against return return oriented programming and jump oriented programming techniques of calling into areas of executable memory. Because if you call into an area of executable memory, but you don't have a valid point or authentication code of where you're coming from, even if it's an executable area of memory, you still can't execute because your pack doesn't work properly. So this is speculation on my part. I don't know this for certain. But what I think is aligned for this is this sandbox evasion is probably where they're actually getting into the into the exploitation, where they're leveraging one of these lightweight interprocess communications. In order to then call out and say, okay, here's the basket, here's the evasion. Let's leverage this authorized interprocess communication in order to be able to then trigger the activity. Okay, so the sandbox escape is there, and I think that this is probably what happened here is that the attackers developed this to say, all right, which of the services that are available from within the blast or protected environments? I'm going to find a flaw in. And then once I find that flaw to get out and start to do some execution, I can then find a memory corruption and deliver hopefully an image or some attachment that then gets processed that triggers the memory corruption that allows me to then do the exploitation. So what we know, and I'll put no in air quotes, what we have limited knowledge on is the memory corruption and the sandbox escape. And so I mentioned that pack is there something that basically is a hardware capability that is a great hardware capability, but it seems like developers are a little bit slow on the uptake of it, and it's actually fairly complicated to implement from a developer perspective, and as such, the exploits are still usually able to find ways around it. I don't have enough time to go into the details of --- Page 9 --- of this. I originally had it in the talk, but I just don't have don't have time. If you want to understand what it would take to get around pack, there's a great in beer post also project zero from March of this year for a previous zero day against image IO in iOS that you can go and read. And it has a lot of interesting clues that might potentially be related to this particular exploit chain. It's not the same, but it's in the. It's in the same library, and it talks about the attacker developing a whole bunch of primitives in memory in order to be able to actually do the exploitation around pack and I just again, in the interest of time for this talk, I can't go into it. So the sort of details of this are that we have this buffer overflow and the the reported information says that it's image IO, which then points back to Web P. Now, Web P is code that is actually for processing images in a lossless encoding format. Right, and so Web P is code that's released by Google, and there's high value in leveraging this particular code in order to provide lossless compression of images. Apple recently included this into image IO, and there was notification from Apple to Google on September 6th, a day before the patches came out from Apple, that there was a flaw in Web P, which then Google very quickly patched in Chrome. It actually took a little while to get the patches for Web P to other places, but they they patched it in Chrome almost right away. And then they patched it in Android in the October update. OK. And so based on this Ben Hawk's blog post talking about the details of this particular vulnerability, he says from the stuff that's there, from the sequencing of information of updates, I can pretty much assume that Blast Pass vulnerability and the C of E20234863, originally a Chrome bug and then later sort of updated to have a more general Web P vulnerability expression. They're the same thing. OK, so I'm going to talk a little bit about Ben Hawk's write up on how that particular flaw was discovered by him and then some speculation on how whoever found it originally would have had to actually do it. OK, so this particular Web P out of downright targets something called the Huffman table. I don't know what Huffman tables are. Maybe you do. Right. Huffman tables are this frequency analysis on on images that looks for repeating sequences of bits in an image. And then we'll map those repeating sequences to shorter. Portions of a bit in order to be able to I'm sorry, shorter sequences of bits in order to be able to provide compression. So this is a lossless compression algorithm based on a frequency analysis of an image. And the write up of the patch for 4863 shows that when build Huffman table is called. --- Page 10 --- It's going to check to see if it thinks it has enough space to be able to then build out the tables that it needs to do the compression. So I'm going to go into the details of this, and it's fairly complicated in order to be able to produce this lossless compression. What it does is it. It actually figures out how many tables it's going to need. It creates space for those tables, and then it does a mapping in a tree structure, which actually now is implemented in a table structure. And it does this mapping in order to be able to say, all right, these bits in the original image map to these shorter bit sequences in the in the table. And this unique mapping would then allow us to actually show, all right, there are a lot of repeated sequences. But as it turns out, this would actually increase the size of the image, not decrease it in order to get the compression, what they then do is reapply the Huffman tables to the mapping table, and they do this iteratively over and over again in order to be able to have the reduction. So. The VP eight L is actually a WebP. What Hawkes hypothesized was it's probably this particular method call inside of the build Huffman table class that would allow the exploit to work. So he said, based on all the available information, I then focused on this particular method called in order to shift the Huffman table pointer past the allocated space for all of the tables that would be needed. And so this is where he was looking for this memory corruption bug. And so he tried to create a table to do that and failed. And in his write up, he talks about how he failed over and over and over again. He looked at some other related code from the person who wrote the algorithm originally on how to calculate enough of a table size in order to do this. And he's like, even with that, I couldn't figure it out. And he says, and this is probably because this was originally an eight bit mapping. But Google implemented a longer potential bit mapping within the images. And so he's like, I keep creating these tables, but I can't create anything invalid. And after a while, I sort of felt like, oh, I should probably give up. Maybe I'm looking in the wrong space. But what he also assessed was that at the end of the work, there were usually these five tables that had the greatest influence on the creation of all of the tables that were in place. So he decided to focus. I'm going to those five. And eventually what he did was he said the algorithm was assessing that it needed five tables. So he manually forced it to make four tables and it was going to make a fifth table. But the four tables actually consumed all --- Page 11 --- of the space that the algorithm had allocated for the five tables. And then his fifth table was able to actually be an invalid table. OK, and so this is how he was eventually able to create an invalid table by basically consuming the space prematurely. And so then this is the mathematical expression of this, and that's in the Craft.C. That Craft.C is from the Misty Mountain Cop exploit proof of concept shouldn't say exploit proof of concept memory corruption proof of concept that Ben Hawks and Misty Mountain Cop collaborated on. And so I downloaded the code, ran it. Basically, it is a a memory corruption that is able to actually overwrite in memory the from a very specifically crafted WebP compressed image, it is then able to do a memory corruption. So this is the detail of of what that actually looks like. Google has released this code. There's a ton of exposure that's around this. They updated forty eight sixty three saying it's under limited targeted exploitation and this vulnerability could lead to exploitation without user interaction across this. Hawks talks about how he was able to find this and the details of what it would have taken for somebody to come up with this in a novel construct. Not knowing that there was a flaw there and still figuring out how to actually do that, that memory corruption. And my suggestion is, some of this would be deciding on good attack surface targeting an iOS device. Part of this is that WebP is relatively new, hasn't had a lot of review. That would be a nice sort of target area. It's included in image IO. Apple probably just lifted the code out of WebP in order to be able to accomplish it. And the WebP code is open source. So now this becomes from an exploit development perspective, having the open source code that's embedded inside of a closed source entity gives you a really nice angle for being able to find some exploit potential. I don't know that that's what happened. I'm just saying if I were thinking in those ways, this would be a good opportunity for me to try to find a place where I could start to manipulate memory. OK, so again, this there's tons of unknown. There's basically a lot of details that are not known for us. The passkit blast door escape details probably will never come to light. I don't think that Apple is going to release any of that. And Citizen Lab probably won't release it. The ASLR and pack details don't know it. Some of that might actually come to light later. And if you do want to continue to track this, those different CVEs that I mentioned, there might be some additional information that's presented related to that, we will definitely see further blast door hardening. And one last thing to mention related to this is that Citizen Lab was initially speculated and then Apple later confirmed lockdown mode would have stopped this. --- Page 12 --- It would not have worked if your iPhone was in was in lockdown mode. So I'm clicking fast here because I'm out of time. I do want to thank you for your attention. I don't think that there are time for questions. But if you do want to ask me any questions, I'll be available after the fact in order to to talk about this. Thank you, Chris. Thanks.

Related Q&A

  • Q: Overview
    A: Presentation details for BLASTPASS SANS HackFest