1 00:00:00,000 --> 00:00:05,280 This is Through the Looking Glass and what Eve found there by kaeso and emdel. 2 00:00:05,280 --> 00:00:10,740 So please join me in giving them a huge welcome >> [Applause] >> 3 00:00:15,500 --> 00:00:23,440 Okay. Welcome everybody. Before starting first of all, yes, you are not in the wrong 4 00:00:23,440 --> 00:00:29,500 track. This talk about is looking glass mostly. Not directly but how to access 5 00:00:29,500 --> 00:00:35,000 them by exploiting something else and in this case it is why the title. We are looking about 6 00:00:35,000 --> 00:00:40,500 looking glasses. I'll tell you what looking glasses are if you don't know them and what we 7 00:00:40,500 --> 00:00:48,083 found in our research in order to exploit them. Actually I'm not Emdel I am Luca Bruno and 8 00:00:48,083 --> 00:00:53,875 this is my colleague Mariano Graziano. And we're going to talk you through this 9 00:00:53,875 --> 00:01:01,417 presentation. I'll talk about the first part. And it will give more details about (inaudible). 10 00:01:01,417 --> 00:01:07,417 Before starting we are both coming from Europe. So we are researcher in Eurecom in France. 11 00:01:11,292 --> 00:01:16,208 We are researching several topics in general which is in security. I'm mostly into 12 00:01:16,208 --> 00:01:22,500 imbedded systems, networking devices in general and physical infrastructure. While Mariano is 13 00:01:22,500 --> 00:01:28,208 a PhD student his topics are mostly malware and forensic stuff. Here is currently in the 14 00:01:28,208 --> 00:01:32,000 U.S. here at Cisco doing internship. I give you a small presentation about us so let's 15 00:01:32,000 --> 00:01:38,000 get into the case. First, I know this is going to be a bit of a bizarre talk because this is not 16 00:01:49,000 --> 00:01:53,333 something that you see every day. I mean, looking glasses are not so commonly used. And the 17 00:01:53,333 --> 00:01:59,875 reason of this research is also a bit bizarre. So let me guide you through why we did this. 18 00:01:59,875 --> 00:02:06,792 Imagine for a couple of minutes that actually you are an attacker. Some kind of very lame 19 00:02:06,792 --> 00:02:14,583 attacker. You are starting your first test in the offensive part of security and you are looking 20 00:02:14,583 --> 00:02:19,625 for your next target. You are a bit lame in the sense that you want to go big so you are 21 00:02:19,625 --> 00:02:25,750 looking for something that is, let's say, quite a big impact. But your skills are not so high. 22 00:02:25,750 --> 00:02:30,917 So let's say you are looking for something that is some kind of critical infrastructure or 23 00:02:30,917 --> 00:02:38,042 global infrastructure where the impact of what you can do will affect a lot of people in 24 00:02:38,042 --> 00:02:43,958 different geographic areas but you don't have a lot of skills. And you also don't have a clear 25 00:02:43,958 --> 00:02:49,542 goal right now. Actually because we're not getting into a lot of expectation but we have just the 26 00:02:49,542 --> 00:02:57,375 general idea you want to cause a bit of damage. So let's think about this. Let's say that we 27 00:02:57,375 --> 00:03:03,625 are we want to target the internet because it is the most used infrastructure around the 28 00:03:03,625 --> 00:03:10,875 world. Everybody is relying on that for economic, personal and whatever activities. If you want 29 00:03:10,875 --> 00:03:16,292 to target something of the internet that is catching a lot of region encounters around the 30 00:03:16,292 --> 00:03:22,083 world maybe you want to target actually how the traffic is exchanged between different and 31 00:03:22,083 --> 00:03:28,375 several autonomous systems around the world. So we'll talk a bit about internal system. 32 00:03:28,375 --> 00:03:35,208 Routing. I told you already that we imagine our skills are not so high. So let's say that you are 33 00:03:35,208 --> 00:03:42,083 some kind of webs (inaudible) or something like that. We know the basic of scripting, general 34 00:03:42,083 --> 00:03:45,625 injection. We know a bit of Google (inaudible) and some more kind of injection in general and 35 00:03:45,625 --> 00:03:51,625 common injection. And we still don't know what we want to do once we get to our target. But 36 00:03:55,750 --> 00:04:00,042 in general we know that some kind of interesting targets will be the backbone of an operator. 37 00:04:00,042 --> 00:04:06,917 So in general we want to go with our limited skill in the (inaudible) to something that is 38 00:04:06,917 --> 00:04:14,083 like a backbone or another autonomous system. So what you are going to do is not attacking 39 00:04:14,083 --> 00:04:18,625 directly the route or the routers. We are not coming up with a zero day for Cisco or 40 00:04:18,625 --> 00:04:24,958 Juniper. Instead when we went through the mental process we found one really good candidate 41 00:04:24,958 --> 00:04:32,417 which is a looking glass. Looking glass actually something that I will explain to you later 42 00:04:32,417 --> 00:04:38,417 but fits well in this model. Where it just requires a bit of web knowledge in order to get 43 00:04:41,875 --> 00:04:48,250 big. So I hope that everybody here know more or less what is a looking glass and how to use it. 44 00:04:48,250 --> 00:04:55,417 If you don't know I will give you a really brief presentation of it. So let's go to an 45 00:04:55,417 --> 00:05:01,583 introduction about looking glasses. First, let's talk about the internet. Everybody is using 46 00:05:01,583 --> 00:05:07,583 the internet. But actually the internet is not a single net or not a single entity. The 47 00:05:10,875 --> 00:05:14,667 internet's composed we can describe it as a network of networks. It is in fact composed 48 00:05:14,667 --> 00:05:21,000 by a lot of entities commercial, noncommercial, private, university, government. The 49 00:05:21,000 --> 00:05:27,708 internet in general we have a lot of operators. We call them alternate systems. AS. And each 50 00:05:27,708 --> 00:05:35,250 of these autonomous systems have its own network. There are different kind of networks. 51 00:05:35,250 --> 00:05:41,250 Access networks, depending on what your target and what your economical business is. And all 52 00:05:43,375 --> 00:05:49,375 these networks are in somehow interconnected by one protocol. This is the BGP. It is what is 53 00:05:52,792 --> 00:05:58,208 governing how the traffic is flowing across the internet. There's something like the 54 00:05:58,208 --> 00:06:04,375 diagram that you see here where a lot of ranges, a lot of IPs are interconnecting and there is 55 00:06:04,375 --> 00:06:11,875 connecting system A to B passing through system B one, B two or whatever. Let's keep in mind we 56 00:06:11,875 --> 00:06:17,875 are BGP that is governing all of the internet and let's see how in practice this routing works. 57 00:06:24,583 --> 00:06:31,333 We normally talk about a BGP routing table that is something that we tell you okay in order 58 00:06:31,333 --> 00:06:36,500 to reach that IP address you have to go through so many alternate systems. That's fine. 59 00:06:36,500 --> 00:06:42,500 But in the case actually the reason a single BGP routing table. What we have really is 60 00:06:46,583 --> 00:06:53,417 that every autonomous system has its own policy. Has its own decision making process. Also, 61 00:06:53,417 --> 00:06:59,708 there are different algorithms and different way to calculate which is the best route in order 62 00:06:59,708 --> 00:07:07,042 to reach your target. So what we actually are seeing is something more complex where every single 63 00:07:07,042 --> 00:07:13,792 autonomous system has a local view, a local routing table that is used, that traffic is 64 00:07:13,792 --> 00:07:18,750 following in order to reach the destination. But as you may imagine, different autonomous 65 00:07:18,750 --> 00:07:25,000 system may have a different looking view what is the routing table. So there could have been 66 00:07:25,000 --> 00:07:30,750 some interesting situations. I am not an expert in BGP so I am not going too much into details, 67 00:07:30,750 --> 00:07:38,042 but what can usually happen is some kind of anomaly where for example the same graphics could 68 00:07:38,042 --> 00:07:44,042 be announced by different system by error or order to attack. I have one example here. This is 69 00:07:48,958 --> 00:07:54,417 courtesy of (inaudible) analysis. For example this is the incident where (inaudible) 70 00:07:54,417 --> 00:08:00,417 was announcing the graphics. As you may see, the same graphics was being announced by different 71 00:08:02,708 --> 00:08:09,042 systems. The current one of people on your right, the blue one. And another one that was by 72 00:08:09,042 --> 00:08:15,125 mistake announcing the same graphics. In this case some of the autonomous systems the one 73 00:08:15,125 --> 00:08:21,625 marked in yellow, red and orange were seeing the announce and following the announcement. So 74 00:08:21,625 --> 00:08:27,125 whenever you were trying to connect to PayPal you were reaching India. And in the other 75 00:08:27,125 --> 00:08:33,125 side there were some system that because of proximity following the correct amounts of people. 76 00:08:36,667 --> 00:08:42,667 So you have some kind of semantic or non-uniform routing. Imagine that you are the center 77 00:08:47,000 --> 00:08:53,750 or engineer of one of these autonomous systems in the middle. One customer is calling 78 00:08:53,750 --> 00:08:59,750 you and telling you, hey, look I have some problems reaching Paypal. You are a engineer at 79 00:09:03,708 --> 00:09:08,750 PayPal and somebody is telling you I cannot reach PayPal. What can you do about this situation? 80 00:09:08,750 --> 00:09:15,833 If you are PayPal and you know that your announce is correct, what you can do is trouble 81 00:09:15,833 --> 00:09:20,458 shooting. Everybody does trouble shooting and de bugging of connectivity issues. You need 82 00:09:20,458 --> 00:09:27,125 tools to do that. Because you are now in a situation where your (inaudible) is fine but 83 00:09:27,125 --> 00:09:34,542 something else on the other side of the world is doing something bad. And another, a third party, 84 00:09:34,542 --> 00:09:39,125 autonomous system is having problem and you want to de bug the situation. You need tools in 85 00:09:39,125 --> 00:09:45,583 order to do that. In particular you need something in order to get view on the remote status. 86 00:09:45,583 --> 00:09:53,000 We can come up with several tools and several solutions. One, is something like setting 87 00:09:53,000 --> 00:09:59,208 up a community, a distributed network of probes. So let's say that we are four autonomous 88 00:09:59,208 --> 00:10:06,000 system. Each one we are receiving different analysis and different BGP information. We 89 00:10:06,000 --> 00:10:11,500 all collect this information in a central location and there is some kind of service that's is 90 00:10:11,500 --> 00:10:16,167 exposing all this data and keeping chronological track. For example, we're coming from 91 00:10:16,167 --> 00:10:23,958 Europe and the RIPE labs this kind of services in the right where you can look at the 92 00:10:23,958 --> 00:10:30,583 history of analysis from multiple points usually at public exchange. Another 93 00:10:30,583 --> 00:10:35,875 solution that you can come up is some kind of private agreement. For example, summaries like the 94 00:10:35,875 --> 00:10:41,875 some, ring where you participate in these ring and once you are part of this ring you will 95 00:10:46,708 --> 00:10:53,250 provide one system usually a server inside your autonomous system and giving us access to 96 00:10:53,250 --> 00:10:58,667 this system to other network engineer in other anonymous system. In exchange you get the 97 00:10:58,667 --> 00:11:04,583 same access somewhere else so that every time you have a problem you can log in to a 98 00:11:04,583 --> 00:11:10,167 remote system, multiple remote systems actually, around distributed for example, trace 99 00:11:10,167 --> 00:11:15,833 roots and compare them to see what is going on and where the traffic is being lost or 100 00:11:15,833 --> 00:11:23,250 whatever. The third idea actually something more general. So let's give the whole public 101 00:11:23,250 --> 00:11:30,542 not only network engineers and not through central point of failure. Let's give the large 102 00:11:30,542 --> 00:11:37,167 public access to the net through our routers. As you may imagine this is something that sounds a 103 00:11:37,167 --> 00:11:43,875 bit scary in the sense that you need some kind of web servers that is directly exposing some 104 00:11:43,875 --> 00:11:50,208 limited feature of your routers in order to do the debugging and get information on BGP. So 105 00:11:50,208 --> 00:11:56,208 actually we're going to focus on this, this third tool, it's called a looking glass and focus 106 00:12:06,292 --> 00:12:10,208 on this software and see how does it work, what are the vulnerabilities that we found? 107 00:12:10,208 --> 00:12:14,375 We also found some incidents. Let's go through it because it's scary stuff. So what's in a 108 00:12:14,375 --> 00:12:19,125 looking glass first of all? A looking glass became famous let's say in the 90s and in the 109 00:12:19,125 --> 00:12:25,125 first years of the 2000's They are web script in the sense they're usually composed of one 110 00:12:30,417 --> 00:12:36,125 file, couple of files, a bunch of files. Nothing very complex. Not a big architecture. This is 111 00:12:36,125 --> 00:12:42,542 something that you just download, unpack and put in your web server root and forget about 112 00:12:42,542 --> 00:12:47,375 it. They're usually written in Perl a lot are written in (inaudible) because it was the 113 00:12:47,375 --> 00:12:53,375 90s and some are written in PHP because everybody loves PHP. How do they actually work? They 114 00:12:57,167 --> 00:13:04,333 establish a direct connection from the host that is hosting a looking glass to the router. 115 00:13:04,333 --> 00:13:10,333 SSH, or whatever methods you have to administer your routers. And obviously you need some kind 116 00:13:13,792 --> 00:13:20,667 of credential in order to log into a router. So how does it work? You have a config file 117 00:13:20,667 --> 00:13:27,667 with credential and whatever on the same host. And the web will use this information to connect. 118 00:13:27,667 --> 00:13:35,208 As you may imagine this is something that is becoming scary and scary as we go on. Because 119 00:13:35,208 --> 00:13:42,792 if something goes wrong from all this stuff, okay you have a hole. How does it work in 120 00:13:42,792 --> 00:13:48,583 practice? Let's say that we are an operator the autonomous system on your left and you want 121 00:13:48,583 --> 00:13:53,417 to provide this kind of looking glass access to the rest of the world. What you are going to do, 122 00:13:53,417 --> 00:13:59,542 like already have our routers, the three routes on the left which are handling our internet 123 00:13:59,542 --> 00:14:05,542 and the connectivity and everything else. We then add another system. Traditionally a 124 00:14:07,708 --> 00:14:13,708 Linux system that is the bottom one on the left. This system actually has two legs. Legs for 125 00:14:15,708 --> 00:14:22,250 links. One links is going on the right to the internet. The public internet. This is where 126 00:14:22,250 --> 00:14:27,750 you expose your web access. This is actually where the other operator, the other engineers 127 00:14:27,750 --> 00:14:35,042 that for example the two on the right are going to connect and use your web interface, your web 128 00:14:35,042 --> 00:14:40,333 service. On the other side in the same host is another leg which is going to the left 129 00:14:40,333 --> 00:14:46,333 connecting this service to the private part of an operator. Called the private network. The 130 00:14:48,625 --> 00:14:53,583 internal system where you usually have all the console and administration services that you 131 00:14:53,583 --> 00:14:59,542 don't want to expose to the whole world because they are a bit critical and you don't need 132 00:14:59,542 --> 00:15:05,167 to do administration of them through the internet. So actually this is something let's 133 00:15:05,167 --> 00:15:10,000 say that the looking glass is a bit critical because it sits at the border between the public 134 00:15:10,000 --> 00:15:14,500 part of your network which is fine something that everybody can reach and the private part 135 00:15:14,500 --> 00:15:20,500 where actually you have critical services. How does it look like? I hope you love the 90s because 136 00:15:23,042 --> 00:15:29,667 it is, like, clear, simple 90s interface. Just have the minimal that you need in order to select 137 00:15:29,667 --> 00:15:34,083 which kind of program to run. For example you have connectivity issues, you want to 138 00:15:34,083 --> 00:15:41,542 run ping and trace through prong system to your own IPs. Or you want to see how the analyses are 139 00:15:41,542 --> 00:15:47,667 going so you can see some kind of advance or reduce in summary of the analysis. Then you 140 00:15:47,667 --> 00:15:53,958 usually have one form where you can input some other additional parameters like which host, 141 00:15:53,958 --> 00:16:00,750 which IP address do you want to ping or trace it to. And what I was showing before in the slides 142 00:16:00,750 --> 00:16:05,417 is that one looking glass can be connected to multiple routers. Actually all the routers in a 143 00:16:05,417 --> 00:16:10,375 single autonomous system. So you can select which router you want to run. Imagine that you are 144 00:16:10,375 --> 00:16:16,875 geographically distributed so you are multiple regions and multiple exchange points. You 145 00:16:16,875 --> 00:16:21,958 have routers at all the exchange points. So you want to run comments on specific routers and 146 00:16:21,958 --> 00:16:27,958 specific geographical locations. What we did in this research is okay let's focus on what we can 147 00:16:33,833 --> 00:16:39,333 actually review and check. There are a lot of custom looking glasses. So imagine that your 148 00:16:39,333 --> 00:16:45,000 internal system a looking glass is quite simple. Just the web service that is connecting to 149 00:16:45,000 --> 00:16:50,417 SSH and (Inaudible) so you can write your own. This is a bit difficult for us to review 150 00:16:50,417 --> 00:16:56,250 because we don't have the code and we cannot set it up in your own lab. So in order to try to 151 00:16:56,250 --> 00:17:02,250 assess we have to attack an autonomous system and it's not legal. What we did instead is 152 00:17:04,417 --> 00:17:11,958 take at least there are several of public looking glass around the world, crawl through them in 153 00:17:11,958 --> 00:17:19,250 order to see if anybody or if a large majority of them are using open source software that we can 154 00:17:19,250 --> 00:17:24,167 download. And actually the answer is yes. There are several. In particular there are 155 00:17:24,167 --> 00:17:29,417 these four that are mentioned here that are quite common. Probably because they were the 156 00:17:29,417 --> 00:17:35,375 first to be written. And they were highly needed and a lot of operators were just downloading 157 00:17:35,375 --> 00:17:41,333 them and deploying them. As I told you already, a lot are written in Perl and (inaudible) 158 00:17:41,333 --> 00:17:48,375 is one we love written in PHP. What we did in the rest research and Mariano will show you later 159 00:17:48,375 --> 00:17:55,625 is reviewing the code of these looking glasses and also looking for all we found vulnerabilities 160 00:17:55,625 --> 00:18:02,875 then looking how widespread deployment was and which kind of incidents we found. Before 161 00:18:02,875 --> 00:18:10,708 proceeding farther just to frame a bit how we're going proceed Mariano will show you several 162 00:18:10,708 --> 00:18:16,708 incidents. We started from the base like assuming this is bug proof. The administration can 163 00:18:19,833 --> 00:18:27,500 makeovers. Let's say you are to deploy a web (inaudible)plus CGI but forget to enable the CGI or 164 00:18:27,500 --> 00:18:33,000 forget to protect your configurations and SSH keys. This case we may see some 165 00:18:33,000 --> 00:18:39,625 exposed credentials. There are routers credentials. Then go one step farther. Let's say that we 166 00:18:39,625 --> 00:18:45,625 try to find bugs in web application. We look for the normal, usual code breaks. Let's 167 00:18:48,292 --> 00:18:54,292 imagine that we can find some kind of (inaudible) shifting. It could happen. In this case we 168 00:18:56,500 --> 00:19:03,083 can use it for normal stuff like attacking other web services on the same site. Some of the 169 00:19:03,083 --> 00:19:10,083 looking glasses may come with additional model. For example they may come with additional 170 00:19:10,083 --> 00:19:15,500 malware for example, binaries or forked/modified modules. If you find bug in these modules you 171 00:19:15,500 --> 00:19:22,500 can attack that through the host. Not the software itself but the host. It's the one that 172 00:19:22,500 --> 00:19:28,917 is actually storing the credentials. We already have a step stone into the private side 173 00:19:28,917 --> 00:19:34,917 of an operator network and we can also steal the credential. Then stuff gets really scary 174 00:19:38,125 --> 00:19:44,125 because okay let's focus on the looking glass. Looking glass is connecting to a router by 175 00:19:48,125 --> 00:19:53,375 allowing just a limited set of comments. Let's see if it is really a limited set of comments 176 00:19:53,375 --> 00:19:59,667 or if we can inject whatever comment we want directly to the CLI of a router. If we can 177 00:19:59,667 --> 00:20:04,583 imagine to do that we are escalating from a basic web attack to where we are attacking 178 00:20:04,583 --> 00:20:10,583 critical infrastructure. And as a side case of this, let's say that, okay, we can do that. We 179 00:20:14,167 --> 00:20:20,333 can log in and control multiple routers. We can attack multiple autonomous systems. We can 180 00:20:20,333 --> 00:20:25,458 actually change different vulnerabilities. So the one that we found is the one already 181 00:20:25,458 --> 00:20:31,458 known. To actually attack the network. Once we are in the router, we can try to escalate 182 00:20:34,458 --> 00:20:40,833 and change the modification of the router in order to break the local a hook of the local 183 00:20:40,833 --> 00:20:48,583 traffic so the routing changing the local topography or announce bogus preferences to have more 184 00:20:48,583 --> 00:20:56,417 impact. Some of you now may think this is for sure not possible because you have best 185 00:20:56,417 --> 00:21:03,708 practices. We all know that BGP are (inaudible) at the border and whatever. In theory yes 186 00:21:03,708 --> 00:21:08,583 that's correct. But what we're going to show you through this presentation is best practice 187 00:21:08,583 --> 00:21:15,917 exists they are well written but often are disregarded. We also have another paper that is 188 00:21:15,917 --> 00:21:20,458 describing more details on that and we actually believe that this kind of attack is feasible 189 00:21:20,458 --> 00:21:26,458 with what we have found. But for clear legal motivation we cannot perform that. Sorry for bugging 190 00:21:30,167 --> 00:21:35,292 you with this big introduction. Let's get into the meat of it. Mariano will go through a 191 00:21:35,292 --> 00:21:41,292 incident. That's a scary part. >> Hello everybody. I'm Mariano. (Applause) >> Okay. Today I will 192 00:21:48,667 --> 00:21:53,917 talk about our finding. That Luca told you are more on the defensive side. Okay. More on 193 00:21:53,917 --> 00:21:59,833 the (inaudible) side. And in particular what during our research we have found several 194 00:21:59,833 --> 00:22:05,750 incidents affecting the most common deployed of looking glasses. So okay if remind the 195 00:22:05,750 --> 00:22:11,750 definition of a looking glass. Looking glass is something related to the web. So it's 196 00:22:19,083 --> 00:22:25,375 normal the first kind of problems come from the web. When we talk about web issues, we 197 00:22:25,375 --> 00:22:32,083 have two kinds of problems. The first one is related to web misconfiguration and the second 198 00:22:32,083 --> 00:22:39,083 is the more related about the common web vulnerabilities. Now I will give you two quick 199 00:22:39,083 --> 00:22:45,083 examples. One about the web reconfiguration and one about common web vulnerabilities. For 200 00:22:47,667 --> 00:22:55,083 example one very looking glass it's possible to retrieve the router credentials. Give the IP 201 00:22:55,083 --> 00:23:01,083 address, user name and password. Then it is possible actually because the configuration file 202 00:23:06,500 --> 00:23:10,833 is stored at the known address. With the wrong permission. For example for common web attack we 203 00:23:10,833 --> 00:23:16,375 found a couple of (inaudible). I know this sounds like a joke. I mean, what can you do with a 204 00:23:16,375 --> 00:23:21,792 (inaudible) looking glass. Actually sometimes with the device people buy them and then 205 00:23:21,792 --> 00:23:27,792 set up under the same (inaudible) other application. Let's talk more in the case 206 00:23:30,583 --> 00:23:36,875 about web misconfiguration. During our research we were able to find a couple of 207 00:23:36,875 --> 00:23:42,875 configuration files with Google Doc. They are really simple. You can see two very basic examples. 208 00:23:51,333 --> 00:23:56,792 Once that you know the configuration file (inaudible). Now let's have a look at the 209 00:23:56,792 --> 00:24:02,792 real Google Doc here. As you can see here in the output, you have you have developed credentials. 210 00:24:06,042 --> 00:24:12,083 This means the IP address belonging to the IP address belonging of course across the 211 00:24:12,083 --> 00:24:18,083 web then you have the user name and password. Now, of course, you have the output is already 212 00:24:25,000 --> 00:24:31,000 in the Google query because of the looking glass is very confused and has been indexed by 213 00:24:35,083 --> 00:24:41,083 Google. Let's look at the configuration directive of these Google results. As you can see 214 00:24:43,542 --> 00:24:49,875 on the left side, on the right side, sorry, you have the configuration directory 215 00:24:49,875 --> 00:24:57,833 basically is we can lift it because it is very config ratable. The configuration files 216 00:24:57,833 --> 00:25:03,833 then another interesting file is the log file for the looking glass. On the left side we have 217 00:25:06,750 --> 00:25:12,750 the real configuration file of the system. In this case we have a case for the cougar looking 218 00:25:15,833 --> 00:25:21,833 glass, is one of the most deployed. We have one entry for every router exposed in the web 219 00:25:25,417 --> 00:25:32,208 interface. Every router entry needs a router name. And then, of course, the credentials. The 220 00:25:32,208 --> 00:25:38,208 connection meter that can tell it the stage, NHS, SSH, RHS. Then the user name and the 221 00:25:40,417 --> 00:25:46,417 password login. Another problem related to web misconfiguration is the full configuration file. 222 00:25:50,500 --> 00:25:55,875 For example if we don't load one of the most common deployed looking glass and we have a look 223 00:25:55,875 --> 00:26:02,458 at the root directory, we have several files. Here it's really easy to spot the configuration 224 00:26:02,458 --> 00:26:09,125 file. The LG.com. Once that we know the name, basically we can just comb the web. It's really 225 00:26:09,125 --> 00:26:16,458 easy to have a list of all the available looking glasses. And basically you can create easily 226 00:26:16,458 --> 00:26:21,500 your own (inaudible) to check for the big address of the big looking glass address then the 227 00:26:21,500 --> 00:26:29,167 name of the configuration file. If you are lucky, you will find several entries of data 228 00:26:29,167 --> 00:26:36,625 (inaudible) because they are readable and you can download them. Of course, there are best 229 00:26:36,625 --> 00:26:42,625 practices. So if you ever look the reading file of all the read me files of these looking glass 230 00:26:46,042 --> 00:26:52,792 results, (inaudible) to warn the net operator about the security location of the configuration 231 00:26:52,792 --> 00:26:58,792 files. For example, it's written clearly make sure you (inaudible) on the configuration 232 00:27:01,375 --> 00:27:09,250 file since it contains your password. Hope you get it. We prove some guys didn't get it 233 00:27:09,250 --> 00:27:15,250 and they were found about 35 exposed in which you easily are able to retrieve configuration 234 00:27:17,250 --> 00:27:23,250 files and it means the credentials. Then let's have another look at the findings on 235 00:27:26,083 --> 00:27:32,833 our research. We have a few well known websites. One is the firm. One is the governor. They are 236 00:27:32,833 --> 00:27:38,833 some looking glasses. Everybody here in the audience knows the (inaudible). It is also quite 237 00:27:43,167 --> 00:27:49,167 famous in Italy. The network institutions and universities. We were able to retrieve the 238 00:27:52,792 --> 00:27:58,792 (inaudible) of the looking glass. Basically common for everyone. While for the gov, 239 00:28:01,750 --> 00:28:07,750 this is not the real looking glass. An old one and it's not currently deployed. But still we 240 00:28:10,250 --> 00:28:16,000 can access this custom PHP code. If you look at the code, you can find several security issues and 241 00:28:16,000 --> 00:28:22,000 give you idea about the problems that a looking glass can have. Let's continue. I just always 242 00:28:25,875 --> 00:28:31,875 related to the web configuration is related to the expose virus of the SSH keys. If you ever 243 00:28:35,375 --> 00:28:41,375 look at the configuration file or one of the common looking glass software, the connection 244 00:28:44,292 --> 00:28:50,292 meter is for example SSH you can have a configuration file of the configuration file. If you 245 00:28:53,667 --> 00:28:59,667 create your own code on that you know of course by private keys, and you start calling the web 246 00:29:02,458 --> 00:29:08,458 for the looking glass for the website, you can find several. For example one of the keys is 247 00:29:10,958 --> 00:29:18,667 here in this slide. On the top part of the slide you can actually have the private keys 248 00:29:18,667 --> 00:29:24,667 of these SSH router on the back one. Then if we for example try to read the dot SSH directory 249 00:29:29,125 --> 00:29:34,792 again we have a configuration problem we can list the directory and it's readable. We 250 00:29:34,792 --> 00:29:41,667 have several files, of course private keys. Then the client SSH configuration file and also 251 00:29:41,667 --> 00:29:47,667 the public key because, you know, I mean, we never know. Then let's have a look now let's 252 00:29:50,125 --> 00:29:57,000 focus more of our attention on the web. I remind you now the definition of the looking glass 253 00:29:57,000 --> 00:30:04,042 is the web application that is directly connected to the backbone router. And they may 254 00:30:04,042 --> 00:30:10,042 (inaudible) on the web. When doing our research, we have found there is a total lack of 255 00:30:12,083 --> 00:30:19,625 prevention of possible abuses. In particular for example there are no capture at all on these 256 00:30:19,625 --> 00:30:25,750 softwares. This means an attacker can easily automate several tasks. Such as example, 257 00:30:25,750 --> 00:30:31,917 mapping, automate the command injection even for example attack from several devices a 258 00:30:31,917 --> 00:30:39,458 victim from a different system. And I know this sounds really lame, but for example, create 259 00:30:39,458 --> 00:30:47,000 your own let's say fake dos botnik using all these devices because you don't have any 260 00:30:47,000 --> 00:30:53,625 capture and you can send comments and for example (inaudible). Let's have a look 261 00:30:53,625 --> 00:30:59,750 at the first kind of vulnerability we have found. Simple cross site scripting. 262 00:30:59,750 --> 00:31:05,750 Here the problem is in the HTML tag cycle and the address meet parameter. It is directly taken 263 00:31:08,250 --> 00:31:15,792 from the web phone. I know some people can complain about the cross site scripting. But, 264 00:31:15,792 --> 00:31:22,875 again, some network operations services can run under the same origin domain and for example 265 00:31:22,875 --> 00:31:29,958 you can steal cookies and execute around Java script code for whatever purpose you have. 266 00:31:29,958 --> 00:31:35,958 Here is an example. You can see here we have the looking glass interface. In the command we can 267 00:31:39,375 --> 00:31:47,208 see the address parameter. That we have of course for example we are trying to trace. (Cheering) 268 00:31:47,208 --> 00:31:53,208 >> Okay. Continue. Sorry. So here we have the parameter. As you can see problem with the 269 00:32:02,417 --> 00:32:08,417 cycle. Then you can inject your Java script code then execute it and do whatever you want 270 00:32:11,750 --> 00:32:17,750 basically. Now this is the big part of our talk. We have here a router common injection. The 271 00:32:23,583 --> 00:32:30,417 looking glass definition we can easy understand that (inaudible). >> Now stop. >> Oh 272 00:32:30,417 --> 00:32:36,417 now I have to stop. >> Does anybody know what's going on? (Cheering) (Applause) >> You do? 273 00:32:44,208 --> 00:32:50,583 >> What? >> Raise your hand if you are a first time speaker. >> Raise your hand. >> Welcome the 274 00:32:50,583 --> 00:32:56,583 new speakers! Cheers! (Applause) Good luck. >> Thank you. We can continue? After the shot. Okay. 275 00:33:06,042 --> 00:33:12,042 It is able to execute code from directly from the web interface on the backbone of the console. 276 00:33:17,500 --> 00:33:23,500 This is the case on one common deployed looking glass software in PHP. Here the problem is 277 00:33:26,708 --> 00:33:33,875 again the algorithm parameters. The algorithm is the parameter taken from the (inaudible). Here 278 00:33:33,875 --> 00:33:38,667 they also have this looking glass as kind of a confusion between the HTML case meaning 279 00:33:38,667 --> 00:33:44,667 and (inaudible). But here we have a look at the code. Open it readable. You have these 280 00:33:48,792 --> 00:33:56,208 algorithm parameters taken from the web phone that goes directly at PHP function. They can remove 281 00:33:56,208 --> 00:34:03,375 basically removes all the spaces. From the variable. Then this parameter (inaudible) the 282 00:34:03,375 --> 00:34:09,375 function. This is a simple wrapper around HTML, HPH function. Try to translate all 283 00:34:12,625 --> 00:34:16,958 the possible traffic in HTML entities. Then basically the argument it is directly centered 284 00:34:16,958 --> 00:34:22,958 with the backbone router. So it is a simple, straighter HTML escape and your common comments 285 00:34:28,833 --> 00:34:34,833 from the web go directly on the backbone router. Here you have the cool proof of concept. As 286 00:34:39,208 --> 00:34:44,417 you can see here you just have to keep in mind that for example to calculate comments for 287 00:34:44,417 --> 00:34:50,000 example you use a new line. But it's important to notice that the destination depends on the 288 00:34:50,000 --> 00:34:56,167 route of software so you can use whatever you want. Depends on the router. Here the comment is 289 00:34:56,167 --> 00:35:02,167 for example data on our lab environment. Okay now another kind of bug we found on our 290 00:35:06,417 --> 00:35:13,458 research is the remote memory bug. This kind is the problem that sometimes the looking glass 291 00:35:13,458 --> 00:35:20,750 has some other third party software embedded in their config rating, installation 292 00:35:20,750 --> 00:35:26,750 package. For one of them deployed looking glass, as the utility called fastping. It's 293 00:35:29,292 --> 00:35:35,292 been written by a student. Not me and Luca but two other students of course. And here the 294 00:35:40,208 --> 00:35:46,208 fastping is a third party binary, the equal reply is not properly sanitized. And we have 295 00:35:49,292 --> 00:35:55,333 memory corruption bug. Again let's try to have a look at the code. Okay. First introduction 296 00:35:55,333 --> 00:36:00,042 I'm sorry but the code is written Italian. And the comments in Italian. I hope you 297 00:36:00,042 --> 00:36:07,542 are familiar with Italian. The idea here is that you have these functions that is called 298 00:36:07,542 --> 00:36:15,417 (inaudible) but means fill tables. This function has index 2 parameters, an index and a 299 00:36:15,417 --> 00:36:21,417 delay. Okay. Then we have a general of global array that is called delay that has the 300 00:36:24,292 --> 00:36:29,958 length. Then this function basically applies directly to these global array using any 301 00:36:29,958 --> 00:36:35,958 index that comes from a field of the ICMP equal reply. Of course it not provide any index 302 00:36:39,000 --> 00:36:46,958 (Inaudible) of fix it length of the memory corruption. The expectation here is the 303 00:36:46,958 --> 00:36:57,358 following. We have a third party binary. That sometimes okay is in the defaulter installation 304 00:36:57,360 --> 00:37:04,500 package. But, of course, then the network administrator can decide not deploy it. And the 305 00:37:04,500 --> 00:37:12,167 (inaudible) is no longer maintain and these are reasons why the current order of the 306 00:37:12,167 --> 00:37:20,042 looking glass software won't fix the issue. Let's talk about the real exploitational part. We 307 00:37:20,042 --> 00:37:27,500 keep in mind we are dealing with delays. So the exploitation is time dependent. The problem here 308 00:37:27,500 --> 00:37:36,040 is that okay we can basically have a work round about this problem. Because from the 309 00:37:36,042 --> 00:37:46,242 request we have a field and we can (inaudible). But then the other is that every time that we 310 00:37:46,250 --> 00:37:54,792 run a (inaudible) we are sending 100 basically ISMP equal request packets. So the attacker can 311 00:37:54,792 --> 00:38:03,492 send up to 100 ICMP equal replies. So, basically, we can write one long parameter where 312 00:38:03,500 --> 00:38:10,917 100 the longest parameter in memory on the target. The point is it's not trivial to subvert 313 00:38:10,917 --> 00:38:15,958 the flow of this application. I still have a bet with Luca. We are at Defcon so I will give you 314 00:38:15,958 --> 00:38:24,118 the challenge guys. We are not providing any code. Now I talk more about the web 315 00:38:24,125 --> 00:38:31,740 misconfiguration and that this kind of issue related to web Mobility. But we also have other 316 00:38:31,740 --> 00:38:37,540 kind of problems. For example basic configuration network design. These are because for 317 00:38:37,540 --> 00:38:48,280 example network operators basically make the router interfaces public. We can easily 318 00:38:48,280 --> 00:38:54,700 from the looking glass get IP address of these exposed routers. We can for example with 319 00:38:54,700 --> 00:39:02,417 nmap to have a look at what services are running on these routers. And we can see that we 320 00:39:02,417 --> 00:39:12,077 have the exposed the SSH and the Telnet daemon. Now Luca will talk more about some fixes and 321 00:39:12,083 --> 00:39:18,083 possible mitigation of all these problems. (Applause) 322 00:39:22,020 --> 00:39:26,200 >> So that was actually the cool fancy 323 00:39:26,208 --> 00:39:31,292 part. We find out how to inject commands basically, vulnerabilities and incidentally 324 00:39:31,292 --> 00:39:37,708 in general we found a lot of disregarded best practices. There are a lot of counter 325 00:39:37,708 --> 00:39:45,117 measures for these kind of issues. So I see we can split it in three basically. The first 326 00:39:45,125 --> 00:39:53,000 one is looking at the code. The open source stuff in generally web code. We have to dilute a 327 00:39:53,000 --> 00:40:00,000 lot about the code. Then we have to improve our deployment methods. And if you are a 328 00:40:00,000 --> 00:40:04,958 network designer, a network architect or network engineer, please apply some best 329 00:40:04,958 --> 00:40:10,333 practices. First, let's start, everybody, understanding and acknowledging that if you are a 330 00:40:10,333 --> 00:40:16,333 web service that is exposing some kind of connection to a router, to some critical service 331 00:40:18,792 --> 00:40:30,352 to the web, it is, like, a dangerous case. Some kind of security target and we must know 332 00:40:30,360 --> 00:40:35,740 it and have a proper look at it. In particular, looking glasses are just one example. There are 333 00:40:35,750 --> 00:40:40,625 a lot of services like that which have been written in the 90s usually. And has been 334 00:40:40,625 --> 00:40:49,375 forgotten since then. Okay it's 2014, 2015, let's have a look from the security point of view 335 00:40:49,375 --> 00:40:59,075 to the code and review it. From the deployment side, we can do some steps in order to improve 336 00:40:59,080 --> 00:41:04,000 the situation. For example, there are a lot of cases where you don't need to connect this 337 00:41:04,000 --> 00:41:08,375 kind of services between your physical infrastructure. We found a lot of looking glasses 338 00:41:08,375 --> 00:41:13,792 that are connected directly to backbone routers and operational routers. You can set up looking 339 00:41:13,792 --> 00:41:19,958 glasses in other ways. For example, provide just one system that is mirroring all of the PGP 340 00:41:19,958 --> 00:41:27,792 roots that you know and is providing just ping and trace or some kind of sound box or 341 00:41:27,792 --> 00:41:34,417 playing environment that even if a hacker can get into it is not a big problem. Then, once you 342 00:41:34,417 --> 00:41:38,792 have deployed this kind of service actually check that everything is fine, that one 343 00:41:38,792 --> 00:41:47,892 public attacker cannot reach it over the web. Or your SSH key. Even if you did all of your 344 00:41:47,900 --> 00:41:52,958 configurations perfectly fine, check for other stuff that is on the same host. For example we 345 00:41:52,958 --> 00:41:59,417 found some cases for the looking glass was perfectly configured. But if you were accessing the 346 00:41:59,417 --> 00:42:06,708 same host through the IP or normal default dock root you were able to get to the same 347 00:42:06,708 --> 00:42:13,458 files. The last point, if you are a network engineer set up proper ACL on your routers. A 348 00:42:13,458 --> 00:42:20,083 looking glass doesn't need to have a root connection to your router. We found root possible 349 00:42:20,083 --> 00:42:28,280 in a configuration file, a looking glass user just needs to run a couple of comments. So set 350 00:42:28,280 --> 00:42:39,620 up a proper ACL just to do that. Then a router consults have not been tough as possible public 351 00:42:39,625 --> 00:42:46,380 access point. So there are some bugs. We know there are a lot of bugs. Sometimes very weak. It's 352 00:42:46,380 --> 00:42:52,200 easy to crack them. Use strong password. Don't reuse passwords for them. I don't want to see 353 00:42:52,208 --> 00:43:01,200 anymore SSH internet services exposed through the web. I will show you some screen shots from 354 00:43:01,200 --> 00:43:07,400 our own connection. We were able to connect to a router SSH console. Nobody in the world 355 00:43:07,400 --> 00:43:12,958 needs to do this kind of backbone router administration from home. Eternal system have 356 00:43:12,958 --> 00:43:22,375 their own private network and VLANS. So let's use them and put administration interfaces there. 357 00:43:22,375 --> 00:43:29,583 The talk is basically over. In order to conclude everything, what I want you to take away 358 00:43:29,583 --> 00:43:34,292 from this talk is that, okay, there are a lot of best practices around. We all know 359 00:43:34,292 --> 00:43:39,542 this. But best practices are often disregarded. We found a lot of cases where everything 360 00:43:39,542 --> 00:43:44,917 was basically exposed and this kind of critical software were not reviewed, sometimes were 361 00:43:44,917 --> 00:43:53,677 forgotten and there were clear bugs. We didn't show any advanced degree bugs. So beware. 362 00:43:53,680 --> 00:43:59,040 They are sitting everywhere in critical places. Let's review. Let's check them. And something 363 00:43:59,042 --> 00:44:06,000 that we want is also this talk was probably a bit lame. We didn't show any real advance. 364 00:44:06,000 --> 00:44:10,958 But an attacker doesn't need something really advanced. Attackers go through the weak 365 00:44:10,958 --> 00:44:16,917 link. Looking glasses a really weak link. Very simple, mostly forgotten and in critical 366 00:44:16,917 --> 00:44:22,750 places. Once an attacker gets them it's easy to escalate. We showed you can get from the web 367 00:44:22,750 --> 00:44:30,042 to a PGP attack. Something that find really interesting as part of this research is that I 368 00:44:30,042 --> 00:44:37,917 really understood the internet core, there are so many pieces and so many critical security 369 00:44:37,917 --> 00:44:46,375 flaws around that I am still amazed the internet is real running up to date. That was 370 00:44:46,375 --> 00:44:51,458 all. We are available for questions later outside of this room. Just want to thank a 371 00:44:51,458 --> 00:45:00,375 couple of other guys from Europe that helped us and discuss add bit it and some very cool 372 00:45:00,375 --> 00:45:06,375 students bug finding and overall in the whole research. So thanks to you guys from the NOPS team. 373 00:45:12,083 --> 00:45:19,167 And that's it. (Applause) Thank you. >> Okay. There are a couple of back up slides if you want to 374 00:45:19,167 --> 00:45:27,167 see them. We found actually the partition is not that difficult because known bugs exist in a 375 00:45:27,167 --> 00:45:36,960 router. For example Cisco there are weak issues all around. Type five has basically just MD five. 376 00:45:36,960 --> 00:45:46,280 And type four where there is actually critical bugs. There were actually critical bugs. 377 00:45:46,280 --> 00:45:52,280 Then once you have access to our router you can escalate quickly. From Cisco and Juniper existing 378 00:45:52,280 --> 00:45:56,880 known bugs to get from a normal user to a root user.