Yeah, let's welcome Kim his first time that can't welcome. Hello, let's hear it Okay, good afternoon, thank you for coming to the session I'm very excited to talk you talk to you about our research your watch watch you the broken privilege people default in the some sound gear smartwatch Before we begin Let me introduce us My name is Thompson Kim and we are a security research lab called HIT from something where University from South Korea If you have any questions or comments Not the other one. Please feel free to contact. So yeah First and foremost let's start with why we did this research and the motivation behind as You may well know the gear series includes Samsung's smartwatch Products, but apparently a few days ago. They changed the name to the galaxy watch. So For now, just let's just pretend that didn't happen They are advertised to as offering many useful features including like tracking fitness or Receiving and replying to calls tax emails and even paying for stuff using your NFC well, typically you pair it with your smartphone and via Bluetooth and it comes with Wi-Fi or even LTE Something also operates an app marketplace For the gear within Samsung Galaxy apps where anyone can just develop for the watch using the SDKs To achieve all this we share our Highly sensitive information with the watch your contact your calendars your locations emails notifications is more all come from your smartphone or vice versa and access to such privileged resources must be permitted based on proper access rights so the the former for Gear smartwatch consists of two parts So one is the wearable version of tyson OS open source components and the other is Samsung's closed source components built on top of vanilla tyson. So tyson probably most of you don't know is Linux based open source OS developed by Samsung Since the OS was envisioned to serve all kinds of devices It has been shipped with many of Samsung's products Including your watches including your smartphones probably TVs cameras and even refrigerators Previously many researchers actually took a look at Tyson in 2015 Abraham revealed many problems with Tyson at the time and In 2017 that man disclosed 40 zero-day vulnerabilities and which made some media splashes PVS Studio also analyzed a portion of the Tyson open source code base so So they claimed there would be more over 20,000 of code errors but this research circled around the Tyson as a OS However, we decided to take a look at the Gear as a smartwatch where the smart things actually happen as an extension to your smartphone. So that was the motivation. So we need to get right into the internals of Tizen's security concepts. In this section, we will highlight Tizen version 3, the latest version publicly shipped with the Gear smartwatch products. The first concept is objects, obviously. So since Tizen is based on Linux, there are typical stuff like files and directories and sockets and utilities. But in this talk, however, we're going to focus on two types, applications and services. So applications use Tizen's public or private APIs to access the subsystems, including framework and services. And services are special, special privileged daemons, each dedicated to a specific resource like Wi-Fi or Bluetooth and GPS and messaging sensors, et cetera. These resources are by nature sensitive, so some sort of control should be in place to reject unauthorized access. So Tizen achieves this by introducing the privilege. Okay. Privilege services must validate if the calling app has these proper ones. So similar to Android, app developer type in privilege strings in the manifest file. For example, on the right side of the slide, you can see the manifest file. And there are some privileges like HTTP, Tizen, ORG, privilege internet. These are the privileges. The app market or Samsung signs the TPK application package and sells it. On installation, user accepts the permissions on the screen, and then the installer checks and registers the policy in the database. And finally, at the runtime, access is controlled by the policies. Well, Tizen defines many privileges. Internet, Bluetooth, network set, or more. However, only some of them are public to app developers. There are also partner and platform level privileges, not for public use. To enforce this kind of privileges, to enforce this kind of policies, Tizen implements three plus one security mechanisms. The first is the classic GIF. The first is the GIFDEC, the Unix user ID, group ID that you probably are familiar with. The second is SMAC. SMAC is Tizen's choice of kernel space mechanism, like SELinux. The specifics are a bit complex, but conceptually, they work like this. An app receives a unique label at installation. Like user, package, sample app. And for every kernel object access, the current label or context is checked against the rules in the SMAC database. The third is SINARA. SINARA is Tizen's user space privilege management daemon. Services ask SINARA to check if the calling application has the privilege. SINARA is the user space privilege management daemon. SINARA identifies the application by its SMAC label, then validates it against the policies within its own SINARA database. And finally, the plus one security manager is a policy configurator. And it reads the policies from the file system and the manifest file and here and there. And it fills the database, as we talked about. So DAC, SMAC, SINARA can recognize them. So, this is a very useful tool. Now, let's talk about how applications actually talk to the services. Dbus is a widely implemented IPC system for Linux-like OS that also offers useful built-in functions like discoverability or introspection. To put it simply, each service daemon registers itself to the Dbus daemon, then clients dispatch requests. Messages over Dbus. For example, if you want to send a request for a virtual channel, Tizen relies heavily on Dbus for IPCs, asterisk. So let me give you some Dbus concepts using an example on the right. A typical Dbus message call, it works like this. So we want to send a request from a client to a service. The service process already has a set register in this case. And the client process opens a connection. And the connection gets assigned a unique bus name. It looks like colon something 1.7 in this case. So now the client sends a request message to the bus. And that message reaches the service, whose connection also has a unique bus name, but also an optional well-known bus name, org, example, service. This is a service name. Okay. Then the request is to invoke set foo method of the object slash org slash example slash object 1. The object implements the interface org example interface, which specifies methods like set foo, get foo. And finally, the service responds with a message. Oh, sorry. So to recap, in one sentence, the client process sends a request from a bus name colon 1.7 via the bus to a bus name org example service to invoke set foo method of the object org example object 1 of the interface org example interface. Yes. So the asterisk. That's because Tizen's Dbus is scenario aware. Meaning, it is passive. So Tizen can be set FHHHHH to natively perform privileged checks. So upon receiving a message, the Dbus Damon in the middle asks Sinara for validation. So this approach allows Dbus Damon to control access on messages. On the right example, it shows the Bixby assistant bus configuration file. And you can see there is a check element with destination interface, memory access, method, and importantly, privilege attribute, Bixby agent. So whenever Diva statement receives a message, it calls Scenara to see if the sender has the privilege, then decide to accept or deny the message. Let's dig a little deeper with an actual code example, how an API call sends a request a service and its privilege gets validated. So we're gonna start with location manager API with proper location privilege. So let's stop arcade, let's stop her code shows that the privilege string is in the manifest so the client process logic function below creates a measure handle starts manager and then prints out the result to the log, on the right in the shell of the actual device we can see the result is zero as expected, which is a success. Then what happens if there is no privilege? Then let's try this, the same thing. Then the result will come out negative 13, a failure. The log shows within the same PID, the process ID written within the parenthesis shows a failure. Sinara check failed. Location library, a library LBS location is responsible for this log by calling location check Sinara function. Now this is the first privilege check down the chain of a service request. Now this happens within the same PID, so by reverse engineering the location library, we can pinpoint where this happens. Since the library is linked to the client within the same process ID, client can simply live patch the instructions. So remove the code and write zero to register zero. Then we bypass the first check. The left code shows the live patch and protect to enable write, then simply just overwrite the memory. When we run this, the result is still negative 13, negative 13. However, the log changes. A Dbus access denied message, still within the same PID is printed out in violation of the privilege, HTTP something location. So we can see the Dbus library LBS Dbus client sends a request to LBS server, and the error shows the request access is denied by Dbus daemon. Which of course scenario in the middle. This is the second privilege check down the chain. So to recap on the top on app using location API links, the location library, then the library queries scenario for the first time. If that passes Dbus request descent, then the Dbus daemon in the middle queries scenario for the second time. If that passes, the location daemon receives a request, which could potentially queries in our app for the third time. Then finally, the request reaches the hardware below. Now, we didn't discuss the third check. We'll talk more about this in the next section. So what if the client is a malware? So if the client is malware, there's, you know, no first check anymore. So there are two points that can pinpoint, and they can actually secure the service. The second point, Dbus daemon on request is the middle. And the third point, service daemon after receiving the request. If the OS or service developer fails to implement both of them, then the violation can happen. Now we know the background, let's move on. Let's move on to actually finding violations. To do so, let me introduce a simple tool we developed named DAN, the Dbus analyzer. The idea is simple. So let's say we send a Dbus request to a safe service, like LBS server we saw, with no argument given. Without the privilege, then access denied is gonna get returned. But with the privilege, though, invalid argument is returned. Then when you think about it, the error suggests privilege validations always happen first, ahead of any other validation of the request. Then how about we send the non-privileged request to all of them, all of the possible methods, then gather ones that return any other errors that is not access denied. That would imply the policies, at least the Dbus policies, accept non-privileged requests, which could lead to violations. So we developed DAN. DAN automatically evaluates privilege verification of Dbus services. It spawns a test process on a remote device, and then recursively scans the Dbus structure. It then tries to read every property of every object, also calling every method of the Dbus. After one round of analysis, DAN writes three files. One is the whole Dbus structure flattened into JSON file, and the others are properties and messes that require further attention. Now let's discuss how this works step by step. So first we gather all possible bus names of services. Notice that, as we discussed, we don't have to do this all at once. One service can have multiple bus names, one unique or one or more well-known names. So from the extractive farmer, we gather all names from files on the user share Dbus1. So as shown on the left image of system D1, the service. From the runtime, we call the built-in method listNames to list all currently available bus names, as shown on the right image. You can see some are unique, some are unique, colon, something, something, and some are well-known, like some, in this case, org, parse, PulseAudioServer, that config. Secondly, we recursively introspect the services. That means gathering their structure, objects, interface, method, et cetera. Per the Dbus specifications, each service, can respond with its object structure when the Dbus standard method introspect is requested. The response is well-formatted XML, as shown on the right example, and this is the root object of system D, and you can see the interfaces, methods, and method arguments in child objects. Now, in this step, we try to read every property value. To do that, we use the Dbus standard method, getAll on every object, but then uses the utility called the Dbus standard, which is one of the default utilities, but however, the responses from getAll method, as shown on the left, are not quite well-formatted for an easy processing. So we made a custom Bison parser, basically a compiler, getAll method, as shown on the left, are not quite well-formatted for an easy processing. As you can see, getAll.json works well to convert the strings into JSON-compliant forms, as shown on the upper right. Next step, the most important one. We try to call every method of every interface for all the objects. When doing this, we use random arguments, such as giverish things, so that the actual logic is not executed, is not executed. is not executed. as shown above, something like several strings of just one. Then an error would be returned. As we discussed, since the privilege gets validated first, we ignore the message that return x is denied, so they are actually checking, so they are safe. But with any other error, we assume the message are callable. Finally, we hash every object to remove duplicates, then print out the readable properties and call our message. That was Dan. Now we got that out of the way, let's move on to the fun part, the vulnerabilities. We ran our Dan with the target, the target device, Samsung Gear Sport. It took about an hour, then the results are like this. And there were 269 bus names, from which there were over 130,000 readable properties and over 2,000 callable messages. This does not include the default interfaces, such as the bus. That's a lot of messages. But we do have some false positives because of the fact that we have the third check we mentioned. The log shows some services check Sinara. Some services themselves explicitly check Sinara. You can see on the right, Sinara check fail. But the method call itself does not return any Dbus error, so then the tool categorized them callable. At this point, we started to manually examine each method, the 2,000 of them. And it turns out it was worth it. So we discovered many system services that allow privilege violations. A malware without any privilege could take over Wi-Fi, Bluetooth, screen, notification, email, and so many more. Sounds a bit scary. So now let's take a look at them one by one. First, we found the Dbus API for WPA supplicant was fully exposed. For those who don't know, this is a free software implementation for 802.11i, which can be easily found on Linux systems. Python builds its own APIs and daemons on top of WPA supplicant. So we found every message is callable and every property is readable. And that includes create interface, remove interface, scan, WPS scan, WPS start, and so on. Get pin, P2P find, connect, and more. Now, this exposure violates Tizen's many network-related privileges and also location-related private ones too. Now, let me give you some more example on that. Well, many companies run a database from which GPS coordinates can be publicly obtained if two components are known, the SSID of nearby Wi-Fi networks, and their signal values. So even though location privilege isn't granted, or even the location daemon is itself completely turned off, the malware can track the device by taking over Wi-Fi. On the right example, we acquire the BSS ID of the first known Wi-Fi network, starting with 98D78. And the signal value, the value of negative 51. So using Google's geolocation API, we have the GPS core or coordinate, which is our lab. Next, we have Bluetooth. The ProjectX.bt and ProjectX.bt core are two of Tizen's own services for controlling Bluetooth. And these services partially expose methods where, a malware can silently accept incoming Bluetooth pair requests, or silently force Bluetooth discovery mode, or prompt a pairing request system UI to do phishing. Now, on the right, we have an example. So whenever a malware calls the method in the background, or at any time, the UI in the first image pops up. So when the user scrolls down, the first image pops up. So when the user scrolls down, they see the actual name of the paired smartphone. This system interface is supposed to be one of the Bluetooth pairing methods, where the user manually types in the PIN. However, if the user sees the UI without any initiation, or without even entering the Bluetooth discovery mode, then the user would think, like, that's weird. What does this PIN mean? Well, that's my phone. That's the name of my phone. So I guess I should punch in my PIN. Then the value just gets returned to the malware. Now, besides Project X, there is another daemon for Bluetooth, BlueZ. Now, BlueZ is the underlying Bluetooth stack for Linux. And we found that its APIs are partially exposed as well. A malware, which is the most popular one, is called BlueZ. A malware can silently force devices to disconnect, gather information, and so on. There is a bonus, though, and that's HCI dump. We found on some devices, there is no restriction on HCI dump utility. As you can see on the right, what that means is that any mailer or any user can simply dump the incoming, outgoing Bluetooth packet with no super user privilege. Now, by combining the two, a malware can start dumping HCI packets and force the paired device to disconnect, which will automatically reconnect with a new link key, then extract the key from the dump. Needless to say, this problem is violated as Bluetooth-related, also private privilege. Next, we take over the screen, too. Tizen's choice of Windows Manager is the Enlightenment project. Among many exposure methods, dump.topv wins. Somehow this method dumps the Windows into PNG files, as you can see on the right. Now, this problem violates Tizen's screenshot, private privilege. And then we have the notification service. This service doesn't only manage notification data, but also can do stuff on behalf of the users. Tap on the screen. So this service is also partially exposed. As a result, a malware can remove all the notifications or launch an application on the phone, read all the incoming messages, internal data, and so on. Now, in this case, privilege like notification and push are violated, but there is no privilege assigned to this kind of invasive behavior. No application should actually be able to do this. Then, finally, we have emails. The re-mail consumer manages the user's mailbox data, just like the notification. It also lets anyone do stuff. A malware can launch the email app on the smartphone, modify email messages, and most importantly, send any email. Using the user's email address. So messaging and email-related private privileges are violated. But the most problematic thing is how this service actually handles private messages. Actually, sending an email request does get rejected, but how? On the right, we have the code. First, we have the string, re-mail, private send mail, no T. Then, it does string compare and nothing more. If it's not a match, the error shows up. IP is different, but if it's a match, then we're through. There is no proper privilege check in place, and the only security here is that one string check. Now, let me give you an actual demo that combines many of the problems, we discussed, into one neat little package. Here, you can see our malware has no privilege. Then, we are building it and launching it on the target device on the right. The package is being loaded, and the malware will look like a simple watch face application. There you go. Now, the phone receives a Google Hang-Offs notification that the data is handed over to the watch. Then, let's say the user puts the app in the background, and after a bit of waiting, the malware will start to run the code. Then, the user is now checking the email. It's waiting for a while. Then, the first. Then, the second. It disconnects the Bluetooth connection to the phone, then executes HCI dump for Bluetooth packets for a while. Then, yes. Soon, the connection will re-establish with a new link key. Then, the malware will log the data like that. Then, it also acquires the notification data. Now, it starts to send the data to the attacker's email using the user's email account. It also captures the screen, then sends the email image data. Now, we are at the attacker's screen. Emails should arrive soon. There you go. It's taking a while. And one thing to notice is that the emails are coming from the phone. You can see the notifications start to pop up on top of the phone and the watch. Like that. And the watch. Yes. Now, we are receiving the images. Each image is a window. This one. And there's a code. And this data is one part HCI PCAP file, and the other part a JSON object. So, let's just parse it. The JSON object is the internal data of the notification service. So, you can see the message in the middle. So, my room password is something in the middle. Now, finally, examining the HCI PCAP file shows the new link key like at the bottom. And that's the demo. Thank you. Then, why did all this happen? So, we went through the configuration files to get a glimpse of it. First, we have the notification service. You can see there are only three checks elements listed. They try something, but many other messages are simply missing. In the case of Wi-Fi, we can get a clue from the Tizen wiki. The left diagram shows how it was designed. On top of WPA supplicant, there are Tizen's conman daemon and netconfig daemon. And then on top of that, there's the application. While the middleware is protected by their configuration files, WPA supplicant configuration simply doesn't exist. And why is that? Because how it actually works is on the right diagram. The bus is not on hierarchy like the supposed design on the left. The services are on the same bus, so they all need to be secured. And it was neglected. Finally, we went to the Galaxy app. Since Diva's client APIs are officially supported through the Enlightenment, we were able to develop a proof of concept. We were able to submit an app called Bitwatch. The Watchface app only has internet-related privileges, but it dumps the notification internal data and sends it to a remote server. The app was submitted with some obfuscation to hide some strings and went through the verification process undetected as a malware. It went on sale for a brief amount of time until we took it down. We reported this research to Samsung in April. They were quick to respond with many patches committed to the Tizen open source repository and some firmware updates were. At least. Now, let's wrap up. To recap, in this session, we discussed the Tizen security internals. And around the objects and privileges, we focused on where they are validated. We talked about the three checkpoints, the client process, the Sinara-aware Diva statement, and the service process. Then we discussed DAN, which uses access-denied. We defined error message as an oracle to discover potential privilege violations. And finally, we disclosed the privilege violations that impact many system services of the Gear smartwatch, Wi-Fi, Bluetooth, screen notification, and email. Additionally, we showed up the possibility of distribution via the official store. So, where can we go from here? There may be some questions. Can this tool be applied to other Tizen systems like TVs or refrigerators? Or how about other Diva systems like Linux? We can also think about some more advanced workaround techniques to bypass future mitigations enforced by Galaxy Apps SOAR. That's it for the session. I would like to thank Professor Hyungki Choi for his guidance, Joseph Lee for the initial research, Betty Bae for the proofreading, and Gyeonghwan Hong, Shinjo Park, and John Steinbach for the advice. And that's it. If you have any questions, I would like to answer them. Thank you for listening.