Today's presentation, Exploration of Cellular Based IoT Technology. In this particular presentation, in this research that me and Carlotta did, we did not focus on the cellular comms. We focused on figuring out how and what data is going out of cellular comms by doing interchip communication analysis via USB and UART and also how to control the cellular environment and cellular module to do cool things via direct interaction in the circuit board level. There we go. So my name is Daryl Hyland. I'm a research lead at Rapid7 working on IoT technology. And my name is Carlotta Bindner and I'm a lead security researcher at Thermo Fisher Scientific. So I just want to do a quick shout out to a friend of mine, Damian out of France. Some of the stuff that he did at this conference in Paris a number of years ago dealing with circuit board overlay to track out circuit runs at interesting points to tap into the circuit board was kind of cool and I've used it ever since. So let's go ahead and start off with the presentation and turn this over to Carlotta. So while Daryl mentioned that we are focused on the interchip communications, just to give you an idea about the type of technology that's being in use by the cellular devices that we picked, we focused on NB-IoT and LTE-M devices. These two protocols in particular have been developed specifically towards IoT there and we're going to step quickly through these two. Oh, there we go. So NB-IoT is also known as narrow band IoT. As you can see on the download and upload speeds, it's relatively low. It also only supports half duplex communication. This is intended because instead of using the high bandwidth that would cost a lot of money and also power, it's geared towards the IoT devices that are going to be deployed remotely or battery powered. I got to point it in the right direction. And then we have LTE-M which is machine type communication. Again, it has slightly higher speeds available than NB-IoT and supports full duplex communication. So this is best used in cases where like we're going to be transferring large amounts of data like video, audio, as opposed to NB-IoT which is popular for like sensors where the small amounts of data are being transferred. Now, the original NB-IoT and LTE-M were released in release 14 from the three GPP. And in consecutive releases, they've done things to improve the efficiency to help extend battery life. The original release only supported 4G so they've added 5G support. And then they've added small cell support which is these are small cellular nodes that would be deployed in a sort of mesh type network that allows for high bandwidth via like volume deployment. And now I'll hand it over to Daryl for interaction with hardware. Okay, I'll take a clicker. So when we're getting ready to engage cellular based technology, the actual hardware, Damian had demonstrated this at Hack in Paris. And what we want to do is we want to figure out how to interact in circuit. And often tracing out the key components, key locations, whether it's runs, circuit runs, various ways we can tap into the communications on the device, we think about it actually doing overlay. So we take images of both sides, reverse one of them and overlay it on the device. So that we can actually see all the components at the same time. It's really helpful for understanding at least the external layers of an actual circuit board. And then when we get into the cellular modules, the ability to overlay the cellular module in the orientation of the land grid arrays and we can see the land grid array structure. In this land grid array structure we can see the areas that are yellow and kind of coral color are kind of the key areas we want to see. The serial comms, the USB comms. And by doing that it gives us the ability to start thinking of where are the most likely points of access for these devices. Versus just randomly checking everything around the board, trying to figure out where it's at. By figuring the orientation on the circuit board, we can be more logical in our efforts to identify where to hook to everything. And also notice that as I mentioned the yellow and the actual coral color, the items of the most interest are always out around the outer edge. And how does that play out? So here is a circuit, a cellular module that's been pulled off. In this particular case we can see everything running around the outer edge. All the stuff that's inside is typically ground planes are not connected in almost every case. So what happens when we engage a device where there's nothing on the surface of the board and they've managed to route all the most critical communication underneath a sub layer in the circuit board? So I started playing around with that idea. How would we look at this? So what we did is we noticed on a lot of these cellular modules, if we turn it on the edge and magnify it, we kind of quickly see, we can see up underneath the edge of it. We can see some of the land grid arrays. So what we did was we went out and bought acupuncture needles. And using acupuncture needles, we literally inserted them underneath the edge of the chip to engage the communications that we're after. Making it possible for us to not need to actually chip off or cut through the layers of the board or other things in that particular case. And it came to be very effective. Now it doesn't necessarily work on all modules. This particular module, the critical connection points are only about a quarter millimeter or half a millimeter from the edge of the actual cellular module device. Some of the larger modules we found out it was three or four millimeters up underneath the edge, which is really not that far. But the problem is the larger the module, it has a tendency to have more of a cupping effect. So it closes down that edge so you can't always get to it. So if you're going to look at a cellular module on a board and you're thinking about needing to do this, just roll it up on edge. Is there a gap there? If there's any gap between that cellular module's board and the circuit board you're looking at, use acupuncture needles. Now also note acupuncture needles, you can't solder to them. They're stainless. So, uh, I found out that you can get some good crimp, crimping units and, and, and butt connectors and connect them up pretty good so they will be electrically sound. So we're going to go ahead and move on to AT commands Carlotta's going to talk about. So now that you have, if you have hardware access to the cellular module, how do you communicate it with, with it? Uh, cellular modules you, much like many other modems use AT commands. So AT commands were originally created for the HACE 300 modem back in the 1980s. And as technology, you know, continued to advance dial up and cellular, they continue to use AT commands. AT stands for attention and these commands are used for the debugging configuration of the modem, you know, making it connect up to the cellular network. When looking at AT commands, there are sort of four categories of how you can use AT commands. First there's the test command. The test command is sort of like a help menu for an AT command. You issue an AT test command to, with a equals and a question mark. And the cellular modem will respond with the parameters and the values that you can then submit to the cellular module to run the command. Then you have the read command. Uh, the read command will actually return the current values and the configurations if you, for that particular command, if you were to issue it to the cellular module. Uh, then you have write commands. These are how you actually perform configurations after learning how to, you know, use the te- using the test command on that AT command. And finally you have execute which would be to actually cause the, uh, cellular module to perform some sort of action. Now, during our research, we reviewed various different modules from different manufacturers and most manufacturers actually release AT command manuals specific to the act- the version of cellular module that you're using, uh, for development purposes and configuration. Um, in the ma- manuals, we, uh, notice that a lot of the different manufacturers, they have the sort of standard AT commands that are out there, but then they also have their custom syntax that usually used for configuration of specific features that are available with the module that the manufacturer has, you know, configured. So, what can we do with AT commands? Well, one of the big things at the beginning was just being able to perform information gathering and enumeration against the cellular modules that we had access to. Um, one of the most interesting commands that we did find, and it's a generic one and available on all of the cellular modules that we interacted with, was the AT clock command. And what this does is literally ask the cellular module, what AT commands do you- I have access to? What do you support? Um, although I- we will- I will, uh, circle back to that one in particular. Then, I mean, the AT commands you can get the manufacturer information, the model, the firmware version that the cellular module's running. And just to give you an idea, we have a quick demo on AT commands. There we go. So, we booted up the device, it responded with a ready. And here's that AT clock command. As you can see, it spit out a ton of AT commands that are available with this particular module. So, then you could go start doing- running test versions of those commands to get more information. Then we issued- this particular command returns the IMEI, so just like in your cell phone, there's an IMEI associated with every cellular device. And then the next one was the IMSI, which is used for like authentication up to the APN, billing, location. Um, this command returns the information about what band and channel the device is currently running on. So, it's running on LTE4. And then here's a custom command from QuackTel. And it's used for actually configuring this- the more advanced features available on the device. And one of the things about, like, these more advanced commands, or even just basic commands, especially the custom ones from the manufacturers, the manuals provide so much information about what each of them does and what the responses will be. So, in this case, we're checking if the web services are on when the device boots up and they are not indicated by the 0 at the end of the web services. And then we checked the WLAN services. So, and the 1 indicates that it is on when the device boots up. So, in addition to information gathering, we can also open sockets. Uh, cellular modules support HTTP. They support FTP and various other TCP IP protocols. So, as part of our research, we actually created some scripts to make it easier to get through all the AT commands available. Um, one in particular is the ATquery.py script, which is available on Daryl's GitHub. Um, this particular script allows us to either run a test or a read on a file containing all, a whole list of AT commands. So, we scraped AT command manuals, AT clock output, and combined that and then we're able to actually just iterate quickly through all the various commands to determine, okay, what does the cellular module actually support? Um, because we did find that in some cases, while the AT clock output was there and even the cellular, uh, the manual associated with that module has, you know, AT list, AT commands listed, some of them were not included in either of those resources. So, here's a quick demo of the AT command query script. So, we're going to check and make sure that the device, that we have a FTDID USB device connected, which is then connected to that, uh, it's a field camera. And then in the AT query script, you can actually configure the, you know, the FTDI USB device that's there and the baud rate associated with the, uh, the cellular modem. And our script does, we did add a quick help menu. Uh, you can configure the version, the manufacturer of the cellular module, whether you want to run a read or a test on it. And here we're just confirming that the device is on and ready to go before running the script. Otherwise, you're not going to get anything. And as you can see, it starts outputting the, uh, you know, results to the screen. It also saves it to a file that you could then parse through. In this case, we ran a test, so it's going through the whole list of AT, uh, commands that are in the text file and checking to see which ones are valid. And if you get, you know, an error that it's an invalid command, the, the module doesn't support it and doesn't know what to do with it. So, what types of communications are actually supported by cellular modules? During our research, uh, we found that with the, especially the field camera that we've been using for the demos, uh, it actually primarily used US high, high speed interchip USB to actually perform the AT commands issued. But it still had an active UART. So, these are the two main communication methods that cellular modules are going to use to try and, to be able to take in commands. Um, and in the case of UART, there's usually an external UART used for debugging. Uh, during research we found that the output of that would just indicate sort of the cellular modem booting up, but wouldn't actually take type, any type of input. And then the interchip UART, which would be between the cellular module and a CPU, would actually be the place that you would possibly see, uh, you know, it would be a primary use case for receiving AT commands. But during our research we found that all we saw was on boot up, we'd see a ready, and then during power down there would be a message that it was being powered down. The AT commands were not actually being sent via the UART. And now I'll hand it back to Daryl for USB capture and decoding. Thank you. So, we're still on time, which is good. So, um, the field camera she was talking about is kind of like one of these. Uh, one that you put out in a field to capture, uh, wildlife photos and stuff like that that we were using. Uh, in this particular case. So, one of the things I always wanted to do is, uh, capture, uh, USB. And there's a number of tools out there for capturing USB, but most of those are in line. So I had to start hunting around and try to find one, because what we want to do is sniff USB in circuit. And there's very few devices that do that. So, um, on this particular device, this interchip device, we kind of map out the USB from the actual cell module. We need to figure out where it's at. I've opened up a number of devices that utilize USB and found that, uh, not all of them, but many of them, they actually were bringing the USB to the surface and putting terminator resistors in there. And we got a, got a picture here showing those terminating resistors, impedance matching resistors. Uh, at least that's what they appeared by. I eventually ended up measuring them, found out they were really zero ohm resistors. So they were actually purely as a pass through. So, uh, what we needed to do is to be able to attach into a USB bus, you can rarely connect straight into it. You will actually load the circuit down and communications will fail. With a particular manufacturer of device that we used to sniff this data, they recommended using a 20 to 40 ohm resistor. So in this case, we actually soldered straight to the, to the circuit board a 32, 33 ohm resistors so that we can tap into. And we were able to tap into those devices. And, uh, the device we happened to use was a Beagle, a Beagle 480. It's not a cheap device. It's about $1,200, $1,300. But if you're doing this work professionally, this works really well. It's kind of amazing how well it works for capture and interchip communications for USB. And we can show it here where we actually hook the device up. In this particular case, um, and many, if you're tapping into the USB communication lines, often the power lines associated with that, the 5 volts that tells the, it's fed with the USB also, doesn't show up. It's not on the surface you can connect into. So the black and, and red wires you see there are me just feeding a 5 volt power supply, external power supply. So my Beagle thinks the entire USB is functioning. Uh, there's some software changes you can make that the vendor has to actually turn that off. I have not done that yet. I probably won't in case I ever need it. But let's go ahead and, uh, look at actually capturing USB traffic in this particular case. So, uh, they have their application that comes with it. I know this is small but we're going to kind of blow in or, or, or sink into some of the more critical stuff. Jump over here real quick. So we can see we, we've hooked up, we power up the device, we quickly see a lot of USB handshake data taking place. Uh, and now it's connected out and what we want to do is we configure the device to only show data. Because that's all we care about. I don't care about the USB stuff. So you quickly, you can see in there that you're seeing a lot of those AT commands being transferred. Some of the stuff that Carlotta run, you actually see there as it's setting up the communication channel, uh, with the cellular's APN and all that type of stuff. So again, a lot of interesting serial number data, configuration data, firmware version data that are running on the device. All this kind of data is kind of set out there requested on the device. But we get into, we can see it collected out. That was it's uh, APN that it connected to. It was a special one. It's not a private but it's a special one. So then what we want to do is this device is connecting out and actually communicating real data out. It's taking photos and sending them out. And that's what I wanted to see. So we quickly, uh, search for this whole bucket thing and we start finding things like uh, certificates, keys, passwords. We see this device clear, basically clear text, passwords, keys, everything connecting out to an actual S3 bucket to communicate all this data. With all, everything we ever would need to know as a, uh, a tester, how this thing's connecting out to it's back end systems. Again, as you can see, versus trying to do stuff over cellular, which is encrypted, interchip comms often contains no encrypted data. And you can intercept that data and gain access, uh, a large amount of interesting stuff. I think this screen showed it actually sending out, uh, uh, data actually associated with, uh, the actual, um, configuration on the, on the device. So again, in this particular device, and Carlotte had mentioned this, both of the circuits were in, in use. Both of them were hooked up. Both the USB and the main UART were actually functioning on this or connected up. That's not always the case. Often a device that'll support both USB and all main UART communications often won't have both of them connected up. One of them will be dummied off and the other one's the only one connected in circuit. In those particular cases, in this case, which we'll show a little later, we're able to connect into the UART and control it. I think some of the examples already showed that. Because they still connected it to the main CPU on the device. Which is kind of cool. It made it easier for us. I didn't have to get into weird stuff with, uh, uh, sticking pins up underneath the body of the thing. We're able to just cut the actual circuits that do that type of stuff. So I'm going to turn this over to Carlotta and she's going to talk to us about connecting up and understanding serial communications through interchip and how we interact with that. Okay. So in the case of interchip communications for our cellular module, as I previously mentioned, it's going to be connecting over to a, to the CPU of the device. And in the case of this trail camera, it was using an EG91, which we have here. The thing is, for the actual UART communications, there's two separate lines going. So the, the, there's one line where the CPU is transmitting and then the, uh, cellular module is receiving. And then the cellular module is receiving on a separate line from the, the responses from that cellular module. So in order to actually get a full picture of the communications that are going between these two devices, we need two FTDI to USB devices. One receiving on one line and one on the other to get a full picture of the communications. Now this is only to be able to listen in on those communications and that's how we saw the, you know, when on power up that the cellular module was sending a ready and then on power down it was sending a power down. Now in order to actually be able to inject those AT commands like you saw in the AT query script, uh, demo that was run and everything, uh, we actually have to sever those connections between the CPU and the, that cellular module and put ourself pretty much in the place of the CPU. So we'd not, we'd only need one FTDI to USB device in this case and just like regular UR, you'd hook up the transmit to the receive on the cellular module and then the FTDI is received to the transmit on the cellular module. So here is, you know, three images here. On the far left we've identified that transmit and receive for the cellular module and the line that's going between it and the CPU. In the center there we've actually soldered wires to two different sides because on that far right image we've actually cut the traces between the two. Now in order to be able to continue to be able to listen in possibly on the communications we built a breakout board. So the side that's connected to the CPU is connected to the breakout board as is the side that we have the cellular module. So they can continue to function as normal. As long as, in the center there you can see that there are toggle switches. If they're in the on position the communications can continue between those two parts fine. But we can then turn them off and then connect to just one of the FTDI devices as you can see in the image and then issue those AT commands to the cellular module. And I will hand it back over to Daryl to talk about injected targeted attacks. Okay. To kind of mention a little bit on something else to add to the serial communication. We also, I also a couple years ago released a paper on interchip communication analysis and we released a proof of concept code called a Karen proxy. Now it wouldn't work in this case because we haven't set it up to handle ASCII but when we're dealing with devices where there's no ASCII data but just hex data going over, a Karen proxy would give us the ability to cut the circuit, throw the switches and route both sides back into a Python code script that would actually capture data going in both directions, allow you to replay data, capture and replay data and also capture and replay data and actually set filters to say when you see this hex string, replace it this one. Still a proof of concept, we can probably use some more development but it, it takes this to a new level and I was just talking to the guy this last week about let's add the ability to throw ASCII in there, use standard carriage return structures which is often what we see when we're talking about communication over the main AT or the main UART communication to cellular modules. So, in this part here, AT commands, so we wanted to start thinking about what can we do here? So we've, we've, we've looked at these devices, we can capture all the USB communications, which is a wealth of information if you're doing any kind of assessment or testing on a device and then we can actually send AT commands but what can we do? Again, we're still in the early stage of this but I have an example in here of something I thought was kind of cool as proving the potential capability but I want to start talking about this is how we've tapped into this device. So we have the device here. It's a trail camera. USB is what it uses primarily for all of its communication. The serial communication between the primary processor is in use so who cares if it's connected to the CPU? So we cut it and we hook up to it that way so we can pretty much send commands at will while the device is powered up. Again, I don't think if you remember one of the videos earlier, you've seen power down. Like any of these devices, they're not going to stay powered up. So they'll stay powered up for a certain period of time and then they'll do a time cycle. And they'll actually shut down the conserved batteries. So when you're testing them, you kind of have to deal with the fact that it's doing this. But with AT commands, potentially you can shut all that functionality off, especially if you're feeding an external power supply versus batteries into it. So that's how we tapped into it. So one of the things we wanted to do is, this particular module, as Carlotta had mentioned, when we pulled down all the AT commands that are available, looked AT command manuals, it didn't really show anything about socket capability. But when we run our test script against it, we found out socket capability was available. In this particular case, it's QI open and QI closed, where we can actually set up real sockets. In the first one there, we show that we connected out to a port over an IP and it actually failed and it came back with, what is that number, I think it's 566, and basically says the socket's not open. I think this actually shows that at the bottom it came back with a zero on that particular port. So we start thinking about this, hey, what can we do with that? One, with these sockets you can do a lot of things, but what if we wanted to do like a port scan? You know, can we use the device to port scan some of the back end stuff? And here's all of the ATQI open error messages that come back. So we get a wealth of information based on this information, whether the socket's available, it's open, it's closed, or some other error. When I was initially working for this, I got some of the command structure backwards, so I was throwing all kinds of weird errors. I'm like, why ain't this thing working? Finally figured it out after I sat down with a manual that talked about QI open, got the structure right, and we kind of moved on from there. So here's the actual code that we're going to show here in a minute. It's a simple Python script. This is actually on our GitHub also, so if you want to play around with it. The yellow stuff is kind of the important stuff. So basically we can set up the USB port that we want to connect through for the TLL. And then we can go into the IP addresses, port numbers, and the bottom is open, close the circuit. So let's open and close the socket and see what happens. So let's go ahead and run a quick demo. So again, this demo is not pointed to anyone's back end system. We're doing it as a proof of concept. So I pointed at InMaps, InMaps server, the one they allow you to run scans with, with InMap. So I wouldn't like to make anyone mad. And let's go ahead and run this. So we turn the device on. First thing we want to do, let's make sure that it's actually up and ready. Make sure I have all my connections right. Turn the unit on. See my grubby little fingers there? We got it ready. So now we can run the command. And initially this thing is going to go out and we can literally point it at any IP address, any number of ports, any number of IP addresses, and instantly it starts returning data. So we'll see a 00 come back. That port is open. We have 0 5 6 6 come back. That port is closed. So from here we're actually able to do port scans to this device. I think there's a wealth of more things we could do where we can actually control these cellular modules to do some of this stuff. And let's go ahead and let it finish running. I think that's pretty straight forward what we got there. Ramp G, do port scans. I think 1337 I think is open or something like that. So a couple of the, you know, the weird ports, a couple of common ports. But now we've done a port scan. We've basically taken a trail camera. And while this is taking place, we did not alter the trail camera's function. It contended communicating out to the S3 bucket functioning normal. We just asked it to do a port scan using its socket capability. And we were successful in doing that. So where's this come into play? So if I'm doing, if I'm going to be assessing a target for a company that uses cellular backhaul for its communications, and let's say they're using a private APN. That private APN goes out. It goes through a VPN. It hits either some closed cloud service or it hits their actual internal company network through this VPN. And no one on the Internet has access to it. So no matter what data you get, you can't attack those back-end systems or test the overall ecosystem of the technology. But if we engage the device itself with what we showed here, it gives us the ability to actually go through that tunnel that's already been set up by the device through the private APN to the back-end services. And initially we can do a port scan on devices back there. Next we can actually, once we have those ports, we can set up sockets and start communicating to those devices in the area that is supposed to be trusted or secured, because we're looking at companies that are looking at security purely from a machine-to-machine environment in a closed back-end, which they would think would be secure. In this case, we can actually prove that's not the case. We can use the device, control the device, and set up our own connections and own tunnels to the back-end. So the first image is what we conceive of a private APN. The second one is more of a public APN. And that's kind of where this device was. So it kind of allowed us to actually go out and port scan and map in this case. But I have run into a number of devices that were on private APNs where we could not get access. And it's kind of the driving force around this research. How do we build out a knowledge base so pen testers, IOT testers, can go to that next level and look at the overall ecosystem effectively? And interchip communication and control is the best way to get there in my opinion. And I'm hopeful we got that over to you guys and you were able to get something out of this. Here is the actual data. So that's the GitHub and stuff like that that you can actually get to. A couple papers. We actually published a paper last week on this subject. So bring it down and check it out. We talk about a lot more in that paper. At least from the subject of engaging interactively on the hardware and how to trace things out effectively. We get into dechipping, taking chips off and actually rerouting circuits on the board and then putting the cellular modules back on, things like that. So we cover a lot of other cool stuff. So check out that paper. So I don't know if we have time for questions. We're probably out. But we're going to be around. So grab us when we get packed up off stage and I'd be glad to talk about more things with you. Thank you.