WEBVTT

00:00.000 --> 00:00.940
Let's get to it.

00:00.940 --> 00:05.220
Noah Moshe from Clarity Team, turning camera surveillance on this accident.

00:10.560 --> 00:12.060
Yeah, good job winning.

00:12.060 --> 00:14.000
Yeah, we kicked their asses.

00:14.000 --> 00:17.280
So, before I start, let me introduce myself.

00:17.280 --> 00:21.800
My name is Noah Moshe and I am the team lead and lead vulnerability researcher at Clarity 2.

00:21.800 --> 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.

00:31.600 --> 00:37.540
Here you can see one of, I think, six, seven racks in our lab where essentially this is my playground.

00:37.540 --> 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.

00:50.740 --> 00:55.520
And of course, my personal favorite and today's topic, IoT devices.

00:55.540 --> 00:59.640
So without further ado, let's jump right in and start our talk.

01:00.680 --> 01:03.900
So, my goal at the beginning of the day was quite simple.

01:03.900 --> 01:09.980
I wanted to see how I can hack my way into the internal networks of big companies around the world.

01:09.980 --> 01:19.480
And when attackers and pen testers alike have this task, they usually go with the usual suspects of Internet exposed services.

01:19.640 --> 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.

01:29.100 --> 01:32.720
In it, I saw the usual suspects, VPN, file sharings.

01:32.720 --> 01:39.520
However, soon enough I discovered one service that I was completely unaware of which is called access remoting.

01:39.640 --> 01:42.600
At this point I said, oh, a cool new service.

01:42.600 --> 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.

01:50.200 --> 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.

01:57.520 --> 02:03.420
You see, access is an IP camera manufacturer that is geared toward enterprise solutions.

02:03.420 --> 02:10.980
You'll see access cameras in big companies, educational institutions, medical devices and of course government agencies.

02:11.120 --> 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.

02:24.100 --> 02:29.480
However, the problem arises when a company has more than one cameras.

02:29.480 --> 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.

02:45.660 --> 02:52.420
And to do that, access implemented a very cool services that enable one centralized control solution.

02:52.520 --> 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.

03:03.500 --> 03:09.920
This is essentially the server that controls and manages your entire access fleet of cameras.

03:10.360 --> 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.

03:17.340 --> 03:25.540
Meaning allowing administrators, guards, all that sort of fun to be able to view the actual camera feed of your cameras.

03:25.540 --> 03:30.160
And to do that in a centralized location, access offers the access camera station.

03:30.360 --> 03:32.660
This is essentially how it looks like.

03:32.660 --> 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.

03:43.260 --> 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.

03:56.200 --> 03:58.820
And you need to have remote access to your servers.

03:58.820 --> 04:01.800
You want to be able to view your camera feeds remotely.

04:01.800 --> 04:05.040
You want to make sure that everything is fine, your cameras are working.

04:05.220 --> 04:11.260
And to do that, access implemented their own proprietary protocol called access remoting.

04:11.260 --> 04:18.000
Now this protocol is fully encrypted, fully authenticated, fully secure, or maybe not so much.

04:18.000 --> 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.

04:30.140 --> 04:34.380
In addition to that, access has a cloud solution called access secure access.

04:34.380 --> 04:38.120
It's not the same as access remoting but it has one major con.

04:38.120 --> 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.

04:45.200 --> 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.

04:58.020 --> 04:59.680
So this is the use case.

04:59.680 --> 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.

05:10.020 --> 05:11.640
And this was my goal in this research.

05:11.640 --> 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.

05:18.880 --> 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.

05:28.840 --> 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.

05:38.020 --> 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.

05:50.000 --> 05:53.940
So let's deep dive and see what kind of vulnerabilities we managed to uncover.

05:54.240 --> 05:56.780
First of all, we need to understand what is the setup.

05:56.780 --> 06:02.240
You see, access device manager conversations are Windows native applications.

06:02.240 --> 06:04.760
They are for client and server applications.

06:04.980 --> 06:10.200
Everything is written in dot net which makes the actual researching process a little bit easier.

06:10.480 --> 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.

06:20.100 --> 06:24.220
And of course the first thing that the protocol requires is valid authentication.

06:24.920 --> 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.

06:34.560 --> 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.

06:42.060 --> 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.

06:51.540 --> 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.

07:02.860 --> 07:04.340
And this is how it looks like.

07:04.340 --> 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.

07:14.640 --> 07:20.000
This way the server is able to make sure that a valid access client connects to it.

