Welcome everyone. Thank you for coming to this talk. We are going to talk about six low-pan networks and more precisely how to do penetration testing on that type of networks. As you are going to understand the hard part is not to do the actual penetration tests but to reach the point where you are able to do the tests. So a little bit of context. We are both security auditors from Airbus Defence and Space. We are working internally to do security audit and penetration testing within the Airbus group. But we also work with other companies to help them improve their security. So there's a picture of the one particular audit that will be the test. The actual subject of this talk. That was water monitoring systems and we did penetration testing on it. We are going to present to you the methodology, the tool we developed to do the test. We actually also are releasing the tool here and we are also going to give you the results of this penetration test. So this network was relying on the six low-pan protocols. So what is the six low-pan protocol? Basically it is ipv6 stretched and compressed and turned apart in order to make it fit over the air. To have less lesson network footprint. I think here we are talking about smart grid. That means we want to have low-energy infrastructure, low-energy protocol. IPv6 is anything but low energy, just one address is 128 bytes. You have two addresses, a source address and a destination address. This is a lot of information compared to the information that will be broadcasted by a metering infrastructure, think sensor, that broadcasts their information. So, how does the SIGSLOPAN network actually do the compressing? That's quite simple. They have a SIGSLOPAN header on top of the IPv6 header with a lot of flags, and these flags just basically tell you how to decompress the IPv6 header. For example, you have a flag to say that the first 64 bytes of IPv6 are decompressed. The first 64 bytes of the IP address is the bytes from the MAC address. In fact, it's the IID address, but that's the equivalent, that's the MAC address. And so on. You have plenty of flags. You have flags, for example, for the TTL with predefined value. You cannot set the TTL precisely, you only have a few predefined values to choose from. You can also use flags to say that you are omitting a complete field, because you do not need that field. You can also use context. Context are pre-shared information, and you have indexes, and so you just provide the index of the pre-shared information, and the device will just fill the blanks with this pre-shared information. Usually, in the context of metering infrastructure, you are broadcasting information, and if you miss one information, it's gone. If you miss one information, that's not critical, you have more information coming constantly. So you don't need to be sure that you get all the information, so you don't need a connected protocol. Meaning, I mean, you don't need TCP. So usually we find UDP on top of 6-LOPAN. That's why the 6-LOPAN standard also specifies how to compress the UDP header, pretty much like it does with the IPv6 header. Keep in mind also that you have the... I'm sorry. A short maximum transmission unit, only 127 bytes compared to the 1500 bytes, so the 6-LOPAN protocol also specifies how to fragment and defragment IPv6 packets to 6-LOPAN packets. So what's the big deal? You know IPv6 is part of... It's an IP protocol. There are a number of... already a lot of tools to interact with ipv6 usually when you do partition testing you do not directly target the ipv stack you more usually you are more about the targeting the higher layer protocol tcp http so again there's nothing new here you can just use the existing tool the existing methodology so why not just why not just use an usb adapter just like you would do with wi-fi just buy a six open usb adapter plug into your computer and start doing the plantation test well that would be too easy the under layer under the the cyclopan protocol so i mean the physical layer and the mac sub layer is handled by the 15.4 protocol and this is where things get complicated you have really a lot of possible configuration with 15.4 for example you can set up the network topology as a mesh network when every end device can communicate with each other or as a star network where end device must only send information to coordinators but how to send this information well you have also two type of transmission you have the direct transmission when one node will just send the information you have the indirect transmission when the node is going to first say that he has information pending and wait for the receiving node to say okay you can send information you can use gtses guaranteeing time slots it's it's a system to allow time slot to eat to each device to make sure that there's no collision this is something that is optional you know do not need necessarily to use gtses use beacons. Beacons in six open networks, I mean in 15.4 networks, not only are beaconing the network, but they also can host a lot of information if you want to. So you can see here that if you combine multiple choice, you can have really several possible configurations. But that's not all. You also have to think about security. Encryption security is provided by the MAC layer. And there again, you have multiple choices. You can only protect integrity. You can only protect confidentiality. Or you can protect both. You can choose different type of key, I mean size of key, 32, 64, or 128. So again, more choice, so more possibilities if you make more combination with the previous possibilities I've exposed. And of course, you have multiple revision of the standards. You have the 2003 standard, which specifies type of encryption, which is incompatible with the encryption specified by the 2006 standard. And the 2006 standard is using the same encryption as the 2011, but the key management system is a little bit different. So again, more combinations are possible. At that point, you should see that, in order to connect, to use the IPv6 tools, so to connect to six low-pass networks, you must first understand all the, precisely, the configuration of the underlying 15.4 infrastructure. And this is really the hard part. Because you have to guess. You have to brute force. If you're working with the customer that they ask you to do the penetration test, you can ask, for the information. But usually, it does not have the information. You rely on the supplier to do the infrastructure. And if you ask the supplier, he might say that this is intellectual property. It does not want to share this information with you. You might want to directly get the information yourself by taking apart the sensor, for example. But if the sensor is embedded in a water pipe, that's quite difficult. Just to illustrate. To illustrate this, here are the list of possible encryption options on the 2003 standards. Here from the 2006, so you can see they are different. But one additional difficulty is that in the 2006 version of the frame former, you have three bytes, three bits, sorry, three bits, to specify the encryption you used. But that is not the case with the 2003 version of the standard. You have to know beforehand to guess the version of the, the choice you made for encryption. And of course, that is not all. Usually when a supplier is building an infrastructure, 15.4 or something else, it will be, this supplier will be the one to build everything, the sensors, the coordinators, the border routers that connect the smart grid to the IT infrastructure. That means that if the, the supplier makes a mistake while implementing the, the norm, usually this mistake will stay unnoticed for long. By that, I mean that if the mistake does not induce failure or performance losses, since every component of the network has this deviation from the standard, no one will even notice it for long. We have one good example of this. Well actually we have many. But this one we can't do, but actually we have, well, this one we can do, but this on, we can do. publicly talk about it because the component is publicly available to anyone. That is the XB-S1 chip from DG, who is using the 2003 version of the frame format, but the 2006 security suite for encryption. This chip has been around since 2010, 2009, and nowhere on the internet we can find mention of this. Actually, we did get to talk with a DG engineer, and they realized this deviation by talking to us. So really, when I say that they can stay unnoticed and it's quite easy to accrue to them when you're doing audits, that's really true. That is why we started the RCN project that stands for Advanced Routing Between Six Low Paths. And the very idea of this project was to build two distinct tools. The first one was about a scanner that could detect every possible option from a 15.4 network, including deviations. And, then, from all this information, this information would be provided to another tool, a border router, that would be able to translate IPv6 data grid resolution manufacturers into RAM to 6 low-point frames, and vice versa, while using all the information provided by the scanner. This tool is based on another tool we've released two years ago. That is SCAPI radio, which basically is SCAPI, a famous and very powerful packet manipulator, combined with GNU radio, a software-defined radio framework that allows us to work with any kind of radio communication protocol. So I said we have two main components in this project. The first one is very simple. I mean, it's the way it works. It simply builds a database of all devices that you can see by analyzing what SCAPI radio is sniffing on the 15.4 network, and analyze this information to infer everything. Everything you can, actually. Which device are running on which channel? Which device are communicating with each other? What type of frame they are communicating? What are the parameters? By that, I mean also encryption parameters that are used to transmit these frames. On the other end, the six low-point border router, using this information from the scanner, creates a tuned interface. So it's not a tap interface, so actually we don't need it. We don't need Ethernet anymore. And basically, it's a SCAPI automaton that will translate every data grant received on the tuned interface into one or multiple six low-point frames, and translate while defragmenting any six low-point frames to an APV6 frame, and send it to the tuned interface. We had to modify SCAPI audio, actually, to achieve this. this. First, there were existing 15.4 layers and six open layers. As for the 15.4 layers, we fixed several bugs, but we also implemented both 2003 and 2006 encryption methods. And we'll see later, we also implemented encryption not based on a key, an encryption key, but then based on a key stream provided by the user. This is related to a cryptographic attack that Arnaud is going to present in a few slides. As for the six open, basically we implemented everything, mostly everything from the norm, almost rewriting from scratch. As far as we know from our tests, everything is implemented except from the indexes. Like I said, it's possible to work with context. The six open frame will provide indexes to know which context to pull out when the end device receives the frame. There's no way to know this context over the years. This is not something we have implemented so far, but apart from that, everything else has been implemented. Okay. So now let's talk about security attacks. So we will not focus on attacks on availability, because since we are talking about wireless, you can simply use a jammer and do a denial of service. So there is no big point to find another way to attack availability, because it's a simple route. We will mostly focus on confidentiality and integrity. And since we are talking about sensor for water management, for example, the critical point is integrity, because in fact confidentiality is not that much important at this level. But still. So for confidentiality, we'll talk about semblance attacks, and for integrity, we'll talk about replay attacks and malleability attacks. So a few words on IES and CTR mode. So as Jonathan showed you, it's one of the modules for encryption, and the most interesting one, we think. And what I will say is also true for CCM, so encryption and authentication. So why CTR mode? It's because if we use IES in CBC mode, it will do a block encryption, and since we are using short packets, I mean, shorter than the size of the IRS block output, we will have to do a lot of padding, and transmitting padding over the air is the rest of efficiency and energy. So we use stream encryption, which is CTR mode. So one main point of stream encryption is we are using the kstream, which is the output of the block ciphering, and we XOR it with the plaintext to have the ciphertext. One main concern with that, if we have several packets with the same kstream, we can do some crypto analysis. So each packet should have a different nonce, a different kstream, and if we see, it's meant to a different nonce. Since the counter is an IRS counter, so it's predictable, and the k is of course constant. So the nonce is a value that will change between packets and avoid the possibility to do some crypto analysis with the loft of packet with the same kstream. So now the nonce on 15.4 is based on the source XID, so it's something we can find, and frame counter. So in order to do our attack, we will need nonce. So in order to do our attack, we will need nonce. So in order to do our attack, we will need nonce. So the same nonce attacks. So basically having a large number of frame with the same kstream and so the same nonce, that will allow us to do our crypto analysis. So the replay attack is something really basic, you resend the packets that you have recorded, but you need to send it with the good counter value, because you have a frame counter. And the malleability attack is basically the two precedents together. so we need to know a case stream to craft our packet, and we need to know the value of the frame counter. Okay, so now time to do some pen tests. So we know how security works, we have the tools that Genta introduced, and we have some guess on how we can attack it. So this is a wireless network using water distribution, so we are working on it. And obviously the first step of the pen test is like an IT pen test, we try to find as much information as possible. So we scan all channel first, 15.4, and we find that there is communication on channel 18, that each sensor is communicate only with the band coordinator, which makes sense, because if we have sensors, they are only broadcasting information. So it's a start topology. And the band is only transmitting beacon frame. So we can also see on the screen, it's a capture of the tools on the right side. We can see that the frame version is a 2006 stand out, and security is used in CTR mode. And we have also the short address of the band and sensor, but we will need the long address, as we have seen it's used for the nuts. So we need the long address. So. We know that the long address is the extended or long address, the same, is transmitting when the sensor is associating with the pan. So basically, we need to force a new association. This is something you can find on a lot of attacks on wireless network. So how to do that? So we try to float the sensor. So send a lot of frame and random frame to the sensor. So the sensor cannot track the pan, the beacon frame from the pan because the channel is full. And since the sensor is not receiving anymore any beacon frame, it will lose its synchronization. And if we stop floating, it will resynchronize and so send its extended address. So we got it. The next step, and the simplest one, we want to add our fake sensor to the network. So basically, there is no secure function. So during the association process, we do not find any higher layer authentication system and there is no filter on the address. We can use an address as we want. So it's basically straightforward. But we are able to connect our sensor, but we are not able to send frame because we cannot encrypt frame. We do not know the key. So as we said previously, our main goal is to manage this frame counter. So to predict its value. So the simplest way is to reset it. So we know it's zero. So we have some thinking about that. How can we reset this frame counter? And maybe its value is never stored in the non-volatile memory. So if we reboot the sensor, it resets to zero. So we want to reboot the sensor remotely. Obviously, we don't want to go and check the button. We want to do it remotely. So what we did is we fluid the pan on each channel. So again, we broadcast a lot of frame. And the sensor will start looking up for a new pan, a new coordinator on every channel. And if they do not find any pan after a time, they will reboot. So we know how to reboot the sensor. So now we have to reboot the coordinator. So we use something the same way. We flood the pan. So the sensor cannot connect to the pan because we are flooding the channel. Only one channel. And we use a fake pan. So basically our tools set up on another channel. And we wait for the sensor to connect. So we have to spoof the pan address. But we know it. So there is no challenge. And when the pan does not receive any answer for the sensor, the pan reboots. So now we know how to reboot the pan coordinator. We know how to reboot the sensor. We know that when they reboot, the frame counter is reset. So what we do is we can get encrypted packets with the same nodes. We reboot the sensor. We record frame. So we know that the frame counter is starting to zero. We do that again and again and again. And we will need a lot of data. But it's wireless. So we have plenty of time to record, reset, record. And after that, we do some cryptography. We do some crystal analysis. And to guess the plain text. Obviously if you have some inside of the plain text, it's easier. For example, if we know that we are talking about sensor, water sensor, we can think that the value will not change really fast. And it's the kind of thing that can help on the crystal analysis. So we are also able to do replay attacks. Since we can manage the frame counter, we can replay a packet with the same counter value. And we start attacking integrity. And it's quite interesting. But of course what we want is crafting and injecting our frame. But we have in fact everything we need. Because from the same attack, we know the plain text. And if we know the plain text and the ciphertext, of course, we can have the case stream. And with the case stream and knowing the value of the counter, again, we can reset it. We can craft our packet, our encrypted packet, and send it with our fake sensor. And so we can send any value we want on the pan, and integrity is not anymore. So as Arnaud just showed you, we started from scratch. We had no information, because like I said previously, the sensors were buried in pipe. So we could not have any information, at least the way we worked. And we ended up being able to craft an encrypted packet. So that means that we had all we needed to feed it to our border router to be able to route IPv6 frame from six low-pound frames. And thus, we were at home. We could use Nmap. We could use whatever we wanted. So we're not talking about the rest, because this is nothing new. We're actually doing Nmap and stuff. But really, the hard part is to get from the we-know-nothing-about-the-network to where we are able to craft IPv6, to forward IPv6 packets to the six low-pound networks. The reason we were able to do so is because the supplier did four big mistakes that are very common. First, let me say that the usual way to work on that, the encryption aspect, is to find a GTAG, a BDM, or something to extract the firmware, and from that firmware to extract the key. But since we were not able to do that, we had to work at the encryption level. So the mistakes made by the supplier was first to think that encryption protects integrity. If you don't have the key, you cannot forge packets. That is not true. Integrity code, MIC or MAC, are there to protect integrity. Encryption only protects confidentiality. And actually, in a sensor network, confidentiality is not that important. Integrity and availability are the two aspects that are very important. One of the mistakes was to... I wish you to have them in the right order. Okay. So, now let's talk about non-volatile memory. Usually, when you have counters to prevent replay attacks, these counters are only kept in memory, and they are never stored in non-volatile memory. That means that if you are able to reboot a device, you reset the counters, and you have replay attacks. And if you have not used cryptography properly, you have both replay attacks and semlongs attack, and then you can have malleability attack, for encrypted frame without having the key. And rebooting devices actually are not that hard, because with sensor network, the main consideration is always availability. And rebooting is always the last resort when they don't understand why the coordinator does not receive any information, why the sensors are not able to synchronize with the coordinator. Whenever something happens, they try many things, but at some point, the last resort is always to reboot. So, if you play with the network, at some point, we force a reboot, and it will force a lot of things, like association procedure, like resetting of the counters, and so on. So, obviously, we didn't break the water pipes with us, but we have a little demonstration here. So, we... Sorry, what? So, remember, I said that the deviation are possible, so... So, we set up Arduinos, simple Arduinos, with the XB chip I told earlier that is not... that is not... that is not... that is not compliant with the standard. And we set up the Arsene tool with the Scape Radio and the USRP to do the SDR part. And if you switch to the next slide, you can see that this is... I can do actually this with my computer right now. I don't know if I can plug the VGA cable too far. Okay, yeah. I have to move all that. Okay. Let's say if you have questions, don't hesitate to come here, and we will show you the demonstration. But basically, if you can see, I do ping, I do Nmap, I do Ternet, and I'll do all this for my computer. That computer has no idea it's talking to six local networks. The border router, with all the information provided by the scanner, is doing the job, so I can pretty much do standard penetration tested... standard penetration testing on this component without having to take care of the six local and the 15.4 parts of the network. And that's it for the presentation. I thank you. If you have any questions... And if you want to see the demo closer, please come. We have some time, I think, so you can see it.