1 00:00:00,000 --> 00:00:00,940 Let's get to it. 2 00:00:00,940 --> 00:00:05,220 Noah Moshe from Clarity Team, turning camera surveillance on this accident. 3 00:00:10,560 --> 00:00:12,060 Yeah, good job winning. 4 00:00:12,060 --> 00:00:14,000 Yeah, we kicked their asses. 5 00:00:14,000 --> 00:00:17,280 So, before I start, let me introduce myself. 6 00:00:17,280 --> 00:00:21,800 My name is Noah Moshe and I am the team lead and lead vulnerability researcher at Clarity 2. 7 00:00:21,800 --> 00:00:31,560 Now, my day job, and I believe it's one of the coolest there is, is to essentially find vulnerabilities in all sorts of devices and responsibly disclose them to the vendor. 8 00:00:31,600 --> 00:00:37,540 Here you can see one of, I think, six, seven racks in our lab where essentially this is my playground. 9 00:00:37,540 --> 00:00:50,740 I get to connect and play and find vulnerabilities in all sorts of devices including OT like PLCs, HMIs, medical devices like DNA sequencers, patient monitors, all of that sort of fun. 10 00:00:50,740 --> 00:00:55,520 And of course, my personal favorite and today's topic, IoT devices. 11 00:00:55,540 --> 00:00:59,640 So without further ado, let's jump right in and start our talk. 12 00:01:00,680 --> 00:01:03,900 So, my goal at the beginning of the day was quite simple. 13 00:01:03,900 --> 00:01:09,980 I wanted to see how I can hack my way into the internal networks of big companies around the world. 14 00:01:09,980 --> 00:01:19,480 And when attackers and pen testers alike have this task, they usually go with the usual suspects of Internet exposed services. 15 00:01:19,640 --> 00:01:28,740 Now, I went to show them census and basically search for that company's IP addresses and saw what kind of services they exposed to the Internet. 16 00:01:29,100 --> 00:01:32,720 In it, I saw the usual suspects, VPN, file sharings. 17 00:01:32,720 --> 00:01:39,520 However, soon enough I discovered one service that I was completely unaware of which is called access remoting. 18 00:01:39,640 --> 00:01:42,600 At this point I said, oh, a cool new service. 19 00:01:42,600 --> 00:01:50,020 Let's see what's going on under the hood and maybe we can find vulnerabilities in it to try and uncover new attack surface on these devices. 20 00:01:50,200 --> 00:01:57,520 Now, before we try and see what is access remoting, what is the protocol, we first need to understand what is access. 21 00:01:57,520 --> 00:02:03,420 You see, access is an IP camera manufacturer that is geared toward enterprise solutions. 22 00:02:03,420 --> 00:02:10,980 You'll see access cameras in big companies, educational institutions, medical devices and of course government agencies. 23 00:02:11,120 --> 00:02:23,920 All the cameras are running custom proprietary OS called access OS which is a Linux fork that is based with a lot of modification and they all offer vast ways to control the cameras. 24 00:02:24,100 --> 00:02:29,480 However, the problem arises when a company has more than one cameras. 25 00:02:29,480 --> 00:02:45,660 You see, most companies have dozens of floors, many different physical locations, offices, all sorts of different locations that need to have video surveillance and this makes it a huge hassle to actually manage and control your entire camera fleet. 26 00:02:45,660 --> 00:02:52,420 And to do that, access implemented a very cool services that enable one centralized control solution. 27 00:02:52,520 --> 00:03:03,500 The first one is DAX device manager which essentially allows you to control, manage, configure, backup, do firmware upgrade, all that sort of fun in one centralized location. 28 00:03:03,500 --> 00:03:09,920 This is essentially the server that controls and manages your entire access fleet of cameras. 29 00:03:10,360 --> 00:03:17,340 In addition to that, at the end of the day, the main use case of these cameras is to have video surveillance. 30 00:03:17,340 --> 00:03:25,540 Meaning allowing administrators, guards, all that sort of fun to be able to view the actual camera feed of your cameras. 31 00:03:25,540 --> 00:03:30,160 And to do that in a centralized location, access offers the access camera station. 32 00:03:30,360 --> 00:03:32,660 This is essentially how it looks like. 33 00:03:32,660 --> 00:03:42,260 It's a matrix of different camera feeds, live views, and this is where you find in your guard rail posts, basically in your guard station. 34 00:03:43,260 --> 00:03:56,200 Now, most cases there is need for remote access because companies has various different physical location, offices, floors, they are not all sitting in the same network. 35 00:03:56,200 --> 00:03:58,820 And you need to have remote access to your servers. 36 00:03:58,820 --> 00:04:01,800 You want to be able to view your camera feeds remotely. 37 00:04:01,800 --> 00:04:05,040 You want to make sure that everything is fine, your cameras are working. 38 00:04:05,220 --> 00:04:11,260 And to do that, access implemented their own proprietary protocol called access remoting. 39 00:04:11,260 --> 00:04:18,000 Now this protocol is fully encrypted, fully authenticated, fully secure, or maybe not so much. 40 00:04:18,000 --> 00:04:29,560 And this way users are instructed to simply open this port and to be able to connect to their servers remotely and to be able to manage, control, and view the camera feeds of your entire camera's fleet. 41 00:04:30,140 --> 00:04:34,380 In addition to that, access has a cloud solution called access secure access. 42 00:04:34,380 --> 00:04:38,120 It's not the same as access remoting but it has one major con. 43 00:04:38,120 --> 00:04:45,080 You see it costs a lot, it's pay as per traffic, and most organizations opt out of it because the costs are very high. 44 00:04:45,200 --> 00:04:57,340 And to do that, access offers the on prem installations which basically enable you to build, to have your own servers, install the software on them, and then you have full control, full visibility over your cameras. 45 00:04:58,020 --> 00:04:59,680 So this is the use case. 46 00:04:59,680 --> 00:05:09,800 We have our server that is owned by a certain big company and we have our client that connects to it via the proprietary protocol and controls the entire camera fleet. 47 00:05:10,020 --> 00:05:11,640 And this was my goal in this research. 48 00:05:11,640 --> 00:05:18,660 My goal was to simply take over, take full control of the server and to be able to execute remote code on the servers. 49 00:05:18,880 --> 00:05:28,840 And of course because the server's main purpose is to actually to manage cameras, we can move laterally from the server and actually execute code on the cameras themselves. 50 00:05:28,840 --> 00:05:37,460 Giving us full visibility, full network access, and of course the ability to do James Bond style of uh, interfering with camera surveillance. 51 00:05:38,020 --> 00:05:49,640 And because so many companies are using it, I mean access is one of the biggest vendors there is, we can cause an effect that will affect dozens and thousands of different servers, different companies around the globe. 52 00:05:50,000 --> 00:05:53,940 So let's deep dive and see what kind of vulnerabilities we managed to uncover. 53 00:05:54,240 --> 00:05:56,780 First of all, we need to understand what is the setup. 54 00:05:56,780 --> 00:06:02,240 You see, access device manager conversations are Windows native applications. 55 00:06:02,240 --> 00:06:04,760 They are for client and server applications. 56 00:06:04,980 --> 00:06:10,200 Everything is written in dot net which makes the actual researching process a little bit easier. 57 00:06:10,480 --> 00:06:19,960 In addition to that, to make the protocol fully secure, the entire protocol is wrapped with MTLS, meaning both endpoints need to have a TLS certificate. 58 00:06:20,100 --> 00:06:24,220 And of course the first thing that the protocol requires is valid authentication. 59 00:06:24,920 --> 00:06:34,560 So my first step in this research was first to be able to dissect and view clear text traffic about how this proprietary protocol actually looks like. 60 00:06:34,560 --> 00:06:41,820 Because I wanted to uncover vulnerabilities and because it is a proprietary protocol, there is no documentation, no known clients, no nada. 61 00:06:42,060 --> 00:06:51,400 So all I did was set up a simple man in the middle cell that supports MTLS, meaning it exposes an MTLS cell and creates a new connection to an access cell. 62 00:06:51,540 --> 00:07:02,180 And then I connected my client to my cell which forwarded the request to the real access cell and I was able to see clear text communication between the client and the cell. 63 00:07:02,860 --> 00:07:04,340 And this is how it looks like. 64 00:07:04,340 --> 00:07:14,640 This is the proper way to initiate an access communication and we see that after initializing the MTLS communication, we have the first user agent. 65 00:07:14,640 --> 00:07:20,000 This way the server is able to make sure that a valid access client connects to it. 66 00:07:20,000 --> 00:07:25,760 We then have immediately NTLM SSP authentication, meaning NTLM challenge and response. 67 00:07:25,760 --> 00:07:31,740 And this way access is able to verify that only allowed users are interacting with their servers. 68 00:07:32,260 --> 00:07:43,360 Now an important tidbit of information is that because access uses NTLM, they actually expose the host name and domain name of the server immediately during protocol handshake. 69 00:07:43,360 --> 00:07:47,500 Meaning we are able to glimpse a lot of information about the server setup. 70 00:07:48,000 --> 00:08:02,840 Now after we see, well past the NTLM challenge response, we get to the bread and butter which is the actual access communication, access remoting communication protocol which is a JSON based protocol composed of regular RPC. 71 00:08:02,840 --> 00:08:10,340 Essentially allowing the client to invoke different functionalities on the server using the JSON format. 72 00:08:10,440 --> 00:08:22,180 Now in order to invoke functionality the server, the client must pass along what kind of method they want to execute on the server's end point in order to understand what they want to invoke on the server's back end. 73 00:08:22,660 --> 00:08:31,880 My goal was to try and understand how this is implemented and how this RPC communication is actually implemented behind the scenes on the server's end point. 74 00:08:31,880 --> 00:08:36,820 And after some digging around I discovered that access uses the service contract. 75 00:08:36,820 --> 00:08:52,240 Now this is a very , very common way of handling RPC in .NET application and essentially it allows the server to expose a certain list of classes and methods they want to allow clients to invoke remotely on the server's back end. 76 00:08:52,240 --> 00:08:55,500 Super common, super trivial in .NET. 77 00:08:55,500 --> 00:09:06,780 However, while this is super simple when it has simple structures, meaning they want to pass along for a function primitive types like string, integers, longs. 78 00:09:06,940 --> 00:09:12,000 Sometimes functions have more complicated types as their arguments. 79 00:09:12,440 --> 00:09:19,240 Let's say for example take a look at this log on async function that is exposed by the access server. 80 00:09:19,280 --> 00:09:33,520 And we can see that it does not have primitive types as its argument but instead it has the client information DTO which we can obviously see it is a complicated class composed of different primitive members. 81 00:09:33,740 --> 00:09:39,740 Now in order to actually create this on the server's back end some sort of deserialization must occur. 82 00:09:39,740 --> 00:09:47,500 Meaning the server must create the class of client information DTO in order to actually execute the method. 83 00:09:47,500 --> 00:09:55,100 And to do that access used JSON deserialization and to make matters worse they actually used the type name handling auto. 84 00:09:55,100 --> 00:10:05,460 This essentially tells the server that the client fully controls what kind of classes will be created on the server's back end allowing the classes to create arbitrary classes. 85 00:10:05,460 --> 00:10:14,140 Now this is super dangerous deserialization vulnerability and in .NET this immediately leads to code execution due to a known gadget. 86 00:10:14,140 --> 00:10:21,420 Meaning this is essentially a fully deserialization vulnerability leading to a remote code execution. 87 00:10:21,680 --> 00:10:32,960 Now this is an example of a request and we can see that the client passes along this dollar sign type which basically tells the server what kind of class they want to create on the server's back end. 88 00:10:32,960 --> 00:10:36,120 In this case Windows client API class. 89 00:10:36,780 --> 00:10:37,280 Cool. 90 00:10:37,280 --> 00:10:39,060 So we have a deserialization vulnerability. 91 00:10:39,060 --> 00:10:43,000 Let's see what we need to do in order to fully exploit it. 92 00:10:43,040 --> 00:10:47,700 And essentially what we need to do is to pass along and follow the access remoting protocol. 93 00:10:47,700 --> 00:10:50,260 We first need to initiate an MTLS connection. 94 00:10:50,260 --> 00:10:53,620 We need to send the user agent so the server won't kick us off. 95 00:10:53,620 --> 00:11:02,620 We need to pass the MTL MSSP challenge response and wha-bam we are sending access remoting JSON payloads which has a deserialization vulnerability. 96 00:11:02,720 --> 00:11:03,560 That's it right? 97 00:11:03,560 --> 00:11:07,820 Well there is only one problem and this is that this is essentially all. 98 00:11:07,820 --> 00:11:14,640 We need to pass the auth and we need to have proper authentication credentials in order to send access remoting credentials. 99 00:11:15,280 --> 00:11:19,560 So we do have an RCA vulnerability however it is not pre-auth. 100 00:11:19,560 --> 00:11:23,260 It has some pre-shared knowledge that we need to know which is the credentials. 101 00:11:23,400 --> 00:11:25,760 However let's see how it's still exploitable. 102 00:11:25,900 --> 00:11:31,500 And to do that we'll go back to our man in the middle setup where we are man in the middle connection between a client and a server. 103 00:11:31,740 --> 00:11:35,600 All we need to do is pass along the MTLM challenge and response. 104 00:11:35,600 --> 00:11:44,900 Essentially doing a pass the hash, pass the challenge vulnerability allowing the client to authenticate to the server and do and pass the authentication requirement. 105 00:11:44,960 --> 00:11:55,720 Now because access has no sort of signing, message signing or anything of that sort, we are able to inject and use the actual client session in order to inject our own payloads. 106 00:11:55,720 --> 00:12:12,500 Which once the client passes the authentication we simply replace their payload with a malicious deserialization payload and we generate it using ysoserial.net and whabam we have code execution on the access server giving us full code execution. 107 00:12:12,780 --> 00:12:21,460 And to make matters worse because both the client and server uses the access remoting protocol we can do the same on the client end point as well. 108 00:12:21,460 --> 00:12:29,540 Meaning we can pass it along a serialized object that is malicious which will trigger remote code execution on the client as well. 109 00:12:30,060 --> 00:12:33,500 However once we control the server we can do more. 110 00:12:33,500 --> 00:12:39,080 You see we can actually execute code on the cameras themselves using legitimate features. 111 00:12:39,300 --> 00:12:44,920 So in order to allow modularity for system administrators access supports what's called packages. 112 00:12:44,920 --> 00:12:48,200 Essentially allowing you to change your camera's behavior. 113 00:12:48,240 --> 00:12:53,280 Of course access has their own packages however they allow anyone to create their package. 114 00:12:53,280 --> 00:12:58,260 All you need to do is use the access ACAP SDK and you can build your own package. 115 00:12:58,260 --> 00:13:14,600 So what we did was we built a backdoored package, signed it using our key, used our docker to actually compile it because it is native CPP code and we have the ability to upload it to a camera using the server we've just spawned. 116 00:13:14,600 --> 00:13:19,420 Meaning we add the app, we run it and we also have code execution on the server. 117 00:13:19,440 --> 00:13:22,840 Meaning at this point we basically executed code everywhere. 118 00:13:22,840 --> 00:13:26,740 We executed code on the client, the server and the cameras themselves. 119 00:13:27,240 --> 00:13:29,720 However, that's not good enough. 120 00:13:29,720 --> 00:13:36,220 Because like I've told you at the beginning I want to have full remote code execution pre-authenticated. 121 00:13:36,460 --> 00:13:39,440 And at this point I need to have a man in the middle set up. 122 00:13:39,440 --> 00:13:47,060 I need to have user interaction, it's a one click vulnerability and I need to somehow trick the user into connecting to my own malicious server. 123 00:13:47,200 --> 00:13:51,140 This is not full remote code execution and this is our goal. 124 00:13:51,140 --> 00:13:53,640 So let's see how we can actually exploit it. 125 00:13:53,800 --> 00:13:57,460 So after a lot of time I've actually reached a dead end. 126 00:13:57,460 --> 00:14:01,680 I could not bypass the authentication on the access remoting protocol. 127 00:14:01,880 --> 00:14:09,040 Simply because it was immediately requiring us to pass the NTLM challenge response upon socket creation. 128 00:14:09,040 --> 00:14:18,060 However, luckily after sometimes consulting with the documentation of access I discovered this tidbit of information which is a fallback protocol. 129 00:14:18,060 --> 00:14:25,280 When the main TCP port is not accessible by the client there is a fallback protocol using a different port. 130 00:14:25,280 --> 00:14:33,900 And when I've read it I saw this weird description about the protocol being HTTP with AES encryption which sounded super, super weird. 131 00:14:33,900 --> 00:14:42,400 However, since it was HTTP all I did was put on this port in my browser and sadly I immediately got this credential requirement. 132 00:14:42,660 --> 00:14:50,300 However, even when I've placed my credentials in this box the server just kept load loading, looping in this white screen. 133 00:14:50,980 --> 00:14:55,900 Nothing was presented to me, I was not able to use it, something was weird. 134 00:14:55,900 --> 00:15:02,140 And at this point I realized that this is not regular HTTP and something weirder is going on behind the scenes. 135 00:15:02,140 --> 00:15:06,640 So I began reverse engineering this proprietary fallback protocol. 136 00:15:06,940 --> 00:15:12,600 And this is how it essentially looks like and it does use HTTP however only vaguely. 137 00:15:12,600 --> 00:15:19,720 The first thing a client does is it connects to the access server and you're sending an HTTP get request. 138 00:15:19,720 --> 00:15:22,720 And the server responds with a channel ID. 139 00:15:22,880 --> 00:15:31,060 Now this initial connection must be kept alive for the throughout of the communication as it will be used later. 140 00:15:31,220 --> 00:15:38,080 Then the client creates a new connection on a new socket using the get slash channel ID it just received. 141 00:15:38,140 --> 00:15:44,600 And we now have two channels, two communication streams that enable us to communicate with the server. 142 00:15:44,620 --> 00:15:54,300 At this point we have a TX and an RX meaning we are able to have one channel for transmission and one for receiving similar to signaling over the line. 143 00:15:54,660 --> 00:16:03,340 After we have these two channels each side now begins the key exchange. 144 00:16:03,340 --> 00:16:16,560 Each side first sends their public key and then each side generates a random AES key and takes the public key that it was just given and encrypts the AES key with the public key. 145 00:16:16,560 --> 00:16:30,840 And at this point each endpoint has their own AES key that enables them to communicate over an encrypted channel and any message that will send onwards will be fully encrypted using the AES keys they've just exchanged. 146 00:16:31,180 --> 00:16:33,160 Now at this point I was like why? 147 00:16:33,160 --> 00:16:35,320 Why have such a complicated protocol? 148 00:16:35,320 --> 00:16:39,400 Why use this weird protocol over HTTP? 149 00:16:39,400 --> 00:16:44,140 Because essentially they created sockets over HTTP. 150 00:16:44,140 --> 00:16:51,400 And not only that they've used two sockets, two channels for TX and RX which is super weird because socket is two way communication. 151 00:16:51,700 --> 00:16:58,560 However they do use both symmetric and asymmetric communication so the question is, is it more secure? 152 00:16:58,560 --> 00:17:00,900 Because they are using encryption, maybe it is. 153 00:17:00,900 --> 00:17:02,640 And the sad truth is no. 154 00:17:02,640 --> 00:17:14,740 This is still vulnerable, this is the same access remoting protocol behind the scenes and once you create this secure channel we are back to sending serialized JSON based communication for our PC. 155 00:17:14,860 --> 00:17:23,160 Meaning if we bypass the auth we still are able to execute our code using the deserialization vulnerability we discovered before. 156 00:17:24,080 --> 00:17:28,180 And next my goal was to try and see how we can actually bypass the auth. 157 00:17:28,180 --> 00:17:33,780 And to do that I've went and noticed what kind of authentication schemas this server supports. 158 00:17:33,780 --> 00:17:40,980 Because I saw that immediately when I connect to this HTTP port I am presented with a form telling me hey please authenticate. 159 00:17:40,980 --> 00:18:01,380 Sadly on the main web server we see that they've set up a negotiate web schema, authentication schema which essentially limits the client into using Kerberos or NTLM authentication which means we are back to having required to use NTLM SSP to actually authenticate to the server. 160 00:18:01,380 --> 00:18:15,200 However after some more digging around I found this super, super secret end point which is slash underscore slash which for some reason, I'm not sure why, supports the anonymous authentication schema. 161 00:18:15,200 --> 00:18:18,540 Meaning we don't need to authenticate and we are able to use it. 162 00:18:18,540 --> 00:18:19,980 So let's see our game plan. 163 00:18:19,980 --> 00:18:27,380 First we use the slash underscore slash secret path and this way we are able to start communicating in access remotely. 164 00:18:27,380 --> 00:18:34,540 We then need to implement the read communication protocol over this HTTP channel because it's not immediately playing our PC immediately. 165 00:18:34,540 --> 00:18:46,500 However once we do that we are able to talk with access remoting and we are able to send our secure, our deserialization payload giving us full pre-auth RCE on the access server. 166 00:18:46,660 --> 00:18:48,220 Super duper cool. 167 00:18:48,220 --> 00:18:59,160 And of course once we do that we are back, back again to hacking away into the cameras giving us full pre-auth RCE on both the server and the cameras it manages. 168 00:19:00,080 --> 00:19:00,420 Amazing right? 169 00:19:00,440 --> 00:19:05,600 So we have pre-auth RCE but let's see what kind of effect we've actually managed to gain. 170 00:19:06,200 --> 00:19:21,780 After finding these vulnerabilities I went once again to census and wanted to search what kind of users have this server exposed online and sadly I discovered almost 6500 different servers around the world, most of which are in the US. 171 00:19:21,940 --> 00:19:28,600 Now we need to remember this server manages up to 10,000 cameras meaning the effect is actually quite vast. 172 00:19:28,600 --> 00:19:38,060 However I don't want to attack anonymous users on the internet and instead I want to be able to pinpoint targets and actually know who uses this service. 173 00:19:38,080 --> 00:19:43,860 And to do that I remembered that access actually use NTLM SSP to authenticate the users. 174 00:19:43,860 --> 00:19:50,100 And in the NTLM SSP there is the host name and domain like I've just showed you before. 175 00:19:50,100 --> 00:20:02,780 Meaning all we need to do is to implement a very basic client that connects to a server's endpoint, waits for the NTLM SSP challenge and we have the full host name and domain name of the server. 176 00:20:02,780 --> 00:20:13,460 So we've composed a very big list of all the targets and in it we found many, many educational institutions, government agencies, medical institutions and huge companies. 177 00:20:14,220 --> 00:20:16,740 Next I asked myself why? 178 00:20:16,740 --> 00:20:21,120 Why there are so many instances exposed online? 179 00:20:21,140 --> 00:20:31,280 And to do that we've realized that in recent years more and more IP camera brands are being banned from use in Western countries. 180 00:20:31,340 --> 00:20:35,620 Meaning in the US, in Europe, Chinese based companies are not allowed. 181 00:20:35,620 --> 00:20:39,640 And this leaves users with less and less options to pick from. 182 00:20:39,640 --> 00:20:46,140 In addition to that there is a very big need to expose this service because you want to be able to access your cameras remotely. 183 00:20:46,380 --> 00:20:55,320 And simply because the service is fully encrypted people think it's secure, however it doesn't mean there are vulnerabilities that allow us to bypass it. 184 00:20:55,980 --> 00:20:59,700 And before I'm going to finish I just want to give credit where credit is due. 185 00:20:59,700 --> 00:21:14,160 We've worked with Access and we responsibly disclosed all the vulnerabilities to them and they were super cool, super helpful, super professional and implemented patches in amped time and wanted to make sure their clientele is secure. 186 00:21:14,160 --> 00:21:19,480 So credit to them for taking their product security in a responsible manner. 187 00:21:19,720 --> 00:21:21,220 So thank you everyone. 188 00:21:21,220 --> 00:21:21,940 Thank you very much. 189 00:21:21,940 --> 00:21:26,720 I hope you understand the risk with the Extranautic Protocol and thank you.