Okay. Yeah. I'm FX. Thanks for the introduction. And we're going to talk about router exploitation today. So I will give a short introduction to that topic. Talking about what vulnerabilities we actually have in routers. What architectures, what is different, what makes it harder. Then I'm talking like half of the talk about return addresses. So this is going to be really interesting. And then a little bit of shell code. And if any one of you here actually has Cisco routers, I've got you covered, too. So, oh, yeah. So there is to classify yourself, to help to classify yourself, there is a blackhead-o-meter. If you've ever been to ph neutral, you know the scheme. Essentially it means acid is like, you know, whiteheads and base is blackheads. And so it will essentially give you the code that will essentially indicate on the slide where we are. So if you're wearing a suit, only watch the slides that are in the upper area. If you've got a CISSP or something, then you can go as low as the middle area. And then everything down there is assembly and, you know, fun stuff. So introductions. Essentially we have seen router exploitation before. I have been involved in some of that. There was primary focus on IOS, of course. But interestingly enough, we're not seeing Cisco warms. And we are actually not seeing any large-scale exploitation of a Cisco device in the field. We have written a tool to find those things. And I talked about it last year. And essentially with a few exceptions, we actually drew a blank. And this is something that actually, like, motivated me to look into that issue and go, like, so why? Like, why is actually nobody doing that? And I tried to figure out how will, like, what do you need for weaponized IOS exploit? Like, not for, you know, works in a lab and on stage. But for an actual weaponized exploit. What will it take to have meet exploit modules, for example? Now I can already tell you that's not going to be easy. The thing is, everything in Cisco is so fragile that, you know, when you attack it, it just blows and people notice. So it's not really easy to actually exploit them. And all incidents that we've seen have been insider attacks, configuration issues, trivial functionality bugs and stuff. So this is actually what we're seeing. And so I'm... Yeah. Here's the motivation. So the thing is this. Everything that even remotely has anything to do with data that you can send other people is getting exploited. Why is it not that infrastructure gets exploited? I mean, it's obvious that control over the entire infrastructure of someone you don't like is good. Therefore, there must be something unique about especially Cisco that makes the real world really, really hard. Now, if we figure out what that unique stuff is, then we can actually tell what needs to happen in this world so we actually see Cisco warms. And that actually allows us to react before it actually happens. So that is essentially where I came from. And now we're talking about vulnerabilities in routers. So there is actually very little public vulnerabilities. There is actually a shitload of them in Cisco IOS. Only 14 of them have been published in last year by Cisco. Juniper actually never published anything of importance regarding their own products in routing environment. They have this kick-ass like industry rock star security team. But apparently they're actually not testing their own boxes with it. So... So vulnerabilities in network world actually get fixed a lot of times with the customer from the, you know, from the networking department sending them a TCP dump. Well, after jumping through like 500 loops with the first and the second and the third level support people, right? He's sending them a TCP dump file and says, look, this packet crashes my router. And they go like, oops, functionality issue, going to fix that. So it actually never makes it into security advisory. And doesn't make it into any databases. So it's not accessible to any of their customers. Even if they care. So they don't actually know. Which is bad. Because those customers run our Internet. You know, the place where the porn comes from? So... The vulnerabilities we have are service vulnerabilities. That is the most common thing. Because, like, everything that is a server likes to go get attacked. Same on Cisco. If you fire up a server on a Cisco router, it will be attacked. So that would be remote administration interfaces, SSH, something. That would be SNMP because everyone needs that to run their networks. That would be other stuff that shouldn't be on there, like a TFTP server or an FTP server or an HTTP server. I mean, the FTP server on Cisco IOS was so bad that when the first security vulnerabilities were identified, Cisco didn't even know what they were doing. So they decided to remove the entire server and to start over again sometimes in the future. But, like, they essentially deleted the entire code tree. And that was so right to do. So how can you have two buffer overflows and one format string vulnerability in the parsing of any command in FTP? So... What is this actually saying? I'm actually just seeing half of the screen on my little fancy EEP. Yeah. So there is relatively little stuff that we have seen so far. And... The services that we have are actually not exposed to an attacker. Like, the services you normally run if you have a clue as a network engineer are something like routing protocols, but they require that you're within the same network. So you have to be within the same network. You have to be within the same company, for example, to speak multicast with the routers. If you don't speak multicast, you're not speaking OSPF, you're not speaking announced IGRP. So essentially this is useless if you want to, like, truly remotely attack someone. RIP is so simple that even Cisco didn't fuck it up. BGP, you have to explicitly say, I want to talk BGP with that guy. And if that guy is actually sending you traffic, you know who it is. You know, that is really not useful for an attacker. The protocols where they put in the most stuff are layer two. So you actually have to be on the same switch. And some routing protocols like IS-IS don't even speak IP. It's not IP, right? So you can't route it on the Internet. If you are within the same multicast domain, let's say within a large corporate network, good fun. But over the Internet, principle is don't trust routing updates. There is a notable exception, which is my favorite research bug. I haven't actually found it myself. So there is this vulnerability in iOS with IPv4 option parsing, and it is only hitting in four different protocols. Things like the URL, rendezvous directory, whatever, never hear of that. Or some modules. Some multicasting routing. And a rarely used protocol ICMP. Known as ping. So this is really good because what they try to do is, so you get a ping packet in, and it has a source route, IPv4 source route that everybody ignores because it's evil. So they think, okay, I'm getting this in, and now I want to pong back to this machine, so therefore I need to actually turn the source route around. And RFC says that there is only going to be eight different IP addresses in the source route at max. So we allocate a static buffer on the stack that holds exactly those eight, and then we parse it. And then we turn it around, which is a buffer overflow. Funnily enough, they also do that when you actually put a stop option in front of it. So it actually says end of options, so any sniffer, any IDS sees no options. And anything else is Cisco and sees a buffer overflow. The good thing is, from an attacker point of view, that, you know, people invent stuff, and they don't do it right, and then they put it on routers. So, like, nowadays we have IPv6, which is rarely tested at all because no end user actually uses it. And then people putting VoIP onto routers. Like, all those very simple to parse ASN1 protocols. And they put web servers on routers so they can actually speak zip. And then governments come around and say, fuck, we need internet surveillance. So they're putting lawful interception functionality into the routers. People put SSL VPNs on them. Oh, there's a brilliant new idea from Cisco, which is called Web Service Management Agent. So it's actually opening a web server port on your router, and you send it XML data to manage the router. So they can actually make it Web 2.0. So Huawei, who's actually, like, just to clear this up for everyone, Huawei is actually not running stolen Cisco code. They potentially did that in the past, but they're not now. So their access routers actually come with H.323 enabled on, like, 10 TCP ports. And it's not solid. The good thing about this is network engineers are a real old-style bunch. Because they like their blinking boxes to be simple. Because that way they don't have to learn new stuff. Which is good. Which I totally understand. So they're really slow to adopt this stuff. But, like, if you're rolling out voice over IP in your company, you can't do anything. I mean, the boss is telling you. Client-side vulnerabilities. And that does actually play absolutely no role on Cisco. Because Cisco's are actually not used as a client. There are notable exceptions. Like, if you type in a command that it doesn't know, and you didn't explicitly tell it to not do NS lookups, like name server lookups, it will actually broadcast the DNS request to the local subnet. Like, broadcast it. Whoever answers is correct. That is not smart. But the new services I was just talking about will change that as well. Because they will actually make the router a client. Because it's doing HTTP requests. And then there is the most powerful way of looking at Cisco vulnerabilities. That is vulnerabilities that are triggered by traffic. Which actually flows through the router. That would be nice, wouldn't it? Like, the router gets a packet. Reads that packet. Forwards that packet. And then get owned. So, with a far away target, you actually score like 10 or 20 routers with one packet. But they're actually really rare. In fact, we haven't seen a single one yet. This only holds true for real Cisco IOS equipment. Like, if you have a deep packet inspection firewall, whatever, that is different. Yes, they get owned by traffic that goes through them. But routers are actually trying really, really hard to not look at traffic. Because if they would look at every packet that goes through, they would simply die. Like, you would actually have, like, clusters of CPUs in them to forward the packets. And routing is all about speed. Because we want our porn to, like, not be Legoland. So, it actually doesn't happen. Some traffic is notable exceptions. Some traffic actually get, like, source routed, for example. That must be inspected on every hop. Or you have an IPV6. You have the hop by hop header. And I'm going to watch that one closely. Because I'm sure that Cisco is going to fuck it up. So, what makes it so hard? If you compare the architectures of a couple of router vendors, Cisco IOS actually is a monolithic elf file. It's like the biggest hello world program you've ever seen. Therefore, because it has no internet connection, it has internal protections. And we are going here into the details later. The default behavior if something goes wrong is device crash. Now, people realize when the porn stops. So, it's a really, really bad property of that platform. This actually makes it so hard. The service modules are actually running on Linux. So, they are only process crashes. The router keeps forwarding. Exploitability a lot easier. Juniper running FreeBSD. That they actually upgraded to FreeBSD 6. So, thanks for letting me know. I didn't know that. And they are standard Unix. Right? You find a vulnerability. You exploit it. Bum. Huawei actually runs VRP in two different versions. There is a Linux VRP and there is a VXWorks VRP. VXWorks is a little bit more bitchy to exploit. But the Linux one is a Linux one. You know. So, this is what I'm saying. The Unix-like operating systems and routers make it actually really easy to exploit those boxes. There is nothing fancy about it. So, I don't actually know if we just, like, fucked up completely and should have written a rootkit detector for Juniper and not for Cisco. But, yeah. So, the hard one is iOS. This is why I love it. And it's... As I said, it's a single large binary. Shared memory architecture. So, everything can write anywhere in memory. There is virtual memory mapping according to the ELF header. So, you only have, like, a data section and a text section and stuff. And it's for PowerPC and MIPS. It has one single shared heap. So, the whole thing shares one heap. What can possibly go wrong? Processes are a threat. So, they actually memorize just the CPU context of that thing and then store it off. There is very little additional information to it. Oh, yeah. And we have something that is really nice. We have a run to completion scheduling. Remember Windows 95 where you put in a CD and your PC didn't do anything for half an hour? This is how they schedule. So, the consequences is it cannot recover from exceptions. If anything goes wrong, like, if you have a divide by zero or something, your box literally does the equivalent of blue screening. It cannot recover from memory corruptions. If something in the heap is corrupted, it takes down the whole thing. Like, you can't actually fix that anymore. The way, you know, you fix that on a Windows machine or similar is it's in a process. And the process has virtual memory mapping. So, if he fucks up his heap, he has a fucking problem. In iOS, if he fucks up his heap, he fucked up your heap. Everything goes down. That is really bad. So, you don't actually have a kernel that can kill stuff. So, therefore, they actually have an additional process that is called check heaps. And walks the heap and, like, tries to find corruption in the heap. And if he finds it, he reboots the box. And it cannot handle CPU hocks. So, Windows 95, task scheduling, right? One process eating all the CPU power. They actually have a watchdog. And the watchdog is then saying, It takes long. It takes longer. I reboot. Is there anything else? No. So, the memory layout is based on an image, right? It's a big fucking hello world program. So, it's also influenced, like, IO memory and other memories are also influenced by what stuff you put into the router. Like, what interfaces. And so, you have this base address here, which is stable over the platform. And then you have a couple of other sizes that actually influence how big stuff is. So, if I write one additional line of code into iOS and I recompile it, which happens a lot and we're going to cover that. Then all the sections that come after the text section, so the data section and BSS and all the other stuff is going to be on a different address. Which sucks. Because we need a return address. Every iOS image is apparently built from the scratch. Like, every coder on Cisco land has its own make file. There's a very good reason that iOS actually says the corporate user name of the guy who compiled it when you boot that thing up. Because if they're getting a call into tag, stuff broke in this image, they're checking if the guy is still there. And then either see if he can fix it. Or if he can actually not. And then, you know, hunt him down. Right? Because he's the only guy having the make file that produced that image. Now, it really depends on platform version, minor version, release version. Then they have this concept of train. So, a train essentially means the stable train, which is the slow train, you know. And then you have the real non-stable train. Like, T is the technology train. There's new features in it. Imagine you have a Windows 2000. And you get the Windows XP version of, like, solitaire. And so, that decides then they have features. You pay by features. They get compiled in every time. And there are special builds as well. So, we're ending up with, like, 270,000 different supported iOS images. That is a lot. So, what is this doing here? So, for exploitation, that essentially means you have a chance of 0.000366% of having the right return address. If you're considering return into Lipsy. Great. That is not useful. And your assumptions about stack and heap are going to be as useful as well. Because you're basing them off an address that you don't know. And stacks are actually blocks allocated in the heap. So, your chance of guessing where the stack is of the stack that you just overflowed is actually even smaller than figuring out where the heap is. And that essentially means that the fucked up build process Cisco has is by far the best protection. It provides more entropy than any ASLR you've ever seen in a regular operating system. So, at Black Hat, I actually happened to run into the guy who owns the build process now. And he told me, yeah, I know, it's really fucked up. We're making it better. I'm like, don't! Dude, if I can predict your code addresses, you're toast! So, that is really fun. So, this diversity is also a real problem for shellcode, right? But in shellcode, you know, you usually need to get access to addresses somewhere. Like functions. You're calling functions off the operating system. That is the whole point of your shellcode. Well, the problem is the functions are always at different places. Different addresses. And since it's compiled at once, they don't need something like a registry or something like exports from DLLs. They tell you where functions are. And so, essentially, you don't find them. They're not there. And if you directly work on the data structures, for example, yeah, it's the same thing here. Because, like, you would think that something like a struct that holds all the information about a process, something like the PEB and Windows, would actually be a really stable thing on Cisco. Well, heck no! Because everyone can code anywhere. And there is no segregation of duties whatsoever. People love to add an additional integer in the middle of their most central structure. And the next version, remove it again. This is really good. So, using platform code is actually hard. Because we have this return address dilemma first. So, where could we return to? Stack we already discounted. It's somewhere on the heap. It's very unpredictable. IOS code is image dependent. We have a shitload of images. So, we have no idea where that should be. You would need actually to have an exact version information for the image. Which you don't. And you would also need to actually have that image. Because you need to disassemble it and find a function that you want to jump to. So, you don't have that either. And the other sections. I actually went for this talk. I actually went ahead and compared the 1,597 images for the 2,600 machine. And compared the addresses of the sections. Because I thought, well, maybe they actually align sections to an aligned address. But they're trying really hard to keep this shit small. Because they're putting so much bullshit in it. So. Only 24 of them. So, it's 1.5% have a section on a common address. Which is the data section. Which doesn't mean that it contains the same things. Right? Interestingly enough, in 12.4, they actually started to align things in their images. So, they're actually, yeah, I'm seeing proof that they're working on a build process. Stop that. IOMEM was my favorite idea. So, IOMEM and shared memory routers and the smaller ones is the memory where the actual packets are kept. So, I sat down with a colleague of mine. And we actually developed a valid IPV4 packet that's also executable power PC code. That was a nice thing to do for an afternoon. Until we figured out that now we have it. And then IOMEM is actually not executed. Could have checked that first. Heapspray is actually entirely not applicable. Because you have essentially no control over the heap. And you don't want to spray on that heap anyways. No. You actually have no control over the heap. Because, like, there is a big difference between you providing a lot of JavaScript to a browser. And controlling it completely. And you talking to a router. Yeah. They're not going to allocate much heap for you. Partial overwrites would be a good idea. If you have a 32-bit address and you just overwrite, like, the least significant stuff. Then you can easily jump into buffers without knowing where they are. However, that only works on little endian platforms. And we're speaking big endian here. So, this is out of the picture. But Cisco has something like a loader. Something like a BIOS called the boot ROM. And that's the ROM on. And that's actually right now the very best option we have in terms of return addresses. So, ROM on is mapped initially into memory to boot up the machine. Right? And then stays there. And it's mapped on fixed addresses. So, let's get this right. Because many people after black had asked me about this. So, it's not deleted. We're not talking about, like, hacking to Cisco when it's booting up. It got other stuff to do at that point in time. It's loaded code, like your BIOS code, that is used for booting and then stays in memory. So, it stays there the whole time. Okay? Just making this clear. Because people asked me that. So, you see the addresses are relatively stable. Now, the addresses are stable. What about the code? The version distribution is actually a lot smaller with ROM on. And it's really updated. Who updates router BIOS? There is only one reason to do it. Because if you get new line cards, then you sometimes need to update it. But other than that, nobody does that. A feature of Cisco's large sales organization is that they love bug sales. So, they go into a network provider or service provider and say, hey, how is it like you buy a new network? Your equipment is already three years old. Throw it away. Buy new stuff. And the service provider says, sure, blow me one and I buy it. And so, yep, they do it. And then they buy all the boxes new. Which means they're going to have all the same BIOS version, right? Which is good. So, I Googled around. You see Pacman to the left side. So, this is actually the version distribution according to what people write on the net in 2600 routers. So, you see there's a very big chunk of 70% running the same version. This is actually really cool. What you see on the right is a real world network. A larger real world network. And this is all the versions that there are. But it's over all the device classes. Like from access switch up to big boxes. And no, I'm not going to tell you where I have that from. So, having Ramon in the same position all the time, we can use something called return oriented programming. So, this is one of those techniques that everyone who needed it had. He invented it for himself independently. I easily know about like 50 people that invented this technique for them because they needed it at that moment. There's a very good talk on this last year at Black Hat. I highly recommend if you can get your hands on it to actually read it. It's awesome. Or ask me about it later. So, essentially what you do is you take, when a function returns, it actually restores the stack, right? And then it returns to whoever called them. Now, this is common to pretty much everyone. This is common to all functions. Since you are controlling the stack, since you're writing there if you have a stack based buffer overflow, you don't provide just one return address. But you actually provide return addresses like many of them. And you keep jumping into function tails. Because if you jump into a function tail, then it's going to pop stuff up the stack. And so, the stack pointer goes up. And then you can actually control it again. So, you use that. And then you use the few instructions before that. To actually cause shit to happen. And in this talk, they actually proved this method to be Turing complete on Intel and PowerPC. So, we know that it's actually generalizable. And now we do the same thing with the ROM on. So, and this is how it looks like. So, you have your buffer overflow up there, right? Buffer overflow happens. You overflow the stack. And by overflowing the stack, you're actually controlling a couple of things that are going to be restored from the stack later on. Which is, first of all, very important. PowerPC returns not over the stack directly, but over a register called link register. So, if you want to return somewhere, you actually load the address of where you want to return to into link register. And then return. So, it's actually restoring link register from the stack here. Which means we keep control, right? Or we get control in this place. And then it's restoring two variables, our 32 registers, our 30 and 31. Through saved variables on the stack. And then it's, you know, adding the stack. And then since you control the return, you now jump into a function tail, like this function number 2. Which actually ends on an arbitrary memory write based on those two registers. So, you're already controlling our 30 and 31. And now you get an arbitrary memory write. Which is good. And then you can keep continuing doing that. So, you fill the rest of the stack. With the next stuff. Which gets restored into the registers. And then you return again to this function. This way you can actually write arbitrary values to known addresses in address space. But you have a problem. Another one, so to say. Essentially, we have too much cache. Rare thing to have. But we have too much cache. We have two different caches. We have one cache that is a data cache. And another one that's an instruction cache. Now, what this means is if you actually have a buffer overflow, like this mem copy here. Or anything else. Any copy operation. It actually doesn't really write into memory. But it actually stays in cache. Now, you don't actually have much time between you overflowing the buffer and you actually trying to jump into executable code. So, this flash actually doesn't get flushed. So, if you jump there. It's actually trying to execute what used to be on that position before you wrote. Which sucks. Because you want to run your own stuff. Luckily, there's in this bootstrap code, Cisco needs to do the same thing. Cisco needs to disable the caches when they actually load up iOS. So, there's an entire function dedicated to that. Which we can jump to, of course. And return oriented programming use that one as well. So, we're putting it all together. And so, we're having the buffer overflow. We use return oriented method to actually disable the cache by calling code in Ramon. Then we write one 4 byte 32 bit set. Which is an instruction into the exception handlers. The exception handler area has to be on the same position. It has to be executable. I have no fucking idea why it has to be writable. But it turns out it is. So, I just write like a move stack pointer to counter register instruction there. And then a branch to register instruction to counter register. And then we can just jump there. The net effect being that this code, those two instructions know exactly where the stack pointer is. So, we can jump there. So, we're jumping into the buffer which we're just overflowing. So, now we have regular code execution on the stack. Right? But we actually don't want to mess up the stack too much. So, what we actually do is we run a little second stage code that goes into IO memory. And searches for magic value. And then finds the packet the overflow came with. Right? So, it's finding his car. And it's getting more stuff out. More shock code. And putting it onto the stack where it belongs. And then you execute it. And then you're pretty much done. I don't know if I mentioned that, but this is all one ICMP echo request. And it drops you an enable shell. So, this actually works. So, the thing is because we have this fucked up scheduler, we actually need to be really careful how we get away with the exploit. Because if we just like run our code, it's really bad. Because then the Windows 95 scheduler is going to die. And then the watchdog is going to kill us. Other people have used terminate process as a method of getting away with it. Like they terminated the iOS process. The problem with that method is twofold. One, you again need to know where it is. So, it's image dependent. Not good. The second is with the ICMP bug, for example, I'm exploiting a process called IP input. Now, imagine what happens if I turn that off. The device only does IP output. Not very useful. So, this is not usable. But we still have this stack layout going on, right? So, you're still with me? You see the black head-o-meter? It's fine if you sleep. So, essentially, we still have this stack laid out. And there's still going to be some stack pointer and link register saved on a stack higher up. That is still valid and still intact. So, we can actually parse upwards. And find stuff of the stack that is not destroyed yet. And then we actually restore the registers based on that information. And just return. Entirely innocent. That works. The downside of ROM1 is actually getting it. Like the problem is you're interested in the oldest version. The one that is most distributed outside. That is not available as an update, obviously. And so, you will actually need to get out and get the physical boxes. And, like, get ROM1 off them and disassemble them to know where stuff is. And because it's that code, you can't remotely fingerprint it. It would be like you try to remotely fingerprint a BIOS version of a PC. Right? That's going to be hard, too. So, yeah. And you still need to know the hardware platform. But that's a different issue. So, what alternative method could there be to actually return without the ROM1? Return directly into the image. Because that you can actually fingerprint. Well, the problem here is that we just said they're all different. And there are many of them. But the question is how different are they really? So, I did this. First of all, I did what every good geek does with a new project. You buy new hardware. So, I got a new machine. And then I wrote a Perl script that actually disassembled 1,597 iOS images. And then runs a code similarity search on it. So, it finds every return, every BLR instruction. Parses upwards. And validates that the link register is actually restored from the stack. Because that is required. And then it also validates that it has an arbitrary memory write. And it validates that it's all in the same basic block. So, no shit can go wrong in between. What's up? I'm last, dude. It doesn't matter. Yeah, same happened at Black Hat. I'm just speaking too slow. So, here's four images. So, you see it a little bit closer. So, we're actually having an equal sequence in two different forms. So, it's the same sequence. But it's sometimes offsetted by a couple bytes. The fun part is if you look at, like, 70 images. It happens to be only those two cases. That was really, really interesting. Now, 70 images is still nothing. But if you take two images that are based on Cisco's feature navigators output. Exactly equivalent. Except for a very, very, very minor release fix. I don't know. They maybe changed the blinking rate of the prompt. Change. They actually differ again. So, this is really cool. And then you look at larger bases. And then you see that out of the 1,600, you actually have, like, 326. Which is 20%. That share an arbitrary memory write on the same address. This is very promising. We find other stuff, like fixed memory write and stuff. But I'm actually, this is work in progress. So, I'm actually working on grouping those images together. So, I find which of the 30, of the 20% have what in common altogether. So, you can actually know what you fingerprint. What you need to fingerprint to then know what return address to use. So, when you compare the two. Raman is actually still better. You get better chances. But you can't fingerprint it. On the other hand, for the method with the iOS images, I still have the cache issue open. Like, there is no cache disabling code in iOS that I can easily find. So, I don't know. As I said, work in progress. Let's skip the summary. Go. So, what about shellcode? First of all. It seems to be big ass. Because the instruction set are fixed size instruction sets. So, they're 32 and 64 bit. You often have that problem that your shellcode is actually too large. And overflows over the stack into the heap header block. Because the stacks are allocated on the heap. And then the whole thing breaks down. I actually have shellcode that in the middle of itself repairs the heap. Because it's sitting on the heap control header. That is really useless. Because then at the end you actually don't have space for doing anything else with that. And you need the stack to actually stay clean. Because you still need to return. Remember? So, you always need second stage code. And there is some particular problems with finding IO memory addresses. Because they're not stable either. But we're going to solve that. What can you do? You can create VTYs. Right? You can just like create an enable shell. But you always need to have addresses in the code that you can jump into. You could create a VTY. Or you can directly modify the data structures. And I already mentioned that this is not really stable. You can also just modify the image. Now, what is this? You only need one single cone point that you identify. Which is potentially the one that says password wrong. So, what you do is you do exactly that. When you do it by hand. Like when you open an IOS image and, you know, want to patch it. You find a string. And then you cross reference that string into memory where it is accessed. Well, you can do that in shell code, too. So, shell code goes ahead and like finds a unique string that you provided. And then parses the entire code section and disassembles it. And finds LIS and add instruction that you have two instructions that load the address of a string. Because it's a 32-bit fixed size instruction set. So, it finds the two instructions. And then knows in which function it is. Right? And then it goes back upwards. And actually disables the function entry point. And just returns true. This is how it looks like. You have it on the slide. So, this is how you code patch. Cisco has started to put Tcl into the hands of system and network administrators. What if all the place is Tcl? Couldn't they have loaded Perl on this? Please. So, they opted for Tcl. And you can automate a lot of shit with it. It's only in the newer boxes like 12.4. But it's actually very useful for network administration and automating processes on the routers. Now, I could imagine writing a shell code. I haven't done that yet. That actually downloads a Tcl script from somewhere. And then your remaining shell code is Tcl. It would work. Many people have wet dreams about iOS sniffers. So, essentially, like, post exploitation, you're actually running a password sniffer on the router. Well, the router would know, wouldn't he? The problem is that's a very naive idea. Because, as I said, if the router would actually look at traffic, it would die due to the load. So, this actually doesn't work straight out. However, very stupid ideas from governments in the first world that have to do with lawful interception are actually helping here. Because, you know, lawful interception by law requires that you build in targeted sniffing capability that the administrator will not see when it's turned on. This functionality is there, no matter if it's turned on or not. So, we can jump to it. So, actually, if you're running a service provider network supporting LI, which you have by law, then you're actually the only ones that are at risk of running an iOS sniffer that someone else controls. And the same holds true, essentially, for men in the middle. What I could imagine would be really cool is, like, compromising a core router and then getting it to the point where it's actually, like, leaking out sequence numbers from arbitrary TCP connections so you can inject into any connection that is going through this network from anywhere in the world. It would be nice. So, how do you protect? First of all, good luck. The easiest way to protect is prevent traffic destined to the router itself from getting there. Like, nobody is supposed to talk to your router. And don't forget, like, your fancy interfaces that you configured. You should use MD5 where you can in routing protocols. And you, please, stop running shit on iOS. Like, it's not, it can barely handle itself. How should it handle a web server and an FTP server on top of it? Right? So, don't. Okay. And monitor your service modules. They're, yeah, special. Configuration checking is the easiest way to catch most of this, actually. Because if someone owns a Cisco machine, at some point the configuration is going to change. There's a tool for that called Rancid. Which people running big networks actually use. So, it's actually halfway decent. And configure core dumping. Core dumping is the only fucking way you can ever find out if someone owned your router or not. If you didn't configure it beforehand, it didn't happen. You have no evidence whatsoever. So, just place the FTP server somewhere and tell all your Ciscos to dump core when they crash. This also helps harassing Cisco to fix the bug if it's not a security issue. So, please do that. For really critical machines, add enough flash so they can dump locally onto their flash and don't need to network for that. Because that is perfect evidence. If someone is shooting with an exploit on your machines and they can do that, you have the exploit. Go ahead and complain to Cisco. The real problem is nobody updates iOS because then shit breaks. Like porn stops. You know? The cool people run 12.2 because that's the only thing they know is stable. The braver people run 12.3 and the void people run 12.4. And fail miserably with getting it to work. Cisco should actually go ahead and find out. They're the only ones that can find out how you can transition from one image to the other without breaking porn. Thank you. Please do. And please complain to the other vendors because they're definitely not doing the right thing. Because the lack of advisories indicates that their stuff is perfectly secure. No. Their stuff gets fixed silently. Maybe. Their stuff doesn't even get internal testing. Most likely. They're not looking at it at all. Like Linus Torvalds made fixing bugs and critical code stuff without telling anyone cool. Because he said security. Security bugs don't need special treatment. Well, I beg to disagree. And Cisco is actually doing a really, really good job here. Because the P3 team is actually this one bright spot of security in the whole Cisco blackness. You know? So, yeah. Complain to them. Tell your router vendor that they should actually test this shit and publish the results. And that was it for me. And I would like to point out that my hard drive. My best friend and DJ Mumpy is playing tonight at 1 at Black and White Ball. Right? So, come by and see us there. Thank you very much.