Good morning, everyone. So this is Joseph. He's got a rather interesting gear here. And it's going to work, too. I know that. With that, it's Joseph. Hi, guys. So thank you for joining to this talk. I really hope that you guys will enjoy it. So what I'm going to talk about is this research and how I broke this wing OS. What I'm going to do is to discuss about some interaction about this wing OS thing is. Then we'll discuss some scenarios and attack surface that we have with this OS and the devices. Then I will describe with full technical details some critical vulnerabilities. And then I'll try to describe some critical vulnerabilities. And then I'll try to describe some critical vulnerabilities. And then I'll try to make a demo with these two devices with an exploit that I did trying to exploit one of the vulnerabilities. And then after that, we will discuss some conclusions. So what the hell is this wing OS? So basically it's an embedded Linux operating system with its own proprietary stuff in the kernel. Like they have their own proprietary drivers. They have their own proprietary socket address family and stuff like that. So originally it was created by Motorola. But now it's property of extreme networks. We'll discuss about it in a couple of minutes. Then the architecture is MIPS N32. At least the devices that I've been working with during this research were MIPS N32. Mainly it's used for wireless access points and wireless controllers. And as far as I know, there is no public information or previous research and reported vulnerabilities about this OS. As far as I know, at least. So from extreme networks' website, we can get some high-level details about this OS. Like, for instance, here it's saying that it's for WLAN architectures and it's designed to scale efficiently from the smallest networks to large geographically dispersed deployments and stuff like that. So that's a little bit about the OS. And then I'll give you a little bit of a little bit more about the OS. So from the website you can get more or less an idea and high-level details of this OS. So we have a web interface, a typical web interface where we can set a lot of stuff. I mean, the web interface is huge. And it also has vulnerabilities. But I didn't want to focus this research about web vulnerabilities. So we won't discuss web vulnerabilities during this talk. But also we have the typical interface similar to the Cisco IOS where you can, I mean, you have, like, different type of commands and combinations of commands where you can set the device. And this interface is restricted, meaning that from here you can't access to the operating system, the Linux operating system that it's running in the background. So, devices using this wing-on system, OS. So I didn't get an official list of devices affected. But based on public information, for instance, from extreme networks website, we can see a list of WIIN access points and controllers that uses this operating system. But as this is not official, this list could be even bigger in the case of extreme networks. But also we have Motorola devices and Zebra devices. Because as I said, Motorola created this OS. So they have also their devices with this OS. And then Zebra bought this part of the business from Motorola. And that's why we also have Zebra devices with this OS. And then at the end extreme networks bought this part of the business from Zebra. So basically that's why we have Motorola access points, Motorola controllers, Zebra devices and extreme networks devices. Running this operating system. And also we got the control device. So this particular one is important because all this research started because of this. This, well, control is a company that makes embedded devices for different industries, such as the aircraft industry and the train industry and stuff like that. So one of my coworkers in IAACTIV, said, hey, guys, here is an interesting technology. I'm going to show you how to use it. So I'm going to show you how to use it. And this is the target. This is an access point that is widely used in aircrafts and by many airlines around the world. So this could be an interesting target for our research project. And then I thought, yeah, this might be fun. And yeah, it ended up being pretty fun. So basically this is a box that it has some special connectors to comply with the aircraft regulations, the aircraft industry regulations. But basically inside we got a lot of the information about that Motorola AP 7131 access point. So where we can find these devices? As we can see, for instance, in this picture from the internet from an aircraft, they are actually installing that Motorola access point at the ceiling of the aircraft. So as I was saying, it's widely used in aircrafts by many airlines around the world. We got some other pictures from the internet where we can see the connections, the connections between the aircraft and the aircraft. box where inside it's that particular motor access point. And yeah, it appears that they're installing these access points at the ceiling of the aircraft. But I don't know if maybe in other types of aircrafts they are installing the access point in other places. I have no idea. So from the extreme networks website and some case studies that we can find on the Internet, we can see that these devices are also used in other different scenarios and industries such as smart buildings, smart cities, health care, government, obviously small and big enterprises networks in a lot of different scenarios. Let's see some examples quickly. This is, for instance, a case study where we can see that the AP7161 and this, the 9500 controller are used in more than 200 subway stations in the U.S. city subway to provide Wi-Fi to the passengers. Then also we got container ports, global electronics manufacturers such as ESOLA in this case and different facilities, universities such as this one. Also, even in mines, this case study from Zebra explains how these devices are used in the Westmoreland coal company in mines. I don't know. I don't know. I don't know if you can see it. So this is from Saigon city in Vietnam where they have more than 1500 access points installed to provide Wi-Fi, casinos, resorts, university in China, another example, hospitals, MWR facilities, case study, even apparently military bases as we can see in this case study. So as you can see in a lot of different scenarios and industries. So for the attack surface and scenarios, I divided two and this is mainly because the aircraft scenario is a little bit different and it has some particularities and the other scenario is basically the rest of the scenarios that we got. So all of this stuff is focused in the remote preauthenticated vulnerabilities that I found and the vulnerabilities that we will discuss later. So first we have the attack surface of the ethnic cable, meaning like if the attacker has physical access to the access point, he can just connect the cable to the device, to any port or to an administrative port. And then he could, if he can reach the vulnerable UDP service and mean services, then technically the attacker could exploit the issues. Of course in the case of the aircraft, this is less likely. Because if the access points are at the ceiling, I don't know, I think that's unlikely. But I don't know. Still it's a problem. I don't know. I don't know if the possibility. But also these vulnerabilities are technically possible to exploit over the air through the Wi-Fi connection. And also in the aircraft scenario, we got another attack surface, which is pivoting from the satellite model to the access point from the ground. Let me explain this a little bit. So I don't know if you guys are familiar with my co-workers, Ruan Santamarta Research. He recently spoke about this in Blu-ray. He talked about the Black Hat, the last call for SATCOM security. So basically he was able, from the Internet, just using a regular Internet connection, nothing special, to hack and compromise satellite models of aircrafts that are running, that are actually flying on the air. So then based on that, we saw that, based on some information that we saw on the Internet, that the attacker should be able to reach from the satellite model the access point, which is running the wing OS. So this could be another attack surface. And of course, I must say that the safety of the aircraft in these attacks and stuff for the wing OS and everything, the safety of the aircraft is not at risk. It's only the communications. So this is one of the architectures. And this is the satellite model that Ruan compromised. And this is the access point running the wing OS. And these are connected through the SMU server. So we are pretty sure that it should be possible to reach the access point from the satellite model and exploit the wing OS vulnerabilities. Then the other scenarios basically are the rest, like outdoor access points or indoor access points. So again, the other attack surface is, again, if the attacker has physical access to the access point, just connect the Ethernet cable and that's it. And this is more likely in outdoor access points but also possible in indoor access points if the attacker is inside of the office or the building or whatever. But again, through the Wi-Fi, it's also technically possible, as we will see in the demo, to exploit some of these issues. And also if the attacker is somehow inside the internal network, and if the attacker has connectivity to some of these devices, then obviously he can, he could try to exploit the issues. So let's start with the vulnerabilities and vulnerabilities. So the first one is not a really critical one, but it was a really important one for the research because it's a hidden root cell kind of back door. So yeah, when you get a root cell, the process of the research, it makes easier this process, I mean, the research. So but it's a kind of privilege escalation vulnerability because you need access to the command line interface to get that root cell. So from the attacker's perspective, yeah, if the attacker somehow has access to the command line interface, it's good. He can do a lot of stuff. But if the attacker gets a root cell, then we can say that the device is completely compromised. So here we can see this picture, in some forums, some guys asking about these services that are self-command that gets you into the native operating system. But he says that Motorola may not disclose the requirements of the required password to customers. So I was trying to find information about this star shell command. So all I got was like forums like that, people asking about it, but that's all I got. Even if we read the manual, we can see that, yes, we have a star shell command which provides cell access, but that's all you get. So when you execute this command, you get this last password used password with this address and then this password prompt asking for the password. So you can see that the user has to type the password. So one of you guys might think here, like, okay, so it's telling me what is the last password used. So I'm going to try password in lower case letters. But obviously it's not going to work here. So then since we got access to the framework image, then we are going to start to statically reverse engineer some binaries to find out how this works. So based on the strings, we can see here the last password used. And then we're going to call this validate map password function. And depending on the return value, it's going to reach this basic block where it's going to get the root cell. So let's get inside this validate map password function. Then again it's going to call this other one, get last map password function where it's going to open this file. It is a two I miss password file. And the content of this file is this particular string. And this is the default value in every wing OS. This string inside that file. Then after that with the content of the file, it's going to execute these instructions in this loop. So to play around with unicorn, I am late to this code. I don't know if you guys know or are familiar with unicorn, but it's also a framework that uses in the background and allows you to emulate several things. So I'm going to show you how to do this. So I'm going to show you how to use the code in the original architectures. But of course in order to emulate the code, you need some previous reverse engineering job or work. For instance here, you need to know what points to your input. The buffer where we have the contents of that file. And also you need to know the number of points to the buffer where we will have the result of the operations. So I was using the Python example here. This is the example that I API for unicorn and it's pretty simple so you can emulate the instructions and provide the register values and create your buffer and inside that buffer we have the content of that file. And then after the execution of the emulation we are printing out here the buffer where we have the result which is these bytes, the result. So if we look at it carefully we can see that this was the stream that we had inside the file. So when the code is reading it it's ASCII character then we got it's hex byte for it's ASCII character. And after that this is the result that we got after those operations in that loop. So we can see that these bytes are these guys here. So basically it's meaning that this is hex. Then after that it's going to call RC4 decryption routine. It's going to try to decrypt the content of that file. So then we try to copy that code. We can see that this is just the thing to do. And then of course this is the static file. I mean the hex bytes after those operations in the loop. We have this static key. Hi, Sabena, how you doing? Bye. Nice key. In this case after decryption the result is going to be the password distinction in lower case letter which makes sense because we were in the get last password and that's what it was printing out here is last password use, password is lower case letter. So you can see that something's not going to work. We've got a category though. Yes, I'm a consumer for D限Centers. It's a very self confident expectation after that the code is going to get the MAC address of the device. And then with the MAC address it's going to execute these instructions in this loop and basically doing some operations with the MAC like adding some numbers to each byte of the MAC like here the first byte is adding zero. Then the second byte is adding one and then two, three, four and so on. And then after that what it's going to do is call another RC4 decryption routine. So it's going to decrypt password which is the result for the last RC4 decryption but now it's with this key the MAC address with those operations that we were talking about. And finally after that it's going to execute these other instructions which I also emulated to play around with the unicorn. . basically these instructions are making sure that the result is only lower case letters. So here is the emulation as you can see in my device for my MAC address, this is the valid password which is only lower case letters. And then you can finally access to the root cell. Then in the code we can see that after the password is granted, it's going to open again that file, the I miss password file. And then it's going to RC4 with the same key, the key. The password that the user typed when the password was granted. Meaning that the next time you're going to execute the service start cell command, the password is going to be different. That's why I call this like at a kind of dynamic password. Because the next time it's going to be the same, and you will have to do the whole thing to get it calculate the password. So here you have the overall process in case you later want to check with the slides. And yeah, finally in the code also we can see that since we got access to the root cell, then creating this file, allow root in ETC, then you can make it persistent. And then all the time that you execute the command, it's not going to ask for any password again. Okay. So now, since now we have root cell, we can start to try to see more stuff about this OS. For instance, to check what services are running by default. And for instance, we can see that there are several ports, like this 3799 UDP port, which is listening over all the IP addresses. So in this case it's the RIM process, the radio interface module. So this is the RIM interface. So, now, we are going to see a remote personal of this service, but this particular one only affects older versions of the firmware, but I wanted to share with you guys this one, because it seems that they tried to fix it, but they made another mistake, as we will see shortly. Now, from here is the typical stuff from protocol reverse engineering. So basically we trace the sockets and we know where to look and we can see the they call this parsing the user's buffer. So in this case, in this break before, we know that the buffer length is 1,000 hex, which is pretty big. And then just reading the code and following how the code is parsing the user's buffer, we can see that there is one particular memcpy where the source and the size are completely controlled by the user and the destination is a stack buffer. So it's a typical stack buffer of flow. So we are here. Here's where we have in this red block the break before. And here's where we have the call to this function where inside we have that particular vulnerable memcpy. So what we need to do right now is the typical reverse engineering stuff, like to find out how to get from here to there, just reading the code and build your own Python client to reach that particular memcpy. So this is one of the Python client to reach that stack overflow. So as I said, this only affects all versions of the framework. But based on information that I got from the Contron website, the Contron devices that are used in aircrafts, apparently some of them could be vulnerable as I saw in the website that they were running older versions of the framework. So apparently they tried to fix this stack overflow. So here in newer versions of the firmware. So we can see here that they are checking the size of the memcpy which is user control. But if it's bigger than this value, then it's not going to reach that vulnerable memcpy. Instead it's going to execute this function that is going to generate this crash dump and then it's going to kill the process. So yeah, this is a Python code to reach that, and so yeah, you can kill the process but the process will restart immediately. But the problem here is that there's a watch pillow in this system that checks always alive because this process is critical for the operating system. So if you execute this Python script like two or three times in a row, then the watch pillow is going to check that the process is not alive. And then the whole operating system is going to be reboot. That's why I call this like global denial of service. Then let's move on to the main vulnerabilities. There are other EDP services with issues but we don't have time to talk about them. So let's move on to the main issues. So when I was reverse engineering some of the binaries I realized they were receiving data from some particular sockets. So when tracing the sockets I realized they were using nonstandard values such as for instance the 32X value for the domain value and some references such as this one like local mint address. So I wanted to know what the hell was this mint thing. So there's not much information on the internet about this mint thing. At least about how it works internally. Of course obviously there are information about how to set the devices to work. So I wanted to know what the mint and stuff like that. But basically it's a layer two, layer three proprietary protocol originally also created by Motorola. And they have like two levels. Level one for VLAN and level two for IP. So mint is used mainly to communicate devices between them. So for instance here we have these access points communicating between them through level one mint. Or this access point to this controller through level two mint. Or these two controllers through level two mint as well. So yeah. When you trace some of the processes as well you can see some stuff like the socket address family which is nonstandard. AF mint. The port. And then the mint address which is the four last bytes of the MAC address. So yeah. They created their own proprietary socket address family in their kernel. The AF mint. In my case at least I was using data RAM sockets. So the goal here is to be able to create a client. So we can communicate with other devices using mint. So we have three options here. It's like the first one reverse engineer their kernel and try to make your own client. And make it work in your Linux box which is technically possible. Then another option could be to try to emulate the whole operating system on the kernel and then make your own mint client which is also technically possible but could be a pain in the ass. So we're going to do it with the colon. I can't use the colon right now. So we're going to use the colon. And then the quickest one which is the one I took because I didn't want to spend too much time working on that. So find a way to build a client using their kernel. So basically what I'm doing is using a device as the attacker. So running my own mint client in the operating system. But again this is not the only option. I mean an attacker could use the option one or option two and use it its own Mint client in its Linux box or whatever. So attack scenarios using Mint. So in my case as I'm using a device as the attacker, then if the attacker connects its device to the network with, I mean, physically with the cable or through the Wi-Fi, then if he's able to reach other access points or controllers that are using Mint, then he can exploit the vulnerability. And of course, other scenario could be that the attacker remotely compromised one device and then since he has access to the root cell, then exploit the Mint issues to other devices that are connected with. And then yes, basically attack the Mint services that are running in access points and controllers. Controllers are also interesting because they are like kind of Windows main controller. So if you have a border, meaning that controllers can have like hundreds of access points connected, so if the attacker compromised one controller then he could compromise hundreds of access points and not only with their vulnerabilities but also controllers has the ability to change the configuration remotely of the access points and also even update the firmware of the access points remotely. So the way I understand this is that when these very basic does this, but I created the mint client in the OS. So we have here in the OS modified Python interpreter. And they have also their own libraries such as this one for sockets. And this allows us to, through Python, to create AF mint sockets. So they have some Python compiled files in the operating system. And then reverse engineering those compiled files, I saw how to create my own Python client to communicate through mint. So basically here's the mint address, which is in decimal, but it's the four last bytes of the MAC address of the target. Then the port, the buffer, and then you can create the AF mint socket. And then send that through mint to the target. So one important thing about mint is that we can expect to have mint where in scenarios where we have several access points and controllers, because as I said, mint is a very important part of the OS. So we can expect to have mint where in scenarios where mint is used to communicate communications between devices. But also I wanted to check if standalone access points can also use mint. So yes, technically, as I saw during my test and during the research, it's possible. As we can see here, the mint in a standalone access point is enabled by default because you can set standard access points as virtual controllers, for instance. So the attacker, what only needs to exploit these issues is to know the IP address of the target. I mean, there's no any kind of authentication. So this is the target, the attacker's device, this Motorola Black Access Point. So we only need to set controller host and the IP address. And then the mint link is established. But this is not the only way to establish a mint link. As far as I know, there are other ways. For instance, also if you connect an access point in the network, then the other access points could detect in an automatic way this new access point and establish the mint link in an automatic way. And probably there are more ways, because I'm not an expert with this mint thing. So yeah, so after that, in the attacker's device, we can see that with the show mint neighbors, we can see that the mint link is already established. So now we can see that now we can communicate through mint. So now we just need to find bugs in mint services. So there are a lot of binaries and a lot of mint services receiving data from sockets. So this example is from the HSD process. So this particular graph is one function, which is more or less big, receiving data from a mint port, one specific mint port. And we can see the typical pattern of this that the looks like we got like switch case statements that probably are switching through an up code or something for the protocol. So one of the first issues, pretty straightforward, is again, pre-op heap or flow, where the user has control of the size and the source. And the destination buffer is the heap. But the problem that we have here is that to reach that particular mint CPY, we got to go to the case here in the switch case statement. This function is going to be executed, get session by MAC. And what it's going to do, this function is to check if the MAC address that you have to send in your buffer, it's in a list of authenticated MAC addresses. If it's not there, then you won't reach that particular mint CPY. So luckily, there is another case in the switch case statement where we can call this session function. And we can see that this function is going to be executed in a list of authenticated MAC addresses, where we can add our fake MAC address in that particular list. So first we just need to execute this Python code, where we will add this fake MAC address, 41414141, to that particular list. And then after that, since our fake MAC address is already there in that list, then we can set ‑‑ we can reach that mint CPY, the heap or flow mint here you can see in our buffer we are providing the fake MAC address and the rest is the protocol stuff to reach the memcpy. And then here we have the crash of this memcpy, this heap overflow which since we don't have modern exploit mitigations and the libc version is all in this operating system it shouldn't be too complex to get code execution from this heap overflow. Then we got more heap overflows like this one. Pretty much the same in other cases but basically it's exactly the same that the source user control, size user control and the destination is a heap buffer. Now this is the div that I will try to use in the demo. So it's stack overflow through mint as well. So it's another heap overflow. So we have the memcpy where the destination buffer is in the stack buffer obviously and the size is also user control. But the size and the source comes from the heap buffer and it's the heap buffer that we were discussing before with the heap overflow. So the problem that we have here is that this is the memcpy that for the stack overflow. So if we want to reach the return address in the stack our buffer has to be big enough to reach that. So the problem is as the source comes from the heap then we'll have to also overflow the heap buffer and also overflow the next chunk and the next chunk's metadata. And we could have problems with the libc sanity checks because if the sanity checks triggers here then it could crash the process and then it could ruin our exploit. But in this case it's not going to be a problem because in between there are no allocations on freeze and so it won't crash and we will be able to reach the stack overflow after the heap overflow. So for the exploit as I said that we don't have export mitigations we just need to jump to our set code and that's it, but no. So if you guys are familiar with MIPS there's a well-known problem it's the cache properance problem. So that explains what-like and all these kind of things so just let me waited to answer these. We just leave them for my timeow So we got a MIPS CPU with two different caches, the instruction cache and the data cache. And normally our payload, so our cell code, it could be stored in the data cache. So the problem is that when we try to jump to our cell code in the memory, if the cell code is still in the data cache and it's not flushed, then we could end up trying to execute another instruction in the memory. So what we just need to do is to fill the data cache. And one possibility is to fill the data cache to flush it, but it depends on how big this cache. Another option could be to call a blocking function such as sleep using ROP. And using ROP because we could think here like, okay, I'm going to write a small shell code which calls sleep and that's it. But yeah, we could have the same problem. Like, okay, I'm going to write a small shell code which calls sleep and that's it. But yeah, we could have that mini shell code could be still at the cache and then we won't be able to reach that. So that's why we are using ROP. And then after that, then the cache will be flushed and we can jump to our cell code. So for the ROP exploit, from the epilogue of the function where we have the stack overflow, we can know what racers we have control with. So this is very useful for the ROP, obviously. And then this is the gadgets that I'm using to execute the sleep and then jump to the shell code. And all of them are from the libc. For the shell code, I'm using a standard reverse shell code. Not a big deal. But, I mean, there are, on the internet we can find several MIPS shell codes for Linux. Even Metasploit provides MIPS shell codes. But, and this particular one is from exploit database, but none of these are going to work in this system. And as far as I know, and I tried to find, shell codes that could work in this system are not going to work. And that's why mainly because this is MIPS N32. So MIPS N32 has some particularities. For instance, it uses 64-bit racers, but uses 32-bit memory addresses. But also what it has is different syscall codes. So that's why the shell codes are not going to work. So it's not a big deal. You can just open the libc and check the syscall codes for each APIs that your shell code is calling. For instance, this is the socket function. And this is the syscall code for this function. And then after that, then you got your MIPS N32 shell code that is going to work. Which, by the way, is Big Endian. So for the exploit. Yeah, so remember that I'm using the black access point as the attacker. And it's going to attack the white module access point that I have here. So this graph represents better the exploit, so you can understand better. And I'm going to exploit it through, I mean exploit it through the Wi-Fi. So this is the attacker's laptop, which is my Mac here. So I'm going to connect through the Wi-Fi to the target access point. Because the access point is provided in Wi-Fi, obviously. Then I have an Ethernet cable connected to the attacker's device. And using the internet sharing of MacOS future. Then now the attacker's device can connect, has connectivity to the target through the Wi-Fi. And then three basic steps. I'm going to run the netcat listener in my laptop. Then I'm going to execute the mint exploit. Which will change three different. As I will explain. And then through the Wi-Fi, it's going to exploit the mint vulnerability. And then the reverse cell, it will connect back to my listener. So let's see if it works. Fingers crossed. So I'm connected to this access point, MotoTest. Which is the target device. And here is the. The AP-7131-91-FD80, which is the attacker's device. So with this command, nice, wait a second, please. So mint neighbors. Now we can see with this command that the mint link is already established. So now we can see with this command that the mint link is already established. And this is between the attacker's device and the target. Then I'm going to access to the root cell. So we have this shell script, which is going to execute three different Python scripts. The first one is the one that adds our fake MAC address in that particular list. So we can reach the keyboard flow. Then the second one is going to execute the PYTHON script. to trigger the heap overflow. So we are going to overflow the heap with our self-coded and rubbed gadgets. And then finally we are going to execute or trigger the stack overflow which that particular MCPY is going to get from the heap buffer, the self-coded and the rubbed gadgets. And also I have here the Netcat listener. So let's see if it works or not. There you go. So here we have the reverse cell as root as you can see. And you can see here that this is the AP713136F3E0 device which is the target because the attacker was the 91FD80. So this is the exploit for one particular main vulnerability over the tier through the Wi-Fi. . So finally as a conclusion, so extreme networks were really responsive to us and they provided fixes to the network. and patches for most of the issues. Here I'm sharing with you guys the link where you can check the patches and some other information. But at the beginning apparently they didn't understand well the impact of the issues because also they were saying that none of the vulnerabilities can be directly explained over the air which is not true as you just saw. And saying that the attacker must have access to a wing device that has already been compromised. That's not true. I'm using my own device so the attacker can use his own device but also the attacker technically could create his own client in his Linux box. So this is not a must. But yeah, we recently spoke with them and then they realized that it was wrong and they changed the all this information and they are accepting now that the vulnerabilities can be explained over the air and the attacker doesn't need to compromise the device to explain the main issues and some other stuff. So that's good. So yeah, finally, yes, I think there is a lot of room for improvement in this operating system because there are more vulnerabilities in this OS. So yeah. Hopefully with these lessons learned they will fix in a proactive way more issues and then we'll have more secure wing OS devices out there. So that's it. So thank you very much. And if you have any questions, I'll be around.