00:00:00.234-->00:00:05.239 >>So this is one of the most highly coveted speaking slots. First thing on Sunday morning at 00:00:07.507-->00:00:12.513 any hacker con. I have done this slot before uh and I-I know how much fun it is. Um, so uh let's 00:00:16.116-->00:00:20.621 give Patrick a big round of applause and thanks for taking this highly coveted 00:00:20.621-->00:00:25.626 first-thing-in-the-morning Sunday slot. [applause] >>Thank you, man, I appreciate it. 00:00:28.462-->00:00:32.766 [clears throat] Alright, aloha and welcome to my talk, The Mouse Is Mightier Than the 00:00:32.766-->00:00:38.071 Sword. So my name is Patrick. I work at Digitus Security and very bliefy-briefly we are 00:00:38.071-->00:00:42.976 working on creating cybersecurity tools for the Mac enterprise. I am also the 00:00:42.976-->00:00:49.416 creator of the Mac security website and tool suite uh Objective-See. Okay, so today 00:00:49.416-->00:00:55.055 we're going to talk about synthetic events on Mac OS. And by synthetic, I mean those that 00:00:55.055-->00:01:00.827 are programmatically generated. Think Mouse and keyboard events. So we're gonna start by looking 00:01:00.827-->00:01:05.832 at components or local security mechanisms of Mac OS that can be attacked via synthetic events. 00:01:08.769-->00:01:14.107 We're then gonna look at the fairly long history of attacks that utilize synthetic events. 00:01:14.107-->00:01:20.614 For example, to bypass local security mechanisms. Now of course Apple has responded to 00:01:20.614-->00:01:26.586 these attacks, so we'll now look at how they implement um security mechanisms to detect, 00:01:26.586-->00:01:33.226 filter, and in some cases, attempt to block these synthetic events. We're gonna talk about a 00:01:33.226-->00:01:38.632 recent bug I discovered that allowed me to interact with any component of the UOS 00:01:38.632-->00:01:43.070 synthetically, for example, to click on security prompts. And then we're gonna end with 00:01:43.070-->00:01:49.910 describing how to weaponize this bug. For example, to bypass security prompts and do all 00:01:49.910-->00:01:56.883 sorts of nefarious things in an invisible manner. Okay, so let's start by looking at user 00:01:56.883-->00:02:01.822 interfaces, UI components of Mac OS that attackers or malware may seek to interact with via 00:02:04.391-->00:02:11.298 synthetic events. So first here's the attacker's conundrum. So let's assume an attacker or 00:02:11.298-->00:02:17.104 piece of malware has somehow gotten onto an N system, a Mac computer, perhaps via a 00:02:17.104-->00:02:23.110 malicious email attachment, a Trojan, a zero day, or even an evil maid attack. Now it wants 00:02:23.110-->00:02:28.382 to do something. Unfortunately, at least for the attackers and malware, on modern versions of 00:02:28.382-->00:02:33.387 Mac OS, many useful actions will now be blocked and generate an alert until at least in theory 00:02:35.555-->00:02:41.428 the user interacts with the alert, clicking allow or deny. So this phase, this stage of a 00:02:41.428-->00:02:46.433 cyberattack is kinda where this talk fits in, specifically how to to interact or bypass such 00:02:48.702-->00:02:54.875 alerts so that the malicious actions can continue. Now we'll take a closer look at a variety 00:02:54.875-->00:03:00.247 of these UI alerts, but we're talking about things like accessing the keychain, prompts 00:03:00.247-->00:03:04.751 that protect the loading of kernel extensions, or even installing a system-wide 00:03:04.751-->00:03:09.489 keylogger. And then we'll also talk about some third-party security tools, for example, 00:03:09.489-->00:03:15.095 firewalls and their alerts and show how malware perhaps could synthetically interact with 00:03:15.095-->00:03:19.733 those as well. Now this is a good, good time to kinda make the point, the generalized 00:03:19.733-->00:03:25.939 statement about synthetic events, and really kind of uh mention how much of a powerful 00:03:25.939-->00:03:31.344 capability they really are, because if you have a way to programatically interact with 00:03:31.344-->00:03:37.384 these alerts you can generically bypass a ton of security mechanisms. It's really a tool 00:03:37.384-->00:03:42.689 agnostic attack. It's really in these cases the UI is the single point of failure so even if the 00:03:42.689-->00:03:46.960 security mechanisms are all implemented in different ways, they all share, for example, the 00:03:46.960-->00:03:51.898 UI. So if you can programmatically interact and just click allow, you can bypass 00:03:51.898-->00:03:58.071 a ton of these mechanisms. Alright, so the goal for the attacker then is to either avoid 00:03:58.071-->00:04:01.942 all these, these alerts uh in the first place, and we'll show us some examples of how to do 00:04:01.942-->00:04:08.482 this, or if an alert is shown how to programmatically interact with it, to dismiss it via code. 00:04:08.482-->00:04:14.020 So for example, here's a piece of malware and we'll talk about this a little more in detail 00:04:14.020-->00:04:19.960 later, but it allows the attacker to interact with the operating system remotely. Here, 00:04:19.960-->00:04:23.530 for example, we see an alert that is displayed when the malware tries to dump the 00:04:23.530-->00:04:29.436 keychain. So what a remote attacker can do is send a synthetic mouse event to click, 00:04:29.436-->00:04:35.809 for example, the allow key here to dump an RSA private key. Now of course Apple prob-, tries to 00:04:35.809-->00:04:40.347 prevent the synthetic interactions, but it's really a cat-and-mouse game,and we'll 00:04:40.347-->00:04:44.818 talk more about Apple's defenses, but it should come as no surprise that Apple keeps 00:04:44.818-->00:04:49.823 losing. Okay, so what are our attackers or malwares targeting via these synthetic events? 00:04:53.260-->00:04:58.298 Well, we briefly already mentioned the keychain, so let's take a closer look at this now 00:04:58.298-->00:05:03.870 because it's actually a very common target for both malware and attackers for obvious 00:05:03.870-->00:05:08.742 reasons. It really stores a ton of sensitive information, for example, private keys, 00:05:08.742-->00:05:13.747 passwords, certificates, autofill data, and also even sensitive application-specific 00:05:15.982-->00:05:19.619 data. So until recently, you didn't need any special privileges to dump the 00:05:19.619-->00:05:24.691 unencrypted contents of the keychain, there was just a single access prompt that was 00:05:24.691-->00:05:31.164 displayed. So that was all that was standing between all your passwords and goodies and full 00:05:31.164-->00:05:36.369 unencrypted access for a local attacker or a piece of malware. So again if the attacker has the 00:05:36.369-->00:05:41.041 ability to synthetically interact with this keychain prompt, all your secrets are 00:05:41.041-->00:05:47.547 essentially theirs. Another target that Apple seeks to protect from synthetic events is 00:05:47.547-->00:05:52.819 the security and privacy accessibility pane, which is found in the system preferences 00:05:52.819-->00:05:58.525 application. And the reason that this is protected is once an application has gained 00:05:58.525-->00:06:04.164 accessibility rights, they can control other processes, like it says on the slide. For example, 00:06:04.164-->00:06:10.103 it can inject events or do things like capture keystrokes at the system level. Of course, 00:06:10.103-->00:06:14.407 these are very powerful capabilities that malware or an attacker would love to have, 00:06:14.407-->00:06:19.412 thus this UI component is protected. Another aspect of the OS that malware or a local 00:06:22.782-->00:06:28.655 attacker may seek to interact with synthetically are privacy alerts that are displayed, for 00:06:28.655-->00:06:34.394 example, when you try to access the user's location, their contacts, or the calendar 00:06:34.394-->00:06:40.300 events. So for example, here we can on the slide if you execute this code to try to figure out 00:06:40.300-->00:06:46.039 the geolocation of the infected system, the operating system will block this action and 00:06:46.039-->00:06:51.044 display an alert and in theory only continue when the user clicks allow. A newer target for 00:06:54.848-->00:07:00.487 synthetic events is the interface for approving the loading of kernel extensions. So 00:07:00.487-->00:07:05.859 when High Sierra Apple introduce something called user-approved kernel extension loading, which 00:07:05.859-->00:07:10.864 basically says the user has to approve the loading of a kernel extension. So on recent versions 00:07:12.999-->00:07:18.938 of Mac OS, kernel extensions have to be signed, but when an attack vector is an attacker or 00:07:18.938-->00:07:24.144 malware could bring a legitimate third-party kernel extension that is signed but has a 00:07:24.144-->00:07:29.382 vulnerability in it and then load and exploit that. So I talked about this previously at 00:07:29.382-->00:07:35.488 Def Con, found an exploitable heap overflow in the Little Snitch kernel extension, and it 00:07:35.488-->00:07:40.460 was buggy and yes it was patched, but since I had an old copy of the kernel extension I 00:07:40.460-->00:07:46.533 could still load and exploit that. So Apple as I mentioned tries to thwart this attack with 00:07:46.533-->00:07:51.838 this user-approved kernel extension loading. Now obviously what an attacker would try to do 00:07:51.838-->00:07:58.378 is synthetically interact with the allow button that Apple has put up to block the kernel 00:07:58.378-->00:08:03.049 extension from loading. And again, if the hacker can just send a synthetic mouse to click 00:08:03.049-->00:08:09.622 event to click this button it will completely bypass this new security mechanism. Finally, 00:08:09.622-->00:08:15.662 we've got the user interfaces of third-party tools, you can think of ones like firewalls or 00:08:15.662-->00:08:21.835 antivirus products, and again these tools may detect and block an attacker's or malware's 00:08:21.835-->00:08:27.874 activity and uh so this is obviously attackers or malware would like to interact with. So 00:08:27.874-->00:08:33.780 some examples are the Mac OS firewall, a generic ransomware detector I wrote, and another 00:08:33.780-->00:08:39.986 tool called BlockBlock, which will uh detect and prevent persistence. So if these tools 00:08:39.986-->00:08:45.825 detect an attacker or the payload, what they will do is again block the attack and 00:08:45.825-->00:08:51.765 display a prompt to-to the user asking to allow the action or deny it. So what a savvy 00:08:51.765-->00:08:57.404 attacker could do is try to synthetically interact with these alerts. And another thing 00:08:57.404-->00:09:02.308 to point out, most of these security tools run with root privileges, so an unprivileged 00:09:02.308-->00:09:07.147 piece of malware or an attacker couldn't do things like disable the process or interact with 00:09:07.147-->00:09:12.652 them. However, the UI, if you want to interact with it, that runs in the context of the user 00:09:12.652-->00:09:17.457 session and mostly you don't need special privileges. So again an unprivileged attacker, 00:09:17.457-->00:09:21.294 if they have a way to synthetically interact with these alerts can completely 00:09:21.294-->00:09:27.801 bypass generically all these tools without even needing any special privileges. Alright, so 00:09:27.801-->00:09:32.405 now let's talk about some past attacks. So over the years there's been a-a myriad of 00:09:32.405-->00:09:37.410 attacks that sought to interact with the UI in a synthetic manner and we've seen proof of 00:09:39.412-->00:09:45.885 concepts and actual malware specimens that implemented these attacks. So let's take a look at 00:09:45.885-->00:09:50.557 these now. Now we'll dig into these, but there's several ways to synthetically interact with 00:09:50.557-->00:09:57.230 UI components. And that Apple has tried to uh mitigate but that attackers have also used. 00:09:57.230-->00:10:02.035 So we'll at some of these closer, some of them include uh AppleScript, uh coregraphics 00:10:02.035-->00:10:07.040 framework, uh and even in some cases simply sidestepping the alerts altogether. So first up 00:10:09.342-->00:10:15.415 is AppleScript. You might be familiar with this it's uh kind of basic capability normally 00:10:15.415-->00:10:21.488 used for the automating, automation of mundane tasks. But it's actually rather powerful 00:10:21.488-->00:10:27.260 because it can allow you to interact with other processes. For example, generating clicks 00:10:27.260-->00:10:32.599 or actions that will then actually appear to originate from the context of the target 00:10:32.599-->00:10:38.404 process. So in terms of uh AppleScript actions, for example, you can easily in a few 00:10:38.404-->00:10:43.376 lines of code dis-display an authentication prompt, for example, to locally fish for the 00:10:43.376-->00:10:47.514 user's password. The user might be tricked into believing this is legitimate and provide their 00:10:47.514-->00:10:53.786 credentials. You can also do things like bypass firewalls. For example, assuming that the 00:10:53.786-->00:10:59.993 firewall trusts the browser, via a few lines of AppleScript you can kindly ask the browser to 00:10:59.993-->00:11:05.098 browse through an attacker-controlled URL and append any data you want to 00:11:05.098-->00:11:09.202 extrapolate in a getParameter, and again you can do this invisibly. Now, the firewall 00:11:09.202-->00:11:13.773 will likely see this connection but as it's originating from the context of the browser, it will 00:11:13.773-->00:11:18.511 be allowed. So AppleScript is very powerful. Now in the context of this talk, though, 00:11:18.511-->00:11:24.551 we're most interested in utilizing JavaScript to generate synthetic events. So here, for 00:11:24.551-->00:11:29.322 example, we have an attacker who is trying to dump the con-contents of a keychain, 00:11:29.322-->00:11:35.295 either via the API or using the built-in security utility. As mentioned, this will generate an 00:11:35.295-->00:11:41.935 access prompt that Apple wants the user and only the user to interact with. Now using 00:11:41.935-->00:11:46.906 AppleScript though on older versions of Mac OS, you can synthetically click, send a 00:11:46.906-->00:11:53.146 click event to this prompt, clicking allow on this button. So on the slide we have the code 00:11:53.146-->00:11:57.784 to do this, and basically you can see we're telling the security agent to click the 00:11:57.784-->00:12:03.122 allow button. You don't need any crazy exploit, you don't need any, you know, complex code, 00:12:03.122-->00:12:06.993 root privileges, all you need to do is click this button with AppleScript, and you can dump 00:12:06.993-->00:12:13.166 everything in the keychain. So let's look at some malware that did this all the way back in 00:12:13.166-->00:12:19.205 2011. So DevilRobber was a cryptocurrency miner, and it contains a file called kc 00:12:19.205-->00:12:25.678 underscore dump dot sh. KC obviously for keychain. And if we look at the script we can see 00:12:25.678-->00:12:30.683 it executes 2 other scripts. The first one kd dot sh just invokes Apple's security utility to dump 00:12:33.019-->00:12:39.892 the keychain. And again, this will generate a keychain access prompt. The second script, kcd, 00:12:39.892-->00:12:46.432 just continually clicks the allow always button in the keychain access. So again, using 00:12:46.432-->00:12:50.970 this AppleScript, it can synthetically click the allow button and dump the unencrypted 00:12:50.970-->00:12:57.443 contents of the keychain, which are password, private keys, etc. etc. Now probably the most 00:12:57.443-->00:13:01.948 common way that attackers seek to interact with these UI prompts programmatically is 00:13:01.948-->00:13:07.186 using Apple's coregraphics framework. And Apple notes you can use this coregraphics 00:13:07.186-->00:13:12.325 framework to do things like low-level user input events. So yes, you can legitimately 00:13:12.325-->00:13:18.464 generate synthetic events. But you can also use this framework to do things like sniff or 00:13:18.464-->00:13:23.369 capture mouse and keyboard events. So this is useful as we'll see for example, for 00:13:23.369-->00:13:28.508 analyzing malware that generates synthetic events because we want to be able to sniff and record 00:13:28.508-->00:13:35.481 those activities. So I created an open-source project names sniffMK and what it does in code 00:13:35.481-->00:13:42.455 is 3 simple things: you specify what events you want to monitor, for example, keyboard or mouse, 00:13:42.455-->00:13:46.693 and then you create what is called the coregraphics event tap. You can think of an event 00:13:46.693-->00:13:52.198 tap kind of like when you tap a fiber-optic cable, get access to the content. So once you have 00:13:52.198-->00:13:58.471 this coregraphics event tapped, you can install it and enable it. Now any time an operation 00:13:58.471-->00:14:03.810 occurs, a mouse event or a keyboard event, uh either a manual one or a synthetic one, 00:14:03.810-->00:14:09.782 it will be delivered to your event tap and you can record this action. Of course, also via 00:14:09.782-->00:14:15.088 coregraphics, you can post synthetic events, which you can do programmatically to click 00:14:15.088-->00:14:20.093 buttons in the UI. So for synthetic keyboard events, you use the CGPostKeyboard API while 00:14:22.562-->00:14:28.501 for mouse events you use the CHPostMouseEvents. More generically, you can also use 00:14:28.501-->00:14:33.606 the CGEventPosts, which can be used to post either mouse or keyboard events. So these are 00:14:33.606-->00:14:38.611 the APIs you can use. So here's some example code that utilizes the coregraphics APIs to send a 00:14:40.880-->00:14:46.352 synthetic key press. Here we're gonna send an enter key. So whenever you send a synthetic 00:14:46.352-->00:14:51.023 event, you need to see, you need to uh divide it into 2 parts. First, you send the down event 00:14:51.023-->00:14:54.927 and then the up event. Cuz again, this mimics what user does when they press and release 00:14:54.927-->00:14:59.766 the key or click the mouse. So what an attacker would be to perform an event that would 00:14:59.766-->00:15:04.570 trigger an action, a UI prompt. For example, trying to dump the keychain, load a kernel 00:15:04.570-->00:15:09.575 extension, or access the user's location, and then synthetically post the event, in this case an 00:15:12.345-->00:15:17.583 enter button, which would then click the allow button in the prompt, which would both dismiss 00:15:17.583-->00:15:22.588 and allow the malicious action. So let's look at some actual malware that used coregraphic 00:15:24.924-->00:15:31.297 events to generate both synthetic mouse and keyboard events. So FruitFly was a rather 00:15:31.297-->00:15:37.336 prolific piece of Mac malware. It was used by the attacker for over a decade to spy on Mac 00:15:37.336-->00:15:42.775 users and unfortunately, a lot of children. So in the decompilation, we can see it 00:15:42.775-->00:15:49.448 calls CGEventCreate, CreateMouseEvent and then also the CGEvent post. So this 00:15:49.448-->00:15:56.289 indicates or looks like this malware has the capability for gen-generating synthetic events. 00:15:56.289-->00:16:01.394 So what I did was I created a custom-commanded control server that allowed me to task the 00:16:01.394-->00:16:06.365 malware. So for command number 8, which was tied to what appeared to be the synthetic 00:16:06.365-->00:16:12.271 mouse events, I could task the malware and observe what it did. So this allowed me to map out 00:16:12.271-->00:16:17.610 the synthetic mouse capabilities of the malware. I basically task it with command number 8 and 00:16:17.610-->00:16:22.615 then I'd run the mouse and keyboard sniffer, and yes I could detect that this malware 00:16:22.615-->00:16:27.820 had the ability to generate synthetic events, which would allow it to do things like 00:16:27.820-->00:16:32.925 interact with security prompts, for example, when it wanted to access the keychain. Now 00:16:32.925-->00:16:37.930 FruitFly also had the ability to generic,uh to synthetically generate keyboard events. So 00:16:41.667-->00:16:47.807 again, reversing its code, we can see it invokes the AXUIElementPostKeyBoard method, 00:16:47.807-->00:16:54.013 which is just a wrapper over the coregraphics keyboards APIs. Again, via the custom commanding 00:16:54.013-->00:16:59.385 control server, I could task the malware and observe its actions. So for example, I could figure 00:16:59.385-->00:17:06.125 out that command number 16 was the malware's synthetic key down command. Where the command 00:17:06.125-->00:17:12.064 number 17 was then the s-synthetic key up. Again, this gives the attacker the remote 00:17:12.064-->00:17:17.837 ability to generate synthetic keyboard events, either to type on the system or interact with 00:17:17.837-->00:17:22.842 these UI prompts. Another example that uses the coregraphic events APIs to 00:17:25.077-->00:17:30.316 synthetically interact with the system is Genieo, which is probably the most prolific, most 00:17:30.316-->00:17:35.321 annoying adware sample or family on Mac OS. So we can use jtool to dump its binary and we can 00:17:37.356-->00:17:42.695 look at its objective C classes. Now objective C is a very verbose programming language so 00:17:42.695-->00:17:47.133 a lot of times you can actually figure out the names of the methods and the classes. So we 00:17:47.133-->00:17:53.239 can see a class name Safari extension installer and it has methods such as click on install 00:17:53.239-->00:17:58.244 buttons. Like okay, wonder what that does, right? So on Mac OS, turns out that Safari extensions 00:18:00.746-->00:18:05.952 are stored in the keychain. This means if adware wants to programmatically install a 00:18:05.952-->00:18:11.891 malicious browser extension, they will have to interact with the keychain access prompts. So 00:18:11.891-->00:18:16.662 what the malware does is it is attempts to install this malicious browser extension and 00:18:16.662-->00:18:22.201 then once the keychain access prompt is displayed, it will detect the location of this 00:18:22.201-->00:18:27.740 popup, move the mouse to the allow button, click mouse down, and then click mouse up, 00:18:27.740-->00:18:32.912 allowing itself to be fully programmatically installed as a malicious browser extension 00:18:32.912-->00:18:39.285 without any user interaction. Finally in terms of using coregraphics to generate and 00:18:39.285-->00:18:45.224 post synthetic events, we have the unsecure proof of concept project on GitHub. And what it 00:18:45.224-->00:18:50.863 is it's designed to target third-party firewall and antivirus products. Again what 00:18:50.863-->00:18:56.502 it does pretty simply is just looks for the alert windows, gets the coordinates of the 00:18:56.502-->00:19:02.041 allow buttons, and then sends a synthetic mouse click event to both dismiss and allow the 00:19:02.041-->00:19:07.046 action. Next we've also seen malware and attackers trying to avoid these UI prompts 00:19:09.448-->00:19:13.986 altogether. You know, synthetic events are really cool, but if you can avoid a displaying of an 00:19:13.986-->00:19:19.959 alert in the first place, that's even better. So here's kinda a conceptual example. Imagine an 00:19:19.959-->00:19:24.730 attacker or piece of malware wants to connect out from a system that's protected with a 00:19:24.730-->00:19:30.403 firewall, perhaps to extrapolate some data. Now it could perhaps try to synthetically interact 00:19:30.403-->00:19:36.642 with the firewall's rule window to manually add itself via a mouse click, but this might be 00:19:36.642-->00:19:43.382 protected by another access prompt because there are ways to secure the UI. So what the 00:19:43.382-->00:19:49.588 malware could, though, is if it detects that the firewall has a list of trusted process stored 00:19:49.588-->00:19:54.226 in some property list or some rules database on the file system, if it can directly 00:19:54.226-->00:19:59.732 manipulate that database instead, it can add itself to the list of trusted processes 00:19:59.732-->00:20:03.536 and then connect out without having to interact with any firewall alerts altogether. So 00:20:03.536-->00:20:08.541 let's look at some malware that kinda did the same thing to bypass the UI and all alerts to 00:20:10.876-->00:20:15.881 capture keystrokes. So XSLCmd was a piece of Chinese malware that had some pretty standard 00:20:18.117-->00:20:23.722 capabilities, although it had the ability to capture all keystrokes without any UI 00:20:23.722-->00:20:28.160 prompts, which is rather odd because normally you have to interact with the UI in some 00:20:28.160-->00:20:32.398 manner to approve this capability. So about a year after the malware was 00:20:32.398-->00:20:38.437 discovered, OSX vulnerability was independently discovered and reported called rootpipe. And 00:20:38.437-->00:20:42.775 another researcher went back and noticed that the malware was actually exploiting this same 00:20:42.775-->00:20:47.780 vulnerability a year before. So for system-wide keylogging, you either have to be root or your 00:20:50.082-->00:20:55.888 application has to have accessibility rights. So on older versions of Mac OS, you 00:20:55.888-->00:21:00.459 gain these accessibility rights by going into the system prompt and clicking on a button that 00:21:00.459-->00:21:04.964 says enable system accessibility rights. Now when you click this button, the operating system 00:21:04.964-->00:21:09.602 will display a prompt and require user or admin credentials. So what this 00:21:09.602-->00:21:16.075 malware does though is exploit this rootpipe bug, again as is zero-day, to basically click 00:21:16.075-->00:21:21.447 this same file, click the same button by simply creating a file underneath it. So what happens 00:21:21.447-->00:21:25.651 in the background when a user clicks this file, it creates a file on the file system to 00:21:25.651-->00:21:30.589 indicate basically that that button was checked. So the malware just bypasses the UI and 00:21:30.589-->00:21:36.529 creates this file directly using this exploit. So once it does that, it can access all key 00:21:36.529-->00:21:40.266 presses and install a system-wide keylogger, again without having to actually 00:21:40.266-->00:21:45.271 interact with the UI. Okay so now it's, it's also not just malware though that is 00:21:48.174-->00:21:54.346 interacting with uh or bypassing rather the UI to do rather kinda shady stuff. So previous 00:21:54.346-->00:21:59.785 versions of Dropbox actually did something rather sneaky. So if you ran the Dropbox installer, 00:21:59.785-->00:22:05.291 it would ask for root credentials, and then continue its installation. However, if 00:22:05.291-->00:22:10.696 you look at the list of applications that were given access to accessibility rights, 00:22:10.696-->00:22:16.769 Dropbox would magically show up, which is odd because on recent versions of Mac OS, even if you 00:22:16.769-->00:22:21.273 have root privileges, there's supposed to be a secondary access prompt to allow 00:22:21.273-->00:22:27.079 applications to have these rights. So Phil Stokes did some interesting research and kinda 00:22:27.079-->00:22:32.084 found why exactly what was going on. So if we run strings on 1 of the Dropbox binaries, we can see 00:22:34.553-->00:22:40.025 some interesting strings. We can see reference to something called TCC dot DB and we can 00:22:40.025-->00:22:45.030 also see lots of SQL-related strings. So basically looks like Dropbox is interacting directly 00:22:47.032-->00:22:53.639 with this system database. So what is this TCC dot DB file? Well, if we run the file command 00:22:53.639-->00:22:58.844 on it we can see it's a SQL-like database. And if we Google around, we can see that it's Mac 00:22:58.844-->00:23:04.483 OS's privacy database, which among other things, keeps the list of applications that are 00:23:04.483-->00:23:10.222 afforded these powerful accessibility rights. So we can confirm this by running FS usage 00:23:10.222-->00:23:15.327 which is a file main utility, opening the system preferences, and seeing that the application 00:23:15.327-->00:23:21.066 generates file IO events to go read this database. So what Dropbox is doing rather 00:23:21.066-->00:23:27.373 suspiciously is directly modifying this TCC dot DB file to give itself accessibility 00:23:27.373-->00:23:32.378 rights and avoiding this second UI alert altogether, which I think is kinda shady. Now I 00:23:34.480-->00:23:38.651 wanted to see if other applications or perhaps malware was using this same kind of 00:23:38.651-->00:23:44.957 trick, so I hopped onto Virustotal and just did a search for TCC dot DB. And there's a 00:23:44.957-->00:23:49.428 few items that it detected, a few game hacks which kinda makes sense because it might need to 00:23:49.428-->00:23:53.832 move the mouse or keyboard. But there was one application in particular that was kind of 00:23:53.832-->00:23:59.772 suspicious. And it caught my attention because it claimed to be an Apple binary but it was 00:23:59.772-->00:24:05.844 unsigned, it was packed, and it attempted to modify this SQL database directly. So again, 00:24:05.844-->00:24:11.383 clearly very suspicious. So I took a closer look at this and it turned out to be a new 00:24:11.383-->00:24:17.956 cross-platform back door, which is now called ColdRoot. So when it's run, ColdRoot would execute 00:24:17.956-->00:24:24.096 something called run me dot SH. And we can dump this script and we see that what it is doing is 00:24:24.096-->00:24:30.636 it's directly manipulating this TCC dot DB file to insert the malicious component of the 00:24:30.636-->00:24:37.076 malware into this database so that it can do system -wide keylogging. So on the right of 00:24:37.076-->00:24:42.581 the slide, we can see that when I log into my bank account now, the malware is able to capture 00:24:42.581-->00:24:47.686 these keystrokes because it has directly manipulated the accessibility database. Again, 00:24:47.686-->00:24:54.660 this is an example of bypassing the UI, no need for synthetic events. Okay, so that was a 00:24:54.660-->00:25:00.466 fairly comprehensive history of attacks against the UI. But with that generated synthetic events 00:25:00.466-->00:25:06.071 to, for example, click allow buttons and also those that sidestep the UI altogether. Now 00:25:06.071-->00:25:11.210 obviously this is not something that Apple is stoked about,right? They designed these 00:25:11.210-->00:25:16.682 uh these alerts and they expect that only the user will be able to gen- uh, interact with them. 00:25:16.682-->00:25:21.453 Because if malware can, it kind of completely, in my opinion, uh defeats the purpose of these 00:25:21.453-->00:25:28.360 alerts. So let's look now at what Apple has done to mitigate these synthetic attacks So first 00:25:28.360-->00:25:33.499 on Mac OS modern version, AppleScript is blocked from interacting with certain 00:25:33.499-->00:25:38.504 security prompts. Specifically, if we now use AppleScript to send a click event, the OS will 00:25:40.739-->00:25:45.744 detect that this is a synthetically generated event and will display a warning, a 00:25:45.744-->00:25:51.216 security prompt, which cannot be generated or it-interacted with syn-synthetically. So now for 00:25:51.216-->00:25:56.221 example, if the piece of malware tries to dump the keychain and uses AppleScript to send an 00:25:59.491-->00:26:05.564 allow click to that allow button, the operating system will detect that this is a 00:26:05.564-->00:26:10.602 synthetically generated click and will block it and log an error message saying this is not 00:26:10.602-->00:26:17.176 allowed. So let's look at this a little closer to see kinda how Apple is implementing this. So 00:26:17.176-->00:26:22.147 if we execute some AppleScript from the terminal to attempt to generate and submit a synthetic 00:26:22.147-->00:26:27.152 event, we can see that the TCCD, which is the privacy daemon, will check the signature of the 00:26:30.255-->00:26:36.595 application and again will check if that application is in the TCC dot DB, which again is that 00:26:36.595-->00:26:42.301 privacy database. And if it's not found, it's going to display an alert to the user, basically 00:26:42.301-->00:26:48.407 saying, hey this application has not been given accessibility rights. I'm not going to allow 00:26:48.407-->00:26:53.712 it unless you explicitly approve it. And the secondary security alert cannot be interacted with 00:26:53.712-->00:26:58.717 synthetically either. Now let's look at what Apple has done to block synthetic events that are 00:27:00.752-->00:27:07.259 generated via the coregraphic APIs. So in short, on recent version of Mac OS, Apple will 00:27:07.259-->00:27:13.499 now display a secondary secure authentication prompt, requesting user credentials when 00:27:13.499-->00:27:19.471 it detects that something is generating synthetic events via the coregraphic APIs. So here's 00:27:19.471-->00:27:24.476 a brief video I wrote a simply binary that tries to generate a synthetic event and if we watch 00:27:26.879-->00:27:32.284 it, we're basically gonna see that as soon as I click the event, Apple detects this and 00:27:32.284-->00:27:37.756 shows a secondary prompt which basically says, I have detected that this is a synthetic event; 00:27:37.756-->00:27:42.427 before I'm going to allow this synthetic event to occur, you have to put in your user name 00:27:42.427-->00:27:47.165 and password. So again, it looks like Apple has successfully mitigated against synthetic 00:27:47.165-->00:27:53.505 events that are generated by coregraphic APIs. So let's briefly dig into this a little 00:27:53.505-->00:27:58.677 deeper to see how they are implementing this protection. So first in the system log, we can 00:27:58.677-->00:28:02.848 see an error message that is logged when we try to generate an synthetic event via the 00:28:02.848-->00:28:08.220 coregraphic APIs. So we can grab the file system for the for the string and we can find the 00:28:08.220-->00:28:14.760 library that implements this check. So what we do is reverse engineer this library and we see 00:28:14.760-->00:28:20.132 it makes some calls into kernel mode. So if we hop into kernel mode we can see this check is 00:28:20.132-->00:28:26.572 likely implemented in the MPO iokit check-check hid control check. So reading Apple's 00:28:26.572-->00:28:31.610 comments for this we can see it says it determines whether the process can post synthetic 00:28:31.610-->00:28:36.682 events. So basically what it's doing is checking the entitlements of this process of 00:28:36.682-->00:28:41.219 to say, hey is this a process that is allowed to generate synthetic events, and if it's 00:28:41.219-->00:28:46.458 not it, returns an error mode to user mode and then the operating system will display that 00:28:46.458-->00:28:51.396 secondary authentication prompt, which basically says, hey you have to provide your credentials 00:28:51.396-->00:28:58.236 before I'm going to process that synthetic event. In terms of the privacy database, Apple now 00:28:58.236-->00:29:03.775 protects this via system integrity protection or SIP. So on the bottom of the slide, we 00:29:03.775-->00:29:09.047 can see that if we do an LS to look at the file permissions, we can see that there is a new 00:29:09.047-->00:29:14.820 permission that is set to restricted. This means this file is now protected with SIP, or 00:29:14.820-->00:29:20.025 system integrity protection, which means even if the attacker or the malware has root 00:29:20.025-->00:29:25.897 privileges, they will not be able to modify this file. So going back to the ColdRoot 00:29:25.897-->00:29:31.903 malware, we can see that the ColdRoot malware will actually check if it's modifications to 00:29:31.903-->00:29:37.676 the database were successful, and if it fails, it will not implement its keyboard keylogger 00:29:37.676-->00:29:42.881 logic because it won't work. So this basically means because of these new security mitigations 00:29:42.881-->00:29:47.452 that Apple has allowed, or implemented, even though the malware will still run, the 00:29:47.452-->00:29:54.026 keylogging will not be successful, so kudos to Apple for fixing that. Okay, so to 00:29:54.026-->00:29:59.865 briefly summarize Apple's current protection against synthetic and UI bypasses. For 00:29:59.865-->00:30:05.570 AppleScript, the application must have accessibility rights, which the user must explicitly 00:30:05.570-->00:30:11.743 grant. In t-terms of coregraphics, Apple now detects and filters those and will 00:30:11.743-->00:30:16.515 ignore synthetic events, unless the user puts in their username and password. And then in terms 00:30:16.515-->00:30:21.653 of bypassing the UI altogether, they have protected the privacy database with system integrity 00:30:21.653-->00:30:26.391 protection. Now there's one important thing to note is that these protections are not 00:30:26.391-->00:30:32.931 applied globally. They are only applied specifically by Apple to certain security prompts. So 00:30:32.931-->00:30:38.036 we'll see this leaves a window open to other attacks. But also it means third-party developers, 00:30:38.036-->00:30:43.709 for example, firewall and antivirus developers, they have to implement protections of 00:30:43.709-->00:30:48.714 their UIs individually. So let's briefly look at how third-party developers can protect their UIs 00:30:52.084-->00:30:57.522 from synthetic events. So I'm an author of a tool called BlockBlock as I mentioned. 00:30:57.522-->00:31:03.361 BlockBlock basically tries to detect and prevent persistence events. So for example, when 00:31:03.361-->00:31:09.301 malware tries to install itself persistently, BlockBlock will detect that, display alert to 00:31:09.301-->00:31:16.141 user and basically ask the user to confirm or deny. Clearly, this alert could be a target for 00:31:16.141-->00:31:20.712 a synthetic attack, right? A malware installer could run detect that BlockBlock has 00:31:20.712-->00:31:25.617 detected and displayed an alert and then try to send a synthetic event to dismiss and allow the 00:31:25.617-->00:31:32.124 action. So what I do to detect and prevent this is basically subclass the UI button. And this 00:31:32.124-->00:31:37.496 allows me to analyze the events that are coming in. For example, the mouse event that is clicking 00:31:37.496-->00:31:42.801 the allow button. What I can do then is I can examine the event and see who is sending it both 00:31:42.801-->00:31:48.807 the process's ID and UID. So then I can ignore events, for example, that aren't coming from 00:31:48.807-->00:31:54.479 an Apple-signed process or don't belong to the human interface device daemon so again if the 00:31:54.479-->00:31:59.084 malware now tries to send a synthetic click to click allow on the BlockBlock alert, I will 00:31:59.084-->00:32:05.657 detect and ignore this. Little Snitch, which is very popular Mac firewall product for Mac OS, 00:32:05.657-->00:32:11.263 similarly ignores synthetic events and this video demo we're gonna see that I am basically 00:32:11.263-->00:32:16.067 trying to synthetically click on the allow button on the firewall alert. Obviously, this is 00:32:16.067-->00:32:21.506 something that malware would try to do to bypass the firewall if it was detected. A little hard 00:32:21.506-->00:32:25.510 to see on the video, but Little Snitch has detected this and displayed an error message 00:32:25.510-->00:32:30.515 saying, simulated input ignored. So we can reverse engineer their binary to see how they implement 00:32:32.884-->00:32:38.924 the detection and ignoring of synthetic events. They take a similar approach to BlockBlock; 00:32:38.924-->00:32:44.296 they subclass a UI component and they have a method called isSimulated. And again they 00:32:44.296-->00:32:49.401 monitor for certain events, for example, mouse clicks, and what they do is they get these source 00:32:49.401-->00:32:56.141 state of that click. Now the source state will be set to 1 if it is a non-simulated event. So 00:32:56.141-->00:33:00.579 they check that and they also check the PIT of the process to identify who is trying to send 00:33:00.579-->00:33:07.185 the event. Interestingly, the-they also have exceptions for Apple screen sharing and VNC 00:33:07.185-->00:33:11.156 servers because those events may come in and appear to be simulated because they're coming 00:33:11.156-->00:33:16.194 in over the network, but Little Snitch probably wants to allow those. Okay, so that wraps up 00:33:16.194-->00:33:22.968 the attack and defenses. Apple was happy thinking that they were safe. But as we'll see, in 00:33:22.968-->00:33:29.140 reality they were not. So now let's look at-at an attack I discovered that allowed me to 00:33:29.140-->00:33:34.145 interact synthetically with any OS component and do all sorts of nefarious things. So my goal was 00:33:36.815-->00:33:41.620 simple. I basically just wanted to be able to synthetically or programmatically interact with 00:33:41.620-->00:33:47.025 these alerts and do things as a normal user, like dump the keychain or approve the loading 00:33:47.025-->00:33:53.698 of a kernel extension. So I started poking around on Mac OS and after a few minutes, I found 00:33:53.698-->00:33:59.037 a feature of the operating systems called Mouse Keys. Now it's a documented feature with 00:33:59.037-->00:34:04.276 Apple documentation and basically as their documentation says, it allows you to use the 00:34:04.276-->00:34:10.782 keyboard as the mouse. So they provide a lot of information, including keyboard to mouse 00:34:10.782-->00:34:17.255 button mappings. So for example, if you want to click, if you press the key I or the letter 00:34:17.255-->00:34:22.961 number 5 on the keyboard, if Mouse Keys are enabled, this will be translated to a mouse 00:34:22.961-->00:34:27.866 click. So of course I wondered, could these allow me to generate synthetic keyboard events that 00:34:27.866-->00:34:33.538 would then be translated to synthetic mouse events which would then be allowed. So first 00:34:33.538-->00:34:37.609 though, we need to programmatically enable Mouse Keys. And we can do this in 3 00:34:37.609-->00:34:43.148 steps. We first launch the system preferences app, we then open the accessibility pane, 00:34:43.148-->00:34:47.619 which is different from the ac-accessibility rights pane, which is protected, and then we 00:34:47.619-->00:34:54.025 send a synthetic click to enable Mouse Keys. Turns out that this is all doable via A-apple script 00:34:54.025-->00:34:59.965 and coregraphic foundation APIs. Apple doesn't consider these interactions uh sensitive enough 00:34:59.965-->00:35:04.970 so they don't filter or block any synthetic actions. So here's a video of this in action. We've 00:35:07.172-->00:35:12.477 basically going to open the system preferences uh application. We're going to go 00:35:12.477-->00:35:19.284 to the mouse settings, and then we're going to click enable Mouse Keys. So again, few lines 00:35:19.284-->00:35:25.123 of code, we basically now enabled Mouse Keys. Really not that exciting. But now we can 00:35:25.123-->00:35:31.830 see if we can use these Mouse Keys to generate synthetic mouse events. So as I mention the 00:35:31.830-->00:35:36.835 number 5 on the number pad when Mouse Keys is enabled will generate a mouse click. So the 00:35:39.704-->00:35:45.477 key code for this is 87. So now we have Mouse Keys enabled, I enable some AppleScript and I 00:35:45.477-->00:35:52.417 basically sent this key code 87 to um uh a UI prompt. And you can see if we run our mouse and 00:35:52.417-->00:35:59.257 keyboard sniffer, that yes the synthetic key down and up event are captured but then the system 00:35:59.257-->00:36:04.529 since Mouse Keys are enabled will translate those to mouse events and since those are 00:36:04.529-->00:36:09.534 translated by the system, when they are delivered, they will be allowed. So now we have a way to 00:36:11.770-->00:36:17.242 generically generate synthetic events that Apple will allow. Yeah and it's some crazy bug but 00:36:17.242-->00:36:22.380 I'm a huge fan of utilizing legitimate functionality of the operating system to do nefarious 00:36:22.380-->00:36:27.385 things. So let's use this to do some evil stuff. First, let's dump the keychain. So step 1 is 00:36:29.888-->00:36:35.160 we try to execute something like the security utility to start dumping the keychain. As I 00:36:35.160-->00:36:41.733 mentioned, this will open or display an accessibility prompt that Apple requires or expects 00:36:41.733-->00:36:46.705 only the user to interact with. However, since we have the ability to do this, we can 00:36:46.705-->00:36:52.577 simply enable Mouse Keys and then send a click that will be allowed, which will then allow 00:36:52.577-->00:36:58.550 us to dump the keychain. So I wrote, I wrote a little uh proof of concept for this. It does 3 00:36:58.550-->00:37:02.787 things: enables Mouse Keys, dumps the keychain, and then clicks allow on the 00:37:02.787-->00:37:08.359 accessibility prompt. And this gives us full access to all the user's passwords, private keys, 00:37:08.359-->00:37:14.732 etc. Again, fully unencrypted. Next, let's use Mouse Keys to bypass High Sierra's 00:37:14.732-->00:37:20.405 user-approved kernel extension loading. Again, a few easy steps. We enable Mouse Keys. We 00:37:20.405-->00:37:26.811 load the kernel extension, which will be blocked until the user, or in our case, our attack code, 00:37:26.811-->00:37:33.585 clicks allow. So once this button is displayed, we simply again enable Mouse Keys and send 00:37:33.585-->00:37:37.755 this click and this will basically be processed by the operating system and allow the 00:37:37.755-->00:37:42.594 kernel extension to load. As I often find is the case, bypassing these Apple security 00:37:42.594-->00:37:47.932 mitigations is really not that complicated. So here's a video of this in action. We're 00:37:47.932-->00:37:52.804 basically going to load that signed Little Snitch kernel extension that has that 00:37:52.804-->00:37:56.941 exploitable vulnerability in that. Again, this will be blocked by the system because it 00:37:56.941-->00:38:02.647 will want the user to manually approve that. In code, though, what we will do is enable Mouse 00:38:02.647-->00:38:07.652 Keys and then browse to the prompt that has the allow button and then send a synthetic event 00:38:09.687-->00:38:16.494 to click back. So that's the full attack and if we do a tech stat, we can now see that the 00:38:16.494-->00:38:21.166 system has allowed the kernel extension to load. We can now exploit the vulnerability in 00:38:21.166-->00:38:26.237 this signed kernel extension to do things like bypass security integrity protection and get 00:38:26.237-->00:38:31.576 unsigned code running in the kernel. Now I'm sure some of you have already thought like, okay 00:38:31.576-->00:38:36.147 these attacks are kinda neat, but there's a huge downside to them and that is that they're 00:38:36.147-->00:38:41.553 visible. So if you're sitting at your computer and all of the sudden an alert pops us, the 00:38:41.553-->00:38:45.757 mouse moves and something gets clicked, you will surely know that your computer is hacked, 00:38:45.757-->00:38:51.362 like throw it out the window. Right? So then an attacker question becomes, how can we do 00:38:51.362-->00:38:57.001 this invisibly? And it turns out that it's pretty easy. We can basically just dim the screen. 00:38:57.001-->00:39:02.640 Really not rocket science. So when those special privileges, anybody, including malware, can 00:39:02.640-->00:39:08.413 dim the screen. And here's the code to do that. Basically you make a few calls into IOKit, and 00:39:08.413-->00:39:14.986 you basically pass a brightness level which will reduce the screen to zero. Now the key here 00:39:14.986-->00:39:20.825 is that the screen went dim to zero is still fully interactive. That is to say, we can still 00:39:20.825-->00:39:26.130 fully interact with the UI, for example, to load the system preferences, enable Mouse Keys, 00:39:26.130-->00:39:30.902 and click on buttons. But of course, the user won't see it. Now we still have an issue. 00:39:30.902-->00:39:36.207 Again, if you're sitting in front of your computer you know, on Instagram, Facebook, or you 00:39:36.207-->00:39:39.177 know, writing code via stack overflow, and all the sudden your your screen dims, that's 00:39:39.177-->00:39:45.149 gonna be super odd. So what we should do is be a little more sophisticated about this. So the 00:39:45.149-->00:39:50.788 first thing we can do is we can detect user activity and simply wait until the user is not 00:39:50.788-->00:39:56.594 active. So there's a nice API you can call that will give you the number of seconds of the 00:39:56.594-->00:40:01.799 last user activity. So we can just query these API in a loop and basically say, okay, let's 00:40:01.799-->00:40:06.838 wait until the user has been inactive for 60 seconds. And then dim the screen and perform 00:40:06.838-->00:40:11.309 our synthetic attacks, for example, loading the kernel extension or bypassing the 00:40:11.309-->00:40:16.314 firewall. Now, even better, though, we can simply wait until the screen is going to sleep on 00:40:18.316-->00:40:24.289 its own. So when a s-screen sleep action occurs, there are 2 steps. So the operating system 00:40:24.289-->00:40:30.194 first sends a "can device power off" message and dims the screen to 50 percent. Then waits about 00:40:30.194-->00:40:36.200 3 seconds before fully dimming the screen to zero and then turning off the display. So what 00:40:36.200-->00:40:41.105 we can do as malware is we can detect this initial message and when the screen starts, screen 00:40:41.105-->00:40:47.045 starts dim to 50 percent, we can expedite that, dim it to 100 percent and then perform our 00:40:47.045-->00:40:52.583 action before the screen is fully put to sleep. So then a very stealthy way to perform 00:40:52.583-->00:40:58.723 these attacks that the user will not notice. Alright, so let's start write-wrapping this up. I 00:40:58.723-->00:41:03.461 reported this mouse key vulnerability or bypass to Apple. They by patch, uh they 00:41:03.461-->00:41:08.466 patched it as CVE-2017-7150 and their patch did 2 things. First, any time the keychain is 00:41:11.969-->00:41:17.442 accessed, even by the user, this will now require a password, which I think is a good idea. 00:41:17.442-->00:41:22.647 Apple also decided to filter Mouse Keys and now block them, for example, when you send them 00:41:22.647-->00:41:28.820 to a UI prompt. And unfortunately, issues still exist even today on the latest 00:41:28.820-->00:41:34.025 fully patched versions of High Sierra. First, the privacy alerts appear to remain 00:41:34.025-->00:41:38.329 unprotected, which is very strange. So as I mentioned when malware, for example, tries to 00:41:38.329-->00:41:45.136 access your contacts, your events, or your location via the location APIs, this will display 00:41:45.136-->00:41:50.274 a privacy alert. However, these alerts are not protected. So you can send any synthetic event to 00:41:50.274-->00:41:54.345 that and just click allow. In my opinion this is rather problematic. What's the point of 00:41:54.345-->00:41:59.183 displaying an alert if you're not going to protect it? Okay, this is even worse and I'm 00:41:59.183-->00:42:03.354 almost embarrassed to talk about this, but I'm actually more embarrassed for Apple. So 00:42:03.354-->00:42:09.060 there's a zero day of vulnerability or flaw in the way they process or filter synthetic 00:42:09.060-->00:42:14.565 events. So let's take, for example, the allow button that has to be clicked in order for a 00:42:14.565-->00:42:20.471 kernel extension to load. So I said I wanna test how Apple has implemented this protection. So 00:42:20.471-->00:42:26.144 as I mentioned, you have to send 2 events for a synthetic event. You send a mouse key down and 00:42:26.144-->00:42:31.149 then a mouse key up. So the way you do this is you invoke the same API, but the last parameter 00:42:31.149-->00:42:36.154 to that is a flag. You set it to true if it's a mouse down event and you set it to false if it's 00:42:36.154-->00:42:40.425 a mouse up event, which will complete the action. So I wrote the first line of code and then 00:42:40.425-->00:42:44.962 I was lazy and I copied and pasted the second line, and I forgot to change the flag. I 00:42:44.962-->00:42:50.935 then compiled and ran this code and I was really surprised when this was allowed. So it turns 00:42:50.935-->00:42:55.940 out if you send 2 mouse down events, for some unknown reason, the second mouse down event is 00:42:58.176-->00:43:04.682 translated to a mouse up event by the kernel. And since the filtration process allows mouse 00:43:04.682-->00:43:11.289 up events from the kernel, this action is allowed. This means that since its inception, the 00:43:11.289-->00:43:16.427 fundamental secure kernel loading extension security mechanism that Apple, you know, 00:43:16.427-->00:43:21.999 talked all about, has been completely broken. Now, people, including myself, sometimes talk 00:43:21.999-->00:43:27.905 smack about Apple's security mechanisms, but examples like this I think really pr-prove 00:43:27.905-->00:43:33.277 that in a variety of case, it's really trivial to bypass it. So, you know, I'm kinda embarrassed 00:43:33.277-->00:43:38.149 as I meant to-t-to discuss this bug because it's so trivial and I found it completely by 00:43:38.149-->00:43:43.120 accident. But again it's very powerful, allows you to generate synthetic events even on a fully 00:43:43.120-->00:43:48.359 patched system, for example, to load kernel extensions, which in my opinion is rather a big 00:43:48.359-->00:43:53.364 problem. Alright, so a final word about synthetic events, hopefully we've illustrated that 00:43:55.967-->00:43:58.703 they are actually a very powerful capability, especially when performed invisibly. We can 00:43:58.703-->00:44:04.175 do all sorts of actions bypass a whole bunch of security mechanisms. And again, in a kind 00:44:04.175-->00:44:09.180 of tool or um security agnostic manner. Now as often is as, you know, as oft-, as is often the 00:44:12.250-->00:44:17.221 case with these uh these attacks, it-it's really a cat and mouse game. So attackers 00:44:17.221-->00:44:21.726 come up with new ways, like Mouse Keys, Apple releases new patches. Unfortunately, Apple 00:44:21.726-->00:44:26.264 kinda has been struggling. Good news though, in Mojave they've kinda taken this more drastic 00:44:26.264-->00:44:31.869 approach and said, we're just gonna generically block and disallow a ton of these actions. 00:44:31.869-->00:44:36.440 For example, they block AppleScript and coregraphic APIs. This is a good from a 00:44:36.440-->00:44:42.246 security point of view, but this will block a lot of legitimate applications. Now I've been told 00:44:42.246-->00:44:45.683 in feedback that some of my talks are a little negative. I, you know, Patrick, you always 00:44:45.683-->00:44:49.387 talk about breaking everything and how Apple keeps messing everything up and, yeah okay, 00:44:49.387-->00:44:53.824 that's little negative. So I wanted to intro, uh I wanted to uh f-finish with something 00:44:53.824-->00:44:57.962 that's hopefully a little more positive. So I'm excited to announce a new Mac security 00:44:57.962-->00:45:03.367 conference called Objective by the Sea. Uh, we have an awesome lineup of Mac security speakers. 00:45:03.367-->00:45:09.173 All the talks will be focused about uh Mac security. Uh it's gonna be in an awesome resort in 00:45:09.173-->00:45:13.744 Hawaii. Here's some pictures in case you weren't convinced that you should come. And it'll be 00:45:13.744-->00:45:19.784 November third and fourth um and check out objective by the Sea dot com for information. So 00:45:19.784-->00:45:25.489 that's a wrap. I wanna thank you again for coming uh bright and early on a Sunday and I think 00:45:25.489-->00:45:29.794 we're pretty much out of time but I will be by the stage if you have any questions. So 00:45:29.794-->00:45:34.799 thanks again, I really appreciate it. [applause] [music]