07:20.000 --> 07:25.760
We then have immediately NTLM SSP authentication, meaning NTLM challenge and response.

07:25.760 --> 07:31.740
And this way access is able to verify that only allowed users are interacting with their servers.

07:32.260 --> 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.

07:43.360 --> 07:47.500
Meaning we are able to glimpse a lot of information about the server setup.

07:48.000 --> 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.

08:02.840 --> 08:10.340
Essentially allowing the client to invoke different functionalities on the server using the JSON format.

08:10.440 --> 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.

08:22.660 --> 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.

08:31.880 --> 08:36.820
And after some digging around I discovered that access uses the service contract.

08:36.820 --> 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.

08:52.240 --> 08:55.500
Super common, super trivial in .NET.

08:55.500 --> 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.

09:06.940 --> 09:12.000
Sometimes functions have more complicated types as their arguments.

09:12.440 --> 09:19.240
Let's say for example take a look at this log on async function that is exposed by the access server.

09:19.280 --> 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.

09:33.740 --> 09:39.740
Now in order to actually create this on the server's back end some sort of deserialization must occur.

09:39.740 --> 09:47.500
Meaning the server must create the class of client information DTO in order to actually execute the method.

09:47.500 --> 09:55.100
And to do that access used JSON deserialization and to make matters worse they actually used the type name handling auto.

09:55.100 --> 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.

10:05.460 --> 10:14.140
Now this is super dangerous deserialization vulnerability and in .NET this immediately leads to code execution due to a known gadget.

10:14.140 --> 10:21.420
Meaning this is essentially a fully deserialization vulnerability leading to a remote code execution.

10:21.680 --> 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.

10:32.960 --> 10:36.120
In this case Windows client API class.

10:36.780 --> 10:37.280
Cool.

10:37.280 --> 10:39.060
So we have a deserialization vulnerability.

10:39.060 --> 10:43.000
Let's see what we need to do in order to fully exploit it.

10:43.040 --> 10:47.700
And essentially what we need to do is to pass along and follow the access remoting protocol.

10:47.700 --> 10:50.260
We first need to initiate an MTLS connection.

10:50.260 --> 10:53.620
We need to send the user agent so the server won't kick us off.

10:53.620 --> 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.

11:02.720 --> 11:03.560
That's it right?

11:03.560 --> 11:07.820
Well there is only one problem and this is that this is essentially all.

11:07.820 --> 11:14.640
We need to pass the auth and we need to have proper authentication credentials in order to send access remoting credentials.

11:15.280 --> 11:19.560
So we do have an RCA vulnerability however it is not pre-auth.

11:19.560 --> 11:23.260
It has some pre-shared knowledge that we need to know which is the credentials.

11:23.400 --> 11:25.760
However let's see how it's still exploitable.

11:25.900 --> 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.

11:31.740 --> 11:35.600
All we need to do is pass along the MTLM challenge and response.

11:35.600 --> 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.

11:44.960 --> 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.

11:55.720 --> 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.

12:12.780 --> 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.

12:21.460 --> 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.

12:30.060 --> 12:33.500
However once we control the server we can do more.

12:33.500 --> 12:39.080
You see we can actually execute code on the cameras themselves using legitimate features.

12:39.300 --> 12:44.920
So in order to allow modularity for system administrators access supports what's called packages.

12:44.920 --> 12:48.200
Essentially allowing you to change your camera's behavior.

12:48.240 --> 12:53.280
Of course access has their own packages however they allow anyone to create their package.

12:53.280 --> 12:58.260
All you need to do is use the access ACAP SDK and you can build your own package.

12:58.260 --> 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.

13:14.600 --> 13:19.420
Meaning we add the app, we run it and we also have code execution on the server.

13:19.440 --> 13:22.840
Meaning at this point we basically executed code everywhere.

13:22.840 --> 13:26.740
We executed code on the client, the server and the cameras themselves.

13:27.240 --> 13:29.720
However, that's not good enough.

13:29.720 --> 13:36.220
Because like I've told you at the beginning I want to have full remote code execution pre-authenticated.

13:36.460 --> 13:39.440
And at this point I need to have a man in the middle set up.

13:39.440 --> 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.

13:47.200 --> 13:51.140
This is not full remote code execution and this is our goal.

13:51.140 --> 13:53.640
So let's see how we can actually exploit it.

13:53.800 --> 13:57.460
So after a lot of time I've actually reached a dead end.

13:57.460 --> 14:01.680
I could not bypass the authentication on the access remoting protocol.

14:01.880 --> 14:09.040
Simply because it was immediately requiring us to pass the NTLM challenge response upon socket creation.

14:09.040 --> 14:18.060
However, luckily after sometimes consulting with the documentation of access I discovered this tidbit of information which is a fallback protocol.

14:18.060 --> 14:25.280
When the main TCP port is not accessible by the client there is a fallback protocol using a different port.

14:25.280 --> 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.

14:33.900 --> 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.

14:42.660 --> 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.

14:50.980 --> 14:55.900
Nothing was presented to me, I was not able to use it, something was weird.

14:55.900 --> 15:02.140
And at this point I realized that this is not regular HTTP and something weirder is going on behind the scenes.

15:02.140 --> 15:06.640
So I began reverse engineering this proprietary fallback protocol.

15:06.940 --> 15:12.600
And this is how it essentially looks like and it does use HTTP however only vaguely.

15:12.600 --> 15:19.720
The first thing a client does is it connects to the access server and you're sending an HTTP get request.

15:19.720 --> 15:22.720
And the server responds with a channel ID.

15:22.880 --> 15:31.060
Now this initial connection must be kept alive for the throughout of the communication as it will be used later.

15:31.220 --> 15:38.080
Then the client creates a new connection on a new socket using the get slash channel ID it just received.

15:38.140 --> 15:44.600
And we now have two channels, two communication streams that enable us to communicate with the server.

15:44.620 --> 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.

15:54.660 --> 16:03.340
After we have these two channels each side now begins the key exchange.

16:03.340 --> 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.

16:16.560 --> 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.

16:31.180 --> 16:33.160
Now at this point I was like why?

16:33.160 --> 16:35.320
Why have such a complicated protocol?

16:35.320 --> 16:39.400
Why use this weird protocol over HTTP?

16:39.400 --> 16:44.140
Because essentially they created sockets over HTTP.

16:44.140 --> 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.

16:51.700 --> 16:58.560
However they do use both symmetric and asymmetric communication so the question is, is it more secure?

16:58.560 --> 17:00.900
Because they are using encryption, maybe it is.

17:00.900 --> 17:02.640
And the sad truth is no.

17:02.640 --> 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.

17:14.860 --> 17:23.160
Meaning if we bypass the auth we still are able to execute our code using the deserialization vulnerability we discovered before.

17:24.080 --> 17:28.180
And next my goal was to try and see how we can actually bypass the auth.

17:28.180 --> 17:33.780
And to do that I've went and noticed what kind of authentication schemas this server supports.

17:33.780 --> 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.

17:40.980 --> 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.

18:01.380 --> 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.

18:15.200 --> 18:18.540
Meaning we don't need to authenticate and we are able to use it.

18:18.540 --> 18:19.980
So let's see our game plan.

18:19.980 --> 18:27.380
First we use the slash underscore slash secret path and this way we are able to start communicating in access remotely.

18:27.380 --> 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.

18:34.540 --> 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.

18:46.660 --> 18:48.220
Super duper cool.

18:48.220 --> 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.

19:00.080 --> 19:00.420
Amazing right?

19:00.440 --> 19:05.600
So we have pre-auth RCE but let's see what kind of effect we've actually managed to gain.

19:06.200 --> 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.

19:21.940 --> 19:28.600
Now we need to remember this server manages up to 10,000 cameras meaning the effect is actually quite vast.

19:28.600 --> 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.

19:38.080 --> 19:43.860
And to do that I remembered that access actually use NTLM SSP to authenticate the users.

19:43.860 --> 19:50.100
And in the NTLM SSP there is the host name and domain like I've just showed you before.

19:50.100 --> 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.

20:02.780 --> 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.

20:14.220 --> 20:16.740
Next I asked myself why?

20:16.740 --> 20:21.120
Why there are so many instances exposed online?

20:21.140 --> 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.

20:31.340 --> 20:35.620
Meaning in the US, in Europe, Chinese based companies are not allowed.

20:35.620 --> 20:39.640
And this leaves users with less and less options to pick from.

20:39.640 --> 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.

20:46.380 --> 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.

20:55.980 --> 20:59.700
And before I'm going to finish I just want to give credit where credit is due.

20:59.700 --> 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.

21:14.160 --> 21:19.480
So credit to them for taking their product security in a responsible manner.

21:19.720 --> 21:21.220
So thank you everyone.

21:21.220 --> 21:21.940
Thank you very much.

21:21.940 --> 21:26.720
I hope you understand the risk with the Extranautic Protocol and thank you.

