1 00:00:00,000 --> 00:00:04,860 Good afternoon. It's good to see everybody here. My name is Ed Schaller and I'm here to talk about 2 00:00:04,860 --> 00:00:10,740 Web Street Application Server, JSP engine. And some work I did with that and it turned out to be a 3 00:00:10,740 --> 00:00:16,960 very interesting exploit. Out of curiosity, how many people here actually run or are familiar with 4 00:00:16,960 --> 00:00:22,520 Web Street Application Server? So a fair number. Okay. So maybe I can move forward with some of 5 00:00:22,520 --> 00:00:27,360 this fairly quickly. This is a rather complex exploit but it's pretty simple when it comes down 6 00:00:27,360 --> 00:00:34,140 to it. And it's a little unfortunate when your screen setter comes on. First of all, this is our 7 00:00:34,140 --> 00:00:39,020 outline. The slides are going to be on the website as soon as I put them up there with the exploit 8 00:00:39,020 --> 00:00:43,840 and such. So we're going to talk about what Web Street Application Server is, talk about JSP and 9 00:00:43,840 --> 00:00:51,480 nulls, plug-in and nulls. We're going to have a demo and talk about the fixes and extras and 10 00:00:51,480 --> 00:00:57,340 should be good. So first of all, Web Street Application Server's architecture. We're going to 11 00:00:57,360 --> 00:01:00,340 talk about Web Street Application Server. Web Street Application Server is IBM's JEE 12 00:01:00,340 --> 00:01:06,120 application server. It's one of the more popular JEE application servers, at least according to 13 00:01:06,120 --> 00:01:11,960 Gartner. It's up there with Oracle and Microsoft as the top three. It's heavily used in the 14 00:01:11,960 --> 00:01:19,280 financial services industry and the insurance sectors. And it's not very cheap. So probably I can 15 00:01:19,280 --> 00:01:24,500 go buy it for you on the website. But there is a time bomb free version online, a trial. You can go 16 00:01:24,500 --> 00:01:27,340 and you can download. So I have to wait a little bit. I'm going to go ahead and show you the 17 00:01:27,360 --> 00:01:30,480 JEE application server. I have to warn you that I have in the best authority that the initials 18 00:01:30,480 --> 00:01:36,480 WAS. But I always get it wrong and say WAZ. So you can laugh at me every time I do that. 19 00:01:36,940 --> 00:01:43,680 Whatever. So anyway, here we have the common network architecture that you usually see in a WAS 20 00:01:43,680 --> 00:01:47,400 deployment. You have the client browsers obviously on the Internet that then connect through a 21 00:01:47,400 --> 00:01:56,040 firewall to your Web servers. And those Web servers then redirect through the HTTP, the WAS Web 22 00:01:56,040 --> 00:01:57,340 server plug-in into the actual JEE application server. So that's a little bit about the JEE 23 00:01:57,340 --> 00:02:03,060 application for Web servers. This is done with a HTTP connection that is handled by the Web 24 00:02:03,060 --> 00:02:09,180 server plug-in. The Web server plug, first of all, this is the common architecture as IBM shows it. 25 00:02:10,220 --> 00:02:14,000 If you look at this, it's hard to see, I realize, but the main features here is that the big gray 26 00:02:14,000 --> 00:02:20,900 box is WAS itself. And you have the Web server plug-in in between it and the Internet. So 27 00:02:20,900 --> 00:02:25,840 realistically being that the Web server plug-in forwards everything into WAS, if you compromise a 28 00:02:25,840 --> 00:02:31,840 Web app on WAS or WAS itself through the Web container, basically whatever you compromise has full 29 00:02:31,840 --> 00:02:37,040 access to most of the internal resources that WAS does with some exceptions depending on the network 30 00:02:37,040 --> 00:02:42,100 deployment that's done. So plug-in is what's in between it and the Internet. I'm getting ahead of 31 00:02:42,100 --> 00:02:51,040 myself. And we do all that. So Web server plug-in is what you need to describe a little bit first to 32 00:02:51,040 --> 00:02:54,260 understand. I'm going to refer back to this architecture because we're going to jump around between the 33 00:02:54,260 --> 00:02:59,720 different areas to understand it. This is basically an extension module that sits inside the Web 34 00:02:59,720 --> 00:03:06,860 server, whether that be for Apache, IBM's Apache, which is an IBM HTTP server, IHS, IIS, several other 35 00:03:06,860 --> 00:03:12,460 ones, including Lotus Domino and things like that. So basically it just connects straight via HTTP 36 00:03:12,460 --> 00:03:18,300 to the actual WAS instances Web container. It has special headers to keep track of where the client 37 00:03:18,300 --> 00:03:24,240 came from and such. So it's mostly used for load balancing and failover. It's also used for 38 00:03:24,260 --> 00:03:28,260 load balancing and failover. So that if one application server goes down, it detects that and 39 00:03:28,260 --> 00:03:33,840 then it forwards to a different application server in turn. One thing that is important to realize 40 00:03:33,840 --> 00:03:37,600 about the plug-in if you're dealing with a WAS installation is that its primary purpose is not for 41 00:03:37,600 --> 00:03:42,840 security. In fact, it's really not to do anything with security. In some cases, I see people 42 00:03:42,840 --> 00:03:48,300 actually doing, trying to do blocking rules on IHS and such to try to protect things on WAS and 43 00:03:48,300 --> 00:03:53,840 this can cause issues as we'll talk about a little more later here. So let's talk about the URL 44 00:03:53,840 --> 00:03:59,160 handling and the plug-in itself. Not all of the requests that go into the URL plug-in on the 45 00:03:59,160 --> 00:04:05,520 web server actually get forwarded back to WAS. What it does is it bases the URL configuration, it 46 00:04:05,520 --> 00:04:10,840 bases on effectively the same sort of things that are done for the Web container itself from the 47 00:04:10,840 --> 00:04:18,120 web.XML and from IBM's extensions configurations inside the WAR file that you're running on. So as we 48 00:04:18,120 --> 00:04:21,760 know, these are simple file blobs that get pushed in. They are matched in sequence. The Web 49 00:04:21,760 --> 00:04:23,820 server plug-in is actually very simple, although it's fine. It's a little bit more complicated 50 00:04:23,840 --> 00:04:27,440 because it's frequently misunderstood. So if you're asking for a servlet, it forwards it in. 51 00:04:27,520 --> 00:04:31,080 If you're asking, you know, if you have a simple blob, it forwards in. And what we're going to be 52 00:04:31,080 --> 00:04:36,780 talking about is startup JSP, anything that is JSP, it forwards in. If you have the web server, 53 00:04:36,920 --> 00:04:43,900 the WAS feature of file serving enabled, this is a kind of an IBM specific function that if you 54 00:04:43,900 --> 00:04:48,320 don't have it enabled, static content inside your WAR does not get served. If you do have it 55 00:04:48,320 --> 00:04:52,900 enabled, it does get served. So if you have it enabled, all the connections get passed from the 56 00:04:52,900 --> 00:04:59,520 web server into WAS. This is one I see misunderstood a lot of times. If a match occurs, the 57 00:04:59,520 --> 00:05:04,480 connection is forwarded in, much like a reverse proxy. Otherwise, the request is handled for the 58 00:05:04,480 --> 00:05:09,500 web server. The reason for this is it's usually used to handle static content from the web server 59 00:05:09,500 --> 00:05:15,360 as a speed optimization so that the static content gets served by IHS or Apache instead of going all 60 00:05:15,360 --> 00:05:21,640 the way to WAS and served from Java. So this is just frequently misunderstood. It's amazing how 61 00:05:21,640 --> 00:05:25,900 much I see it. If you're interested in more, there's actually a paper about it that IBM has 62 00:05:25,900 --> 00:05:29,980 that's referenced in the slides I recommend looking at. And it's actually for an older version of 63 00:05:29,980 --> 00:05:34,860 WAS, but the plug-in actually hasn't changed much in quite a while, actually. So now let's talk 64 00:05:34,860 --> 00:05:40,780 about JSPs and how they handle null. Now we're going to talk, we're going to move from the plug-in 65 00:05:40,780 --> 00:05:48,240 here on to the WAS instance, the web server application server. And let's talk about strings. I 66 00:05:48,240 --> 00:05:51,620 assume that most people know about strings. Strings under Java, I'm going to talk about the 67 00:05:53,400 --> 00:05:58,680 operating system sitting underneath Java is written in C, which, of course, has null terminating 68 00:05:58,680 --> 00:06:04,840 strings, which means you cannot put null characters into a string and have them used later on 69 00:06:04,840 --> 00:06:12,240 because it terminates a string that's been used. Whereas Java is a counted string that can have 70 00:06:12,240 --> 00:06:16,940 nulls in it. So the big question is, of course, that we're going to start with here is what happens 71 00:06:16,940 --> 00:06:21,620 if you try to open a file in Java like test.txt backslash zero? Well, you're going to have to 72 00:06:21,640 --> 00:06:28,760 test it. So with a null character in Java, well, actually you get test.txt. This has been known 73 00:06:28,760 --> 00:06:33,360 about for a very long time. Formally just this specific instance has been talked about by some 74 00:06:33,360 --> 00:06:39,640 people on the web, but it's been known and used in Tomcat exploits for quite a while. So what 75 00:06:40,720 --> 00:06:45,620 about the JSP engine inside of WAS? How does it deal with a null character coming in to WAS? 76 00:06:46,840 --> 00:06:51,620 JSP handling is very simple. It locates the file, translates the top JSP into a string, and then 77 00:06:53,540 --> 00:07:01,380 compiles it into a servlet and runs it. So what happens with WAS, or at least WAS before it was 78 00:07:01,380 --> 00:07:09,760 patched, if we request %00.jsp for an arbitrary file inside the WAR? Well, the answer is it actually 79 00:07:09,760 --> 00:07:17,820 compiled it as test.txt as a servlet and runs it as a JSP. This is similar to what I'm not even 80 00:07:17,820 --> 00:07:21,620 trying to pronounce it. Those are the characters in the web. I didn't make a mistake. In fact, 81 00:07:21,640 --> 00:07:30,220 it's found in Tomcat. If you're here, I really apologize. So this allows us to read files 82 00:07:30,220 --> 00:07:37,140 through the JSP engine. This may seem not too useful, but we'll see how this can be added to in a 83 00:07:37,140 --> 00:07:41,220 series to actually make something useful happen. So basically if we have our context root for a 84 00:07:41,220 --> 00:07:47,200 web application, we just append %00.jsp to the end of it and we'll get the file. Obviously we 85 00:07:47,200 --> 00:07:51,180 have some restrictions on what files we can get. We can't just get any file from the web server we 86 00:07:51,640 --> 00:07:56,320 want. It must be in the WAR file, which is usually expanded. And we can't read files in meta 87 00:07:56,320 --> 00:08:04,640 int for web ints. And it must compile and run as a JSP. It actually isn't too useful unless file 88 00:08:04,640 --> 00:08:10,320 serving is turned off and you're trying to get files that aren't put on the IHS instance that's 89 00:08:10,320 --> 00:08:15,720 serving static contents. So the question then comes as you're looking at these files is what's a 90 00:08:15,720 --> 00:08:21,620 valid JSP? Turns out that basically anything that doesn't include a less than or less than 91 00:08:21,640 --> 00:08:29,460 percent sign is a valid JSP as far as the WAS JSP engine is concerned. HTML usually qualifies 92 00:08:29,460 --> 00:08:34,340 under this, XML. Most text files, then you get some really weird ones like you can download zip 93 00:08:34,340 --> 00:08:40,780 files and jar files. I didn't know these compiled as JSP's, but they do. Most class files also do. 94 00:08:40,900 --> 00:08:45,860 So you can get a lot of interesting things through the JSP engine in this manner. Still not doing 95 00:08:45,860 --> 00:08:48,700 anything too, too interesting, but what about directories? 96 00:08:49,040 --> 00:08:49,480 . 97 00:08:52,340 --> 00:08:57,560 For some reason, and I really don't know why, if you open up a directory in the same 98 00:08:57,560 --> 00:09:04,640 manner in WAS's JSP engine, it gives you a list of all the contents of that directory. And I'm 99 00:09:04,640 --> 00:09:10,300 really not sure why because if you open up a normal file in Java from like a new file object and 100 00:09:10,300 --> 00:09:15,280 open file input stream, it doesn't have it. So they must be doing something special here and I 101 00:09:15,280 --> 00:09:19,040 haven't been able to track that down in the time I've had. So basically you can request your 102 00:09:19,040 --> 00:09:23,560 context root with a null character after it, .JSP, and you can certainly get a directory listing, 103 00:09:23,740 --> 00:09:28,020 which is obviously a lot more interesting than just getting the static files because they have to 104 00:09:28,020 --> 00:09:32,660 have directory listing enabled and most sites aren't going to be doing that, we hope. There are 105 00:09:32,660 --> 00:09:39,800 times when you actually have to use a period in front of the directory. This is usually the case 106 00:09:39,800 --> 00:09:45,880 with the context root where you have to do a percent, a dot, percent 00. Interesting enough, in 107 00:09:45,880 --> 00:09:49,020 some cases you can actually do a dot, dot, but it has to be a dot, dot, dot, dot, dot, dot, dot, 108 00:09:49,020 --> 00:09:53,640 the way that was handled the .dot normalization and checks to make sure you're not getting 109 00:09:53,640 --> 00:09:59,400 outside of the war is pretty specific except it only checks for slash, dot, dot, slash. So you can 110 00:09:59,400 --> 00:10:05,940 actually use this to read the contents of the exploded war, I mean the exploded ear. It's kind 111 00:10:05,940 --> 00:10:09,020 of one of these things where you see it and you're like oh, I can almost get those files but I 112 00:10:09,020 --> 00:10:16,580 can't. So it's rather frustrating, honestly. But you can do it. So this is a lot better than just 113 00:10:16,580 --> 00:10:19,000 serving up static files to the JSB engine. Suddenly we get a lot more static files to the JSB 114 00:10:21,200 --> 00:10:26,080 files that you may have left in there in terms of files that are 115 00:10:26,080 --> 00:10:28,440 being added to the war in the process of this application 116 00:10:28,440 --> 00:10:32,520 running. Which sometimes in and of itself can be a lot of 117 00:10:32,520 --> 00:10:36,120 interesting information. Dealt with once application that put 118 00:10:36,120 --> 00:10:40,220 all its logs inside the exploded war. Once you found out the 119 00:10:40,220 --> 00:10:44,080 directories you could get them all. So we have to circle back 120 00:10:44,080 --> 00:10:46,880 here and go talk about the Webster plug-in. In most 121 00:10:46,880 --> 00:10:51,780 instances of laws you're not going to see direct connections 122 00:10:51,780 --> 00:10:53,780 to laws that aren't going through the plug-in or some sort 123 00:10:53,780 --> 00:10:57,020 of proxy in front of it. There are good reasons for this 124 00:10:57,020 --> 00:11:01,460 primarily dealing with speed and static contact especially. So 125 00:11:03,300 --> 00:11:07,060 the plug-in wasn't really designed for security but in 126 00:11:07,060 --> 00:11:11,800 some cases it gets in the way of insecurity too. So I don't 127 00:11:11,800 --> 00:11:14,760 know if that really means it's a security device or not. But the 128 00:11:14,760 --> 00:11:16,860 problem is that there's a lot of information out there that 129 00:11:16,880 --> 00:11:21,260 goes into it. So going for a null byte in was is easy. But the 130 00:11:21,260 --> 00:11:25,260 plug-in is written in C and so it really doesn't like the null 131 00:11:25,260 --> 00:11:28,440 character. It terminates your string and instead of getting 132 00:11:28,440 --> 00:11:33,040 your test.txt you get test.txt which was then just tries to 133 00:11:33,040 --> 00:11:35,780 serve out as a normal static file and if you're not serving static 134 00:11:35,780 --> 00:11:38,100 files then you can't get it. Or if you're trying to do a 135 00:11:38,100 --> 00:11:41,180 directory. So the next challenge in this puzzle in terms of how 136 00:11:41,180 --> 00:11:44,580 to actually do something useful with this vulnerability is to 137 00:11:44,580 --> 00:11:46,860 figure out how to get nulls past the plug-in. So the next 138 00:11:46,880 --> 00:11:53,020 plug-in. So character encodings. This also qualifies as one of 139 00:11:53,020 --> 00:11:55,160 those things that if you think something is generally known by 140 00:11:55,160 --> 00:12:01,520 the industry, check. Most of the character codings we deal with 141 00:12:01,520 --> 00:12:05,680 are either ASCII, ISO, Latin in the United States. Internal to 142 00:12:05,680 --> 00:12:12,480 Java you have UTF-16, UCF-16, UTF-16. But what may not be 143 00:12:12,480 --> 00:12:15,600 known is that UTF-8 is actually how Java reads strings natively. 144 00:12:15,640 --> 00:12:16,860 So even though it keeps it in a string, it's not necessarily 145 00:12:16,860 --> 00:12:24,020 a memory in UTF-16. It actually reads them as UTF-8. And so UTF-8 is 146 00:12:24,020 --> 00:12:28,320 a multi-byte character encoding. It's actually a rather elegant 147 00:12:28,320 --> 00:12:32,860 character encoding. If you follow the character encoding improperly, 148 00:12:33,380 --> 00:12:36,680 if you just do a default implementation and don't really think about it, 149 00:12:37,020 --> 00:12:40,060 single byte characters and actually any smaller than the full maximum 150 00:12:40,060 --> 00:12:45,140 byte characters can be actually encoded as multiple bytes. This is 151 00:12:45,140 --> 00:12:50,920 explicitly forbidden by the spec. But if you follow specs, come on. 152 00:12:52,200 --> 00:12:55,180 Actually there's a lot that don't. You may remember there have been a 153 00:12:55,180 --> 00:12:58,820 lot of Microsoft IIS exploits that have utilized this. And it turns 154 00:12:58,820 --> 00:13:05,260 out that Java also used to do this as well. It decodes early long ones. 155 00:13:05,360 --> 00:13:09,000 This was made known as part of another Tomcat vulnerability by 156 00:13:09,000 --> 00:13:12,320 Simon and William. And I'm not going to try to pronounce that 157 00:13:12,320 --> 00:13:15,120 sentence. Sorry. It was fixed in a way that it was a little bit 158 00:13:15,140 --> 00:13:19,280 fixed by Sun and their JVM quite some time ago. And it was also fixed 159 00:13:19,280 --> 00:13:23,020 by IBM. They share a lot of common code and so they share a lot of security 160 00:13:23,020 --> 00:13:28,980 fixes. The problem is that for some reason IBM's fix didn't work. It 161 00:13:28,980 --> 00:13:32,140 actually has to deal with the fact that Sun's JVM now by default uses 162 00:13:32,140 --> 00:13:36,740 NIO. And so when IBM took that patch and applied it to their JVM, they 163 00:13:36,740 --> 00:13:42,720 didn't think about the fact that their JVM doesn't use NIO by default to 164 00:13:42,720 --> 00:13:45,120 read strings. And apparently they never tested this. So it's a little bit 165 00:13:45,120 --> 00:13:47,500 different. One of the morals of the story is test your security patches. 166 00:13:48,920 --> 00:13:53,800 This has really been fixed. And these are new releases of the JVM. 167 00:13:54,240 --> 00:13:57,340 Very thankfully. Unfortunately this is not any WOS fix packs yet. So 168 00:13:57,340 --> 00:14:00,320 you're still looking at having this particular encoding issues in WOS 169 00:14:00,320 --> 00:14:03,640 unless you actually install JVM by hand. I don't know if they're going to do an 170 00:14:03,640 --> 00:14:06,460 iFix of this. The IBM folks have been very nice about all this actually. 171 00:14:07,940 --> 00:14:11,720 So let's talk about UTF-8 then and what we can do with that with the Web 172 00:14:11,720 --> 00:14:15,100 Server plug-in. Well, the plug-in is in C. And it's a little bit 173 00:14:15,100 --> 00:14:19,220 different. It handles single byte characters. So ASCII and ISO Latin. And 174 00:14:19,220 --> 00:14:23,180 it doesn't know anything about UTF-8 and especially not overly long UTF-8 175 00:14:23,180 --> 00:14:27,800 characters. So if WOS isn't in Java using a JVM that accepts overly long 176 00:14:27,800 --> 00:14:32,920 UTF-8 characters, then we can just instead of doing a percent 00, we can do 177 00:14:32,920 --> 00:14:39,400 a C080.JSP and suddenly we bypass the plug-in's problem with the null and we 178 00:14:39,400 --> 00:14:44,340 get our null to the back in Java in WOS and we can actually get these files. 179 00:14:45,200 --> 00:14:50,400 So plug-in is no longer an obstacle to doing anything fun with this. This 180 00:14:50,400 --> 00:14:55,820 gets a little bit better. So we mentioned that WebInf and MetaInf, again back 181 00:14:55,820 --> 00:15:00,900 here on WOS, are not accessible. If you look at the spec, the service specification 182 00:15:01,780 --> 00:15:04,900 explicitly says that you're supposed to return a 404 for anything inside 183 00:15:04,900 --> 00:15:09,780 MetaInf or WebInf. This has actually been a source of major problems for a long time. 184 00:15:09,960 --> 00:15:14,700 If you actually go and grab all the class files in WOS, you'll find that it's checked 185 00:15:15,100 --> 00:15:19,640 a ridiculous number of times. And they still missed one. There may be other ones 186 00:15:19,640 --> 00:15:24,700 unfortunately. It turns out that their file serving servlet that handles when file serving is 187 00:15:24,700 --> 00:15:30,240 enabled actually talks about, actually allows a slash dot slash WebInf dot slash Web.XML. 188 00:15:30,400 --> 00:15:33,720 So you can actually grab files outside of the WebInf directory. If you're not familiar with 189 00:15:33,720 --> 00:15:38,040 Java or web applications, this is where all your configuration is. This is where a lot of your 190 00:15:38,040 --> 00:15:44,560 code actually is, too, that you can then download and decompile. So this was fixed in PK643 191 00:15:44,560 --> 00:15:45,080 or something like that. So this was fixed in PK643 or something like that. So this was fixed 192 00:15:45,100 --> 00:15:49,560 in PK02, the kind of security expand of file serving feature enabled. 193 00:15:50,180 --> 00:15:52,080 There was no details released about this. 194 00:15:52,560 --> 00:15:55,980 So there may be other things that were fixed on the same fixpack. I'm not sure. I 195 00:15:55,980 --> 00:16:00,340 never really analyzed it. But I know it didn't work afterwards. So surely it 196 00:16:00,340 --> 00:16:02,380 didn't just check this in the file server... 197 00:16:03,920 --> 00:16:10,120 Well, yeah. So if you do a dot slash in WebInf, you can actually get it it through 198 00:16:10,120 --> 00:16:14,680 the JSP engine as well. Which is obviously a problem. The plug-in also, however, normalizes 199 00:16:15,100 --> 00:16:18,840 that we have to play our coding games again to get around that. 200 00:16:19,040 --> 00:16:22,720 But in which case we can still go in and get the web.XML 201 00:16:22,720 --> 00:16:26,460 configuration for your web application by using percent zero 202 00:16:26,460 --> 00:16:29,960 percent AE which is an overly long period in our path which the 203 00:16:29,960 --> 00:16:34,700 plugin does not recognize and then our percent zero percent eight 204 00:16:34,700 --> 00:16:38,480 zero which is an overly long null byte and suddenly we actually 205 00:16:38,480 --> 00:16:42,860 get the web.XML. This was fixed along with percent zero zero 206 00:16:42,860 --> 00:16:49,080 dot JSP issue and PK81387 which I was surprised talking to one of 207 00:16:49,080 --> 00:16:52,860 the IBM architects and he said this is the only number he can 208 00:16:52,860 --> 00:16:55,600 remember for fixed facts so they worked really hard on it. 209 00:16:56,700 --> 00:17:00,300 Possible application source file exposure which hopefully everybody 210 00:17:00,300 --> 00:17:03,200 has applied at this point. This also works for meta in case you 211 00:17:03,200 --> 00:17:07,800 want to go look at things that are left in there. So the big 212 00:17:07,800 --> 00:17:11,100 question is is this the whole truth? And nothing but the 213 00:17:11,100 --> 00:17:11,300 truth? 214 00:17:13,780 --> 00:17:17,060 You can actually make possible application source file actually 215 00:17:17,060 --> 00:17:21,480 be remote code execution in many instances. So again back here in 216 00:17:21,480 --> 00:17:25,760 WAS instead of the plugin we look at JSP striking back. If you 217 00:17:25,760 --> 00:17:28,720 remember we locate a file, translate it to JSP Java, we 218 00:17:28,720 --> 00:17:34,900 compile it and then we run it as a servlet. So if we can get a 219 00:17:34,900 --> 00:17:38,300 file into the WAR we can get remote code execution through 220 00:17:38,300 --> 00:17:42,840 this method. So I was looking at web application source file 221 00:17:42,840 --> 00:17:45,120 application and I had an interesting discovery playing 222 00:17:45,120 --> 00:17:48,560 this game with web imps. Here's a listing of the directory of web 223 00:17:48,560 --> 00:17:50,180 imps and there's this attachments directory. Does 224 00:17:50,180 --> 00:17:53,660 anybody know what that attachments directory is? I'm 225 00:17:53,660 --> 00:17:58,060 just curious. So what it turns out to be is that Apache access 226 00:17:58,060 --> 00:18:01,300 one implements soap with attachments. This is not access 227 00:18:01,300 --> 00:18:03,120 two. We're talking about access one which is a little older. 228 00:18:03,400 --> 00:18:06,140 Okay. For those of you not familiar with soap with 229 00:18:06,140 --> 00:18:09,200 attachments, it is implemented very similar to our e-mail. It 230 00:18:09,200 --> 00:18:12,540 uses mind headers and actually goes through and attaches things 231 00:18:12,540 --> 00:18:12,820 as much as possible. So it's a little bit more complicated. 232 00:18:12,820 --> 00:18:14,260 You can see that this is a very simple way to get this 233 00:18:14,260 --> 00:18:19,300 information to the main request so that you have a soap, soap 234 00:18:19,300 --> 00:18:21,840 envelope with all of its goodies and then you have your 235 00:18:21,840 --> 00:18:24,660 attachments that are referenced from your soap service. Okay? 236 00:18:25,900 --> 00:18:29,520 When large files actually go through access, it catches them 237 00:18:29,520 --> 00:18:31,760 to disk so that you're not running your application server 238 00:18:31,760 --> 00:18:33,900 out of memory in the process of handling soap attachments, 239 00:18:34,360 --> 00:18:37,340 anything over 32 kilobytes. And by default, these get put into 240 00:18:37,340 --> 00:18:41,300 the web imp attachments directory. So this directory is 241 00:18:41,300 --> 00:18:42,800 created, if not present, at some point, it's actually going to 242 00:18:42,820 --> 00:18:50,920 startup. And guess what it was? But not their JAX WS 243 00:18:50,920 --> 00:18:53,100 implementation which is of course based on AXS 2 instead. 244 00:18:54,520 --> 00:18:58,320 So Apache AXS actually has some interesting bugs that make this 245 00:18:58,800 --> 00:19:03,240 less true than you would think. It's very good at optimizing how 246 00:19:03,240 --> 00:19:07,220 it reads in attachments from the network. So if your service 247 00:19:07,220 --> 00:19:09,200 actually doesn't handle attachments, it doesn't even 248 00:19:09,200 --> 00:19:11,280 bother reading them. So it doesn't get to the point where 249 00:19:11,280 --> 00:19:13,400 we're actually caches of the disk, which is rather frustrating 250 00:19:13,400 --> 00:19:16,040 because we have to find a SOAP service that handles 251 00:19:16,040 --> 00:19:19,920 attachments. And at least in my, where I work, we don't have very 252 00:19:19,920 --> 00:19:23,100 many of those, if any. So it's a lot rarer to have this, which 253 00:19:23,100 --> 00:19:27,260 makes our attack a little harder. So it occurred to me, 254 00:19:27,320 --> 00:19:29,580 well, what happens if we just, you know, you have a series of 255 00:19:29,580 --> 00:19:32,160 MIME attachments, you know, instead of putting the SOAP 256 00:19:32,160 --> 00:19:34,280 body first like everybody does, what if we put our attachment 257 00:19:34,280 --> 00:19:37,140 before the SOAP body and, you know, so that our attachment 258 00:19:37,140 --> 00:19:40,660 has to be read before it reads the actual SOAP message. 259 00:19:41,280 --> 00:19:44,360 Well, it turns out that that actually works, but there's this 260 00:19:44,360 --> 00:19:47,640 other little bug in access, the way it handles third local 261 00:19:47,640 --> 00:19:50,640 variables, that if you do that, it actually saves it to another 262 00:19:50,640 --> 00:19:52,720 file system directory, specifically where your temp 263 00:19:52,720 --> 00:19:55,180 directory is for Java I.O., which is, you know, usually 264 00:19:55,180 --> 00:20:00,740 slash temp on Unix machines. So great. We can DOS two file 265 00:20:00,740 --> 00:20:02,920 systems instead of one with access. That doesn't really help 266 00:20:02,920 --> 00:20:06,960 us very much. So let's talk about SOAP encoding. SOAP 267 00:20:06,960 --> 00:20:10,080 encoding actually allows you to reference attachments. We just 268 00:20:10,080 --> 00:20:11,260 need to reference an attachment. We don't need to 269 00:20:11,280 --> 00:20:14,340 do that, and it'll read them in. It allows us href attributes to 270 00:20:14,340 --> 00:20:19,520 be applied to parameters and such inside our SOAP message. So 271 00:20:20,060 --> 00:20:24,980 when you use Apache one, Apache access one, it'll actually parse 272 00:20:24,980 --> 00:20:29,120 the attachments and pass the large ones to our disk where we 273 00:20:29,120 --> 00:20:32,520 want them inside our web directory. So this, of course, 274 00:20:32,560 --> 00:20:34,620 requires that we have a web service that's actually using 275 00:20:35,260 --> 00:20:38,520 SOAP encoding. So we're talking here about RPC encoded 276 00:20:38,520 --> 00:20:41,260 messages, as opposed to document literal lines. So we're talking 277 00:20:41,260 --> 00:20:44,760 about RPC literal, which are different methods of using SOAP. 278 00:20:45,680 --> 00:20:50,100 I swear this is not my fault. Access one provides an 279 00:20:50,100 --> 00:20:53,620 interesting feature, which unfortunately is not present in 280 00:20:53,620 --> 00:20:58,640 the WAS implementation, the WAS extension of Apache access one. 281 00:20:58,880 --> 00:21:03,120 So we can't use it directly with WAS. And what happens is 282 00:21:03,120 --> 00:21:06,740 that the client, for whatever strange reason, can actually 283 00:21:06,740 --> 00:21:11,240 send a fault to the server as an initial request. Usually, this 284 00:21:11,260 --> 00:21:14,060 isn't something that should be happening, so not surprisingly, 285 00:21:14,060 --> 00:21:18,140 the server says, what? You sent me a fault. I'm supposed to send 286 00:21:18,140 --> 00:21:22,700 you a fault, not vice versa. But the nice thing is that it parses 287 00:21:22,700 --> 00:21:28,960 it anyway first. And just for fun, SOAP is encoding. SOAP 288 00:21:28,960 --> 00:21:32,420 encoding. So we can send attachments with them, too. So 289 00:21:32,420 --> 00:21:34,420 not only are we sending a fault, we're sending a fault with an 290 00:21:34,420 --> 00:21:39,040 attachment. And it also doesn't require any web services to be 291 00:21:39,040 --> 00:21:41,240 actually configured in access one. So we can send an 292 00:21:41,260 --> 00:21:43,420 attachment. It just requires the exposure to access one 293 00:21:43,420 --> 00:21:47,580 server itself, which is plenty enough to actually get this to 294 00:21:47,580 --> 00:21:53,280 work. So let's talk about actually how to use this. We 295 00:21:53,280 --> 00:21:55,100 have to put together a lot of things here to make this actually 296 00:21:55,100 --> 00:21:58,420 work. First, the attachment file names are, you know, fairly 297 00:21:58,420 --> 00:22:01,560 random. And the first thing we have to do to actually exploit 298 00:22:01,560 --> 00:22:04,840 this is we have to connect the WAS, use the JSP bug to figure 299 00:22:04,840 --> 00:22:06,700 out what's currently in the attachment's directory. 300 00:22:07,720 --> 00:22:10,320 Baseline that. Then we send up our attachment as a SOAP fault. 301 00:22:11,260 --> 00:22:13,700 Then we get a directory listing after that. And we go through 302 00:22:13,700 --> 00:22:17,380 and find out the JSP that we put in there, the file we put in 303 00:22:17,380 --> 00:22:20,960 there. And we pressed it as JSP. At which point the file is 304 00:22:20,960 --> 00:22:25,000 transferred to Java, file, and run. Which means we've achieved 305 00:22:25,000 --> 00:22:28,720 remote co-institution on WAS with all of it. So demonstrate 306 00:22:28,720 --> 00:22:33,180 this. We have a little cute SOAP shell over JSP which baselines 307 00:22:33,180 --> 00:22:35,820 the attachment directly, uploads the JSP with the SOAP fault, 308 00:22:36,500 --> 00:22:41,160 finds new attachments, and then checks that it actually has this 309 00:22:41,260 --> 00:22:43,380 attachment in case the service is already handling attachments, 310 00:22:43,920 --> 00:22:46,920 in which case you have to find your own. There is a race 311 00:22:46,920 --> 00:22:49,960 condition here on some servers depending on how they're 312 00:22:49,960 --> 00:22:53,220 configured and how the timeout is, especially in a WAS instance 313 00:22:53,220 --> 00:22:56,560 it's deployed for development instead of production. So in our 314 00:22:56,560 --> 00:22:59,600 case we need to copy our JSP quickly out of that directory so 315 00:22:59,600 --> 00:23:01,700 it doesn't get removed while we're using it, which is kind of 316 00:23:01,700 --> 00:23:05,680 frustrating. And then it brought the standard input and standard 317 00:23:05,680 --> 00:23:10,760 output from command line to over HTTP to the server. So if 318 00:23:11,260 --> 00:23:13,480 we use this, and finally when it's done, it removes itself. 319 00:23:14,200 --> 00:23:17,280 This is exceptionally noisy in the logs so it's not exactly very 320 00:23:17,280 --> 00:23:19,940 useful for anything but a demo, but it's great for demos. So 321 00:23:19,940 --> 00:23:30,120 let's do this. Here I have a WAS 7.0 instance, 7.0 fix pack 1 322 00:23:30,120 --> 00:23:33,080 which is the last fix pack that was vulnerable. Inside of this I 323 00:23:33,080 --> 00:23:36,160 have the demo application which is going to be on the website 324 00:23:36,800 --> 00:23:41,240 this afternoon that is running. And I'm going to go ahead and 325 00:23:41,260 --> 00:23:43,200 run it. And it actually is being accessed through the plug-in 326 00:23:43,200 --> 00:23:48,280 which gives us our plug-in page. And the access servlet is 327 00:23:48,280 --> 00:23:53,700 actually mapped to the slash access 1. At this point we can, 328 00:23:55,760 --> 00:24:00,240 we have a shell script that is running our Java exploit that 329 00:24:00,240 --> 00:24:06,800 takes the context root directory and then the relative path to 330 00:24:06,800 --> 00:24:08,860 the access 1 servlet and gives a command name that we want to 331 00:24:08,860 --> 00:24:11,240 execute. And in this case we want to execute the access root 332 00:24:14,380 --> 00:24:16,960 directory and then the shell. So in this case we see it 333 00:24:16,960 --> 00:24:19,180 updating and baselining it and then we're hitting it very 334 00:24:19,180 --> 00:24:22,460 quickly in this case because this instance is running in dev 335 00:24:22,460 --> 00:24:26,660 development mode and therefore it removes our attachment very 336 00:24:26,660 --> 00:24:29,620 quickly. It then finds it, baselines it, and it gives us a 337 00:24:29,620 --> 00:24:34,700 shell of the server, on the server. So, and we have full 338 00:24:34,700 --> 00:24:36,300 access to the server that's running WAS. 339 00:24:43,040 --> 00:24:46,160 This tends to make WAS really unhappy incidentally when 340 00:24:46,160 --> 00:24:48,460 they start executing commands. It's actually much more 341 00:24:48,460 --> 00:24:50,860 efficient if you actually want to exploit WAS to actually, you 342 00:24:50,860 --> 00:24:54,280 know, run stuff in your JSP and have stuff natively stored inside 343 00:24:54,280 --> 00:24:57,320 of WAS instead of creating a shell because most admins get a 344 00:24:57,320 --> 00:25:01,500 little fishy when they see a PS list that includes a shell being 345 00:25:01,500 --> 00:25:04,600 launched from WAS because it really shouldn't happen. So 346 00:25:05,400 --> 00:25:09,200 afterwards we just remove the JSP and we're done. So we clean 347 00:25:09,200 --> 00:25:11,240 up after ourselves and hopefully, you know, we're 348 00:25:11,260 --> 00:25:12,780 not going to be noticed. But with that exploit it's very 349 00:25:12,780 --> 00:25:18,300 noisy. So people will notice. Hopefully. Not that you couldn't 350 00:25:18,300 --> 00:25:23,440 do it a different way. So let's talk about fixes. This has been 351 00:25:23,440 --> 00:25:27,720 fixed. First we have the affected platforms. WAS runs on 352 00:25:27,720 --> 00:25:30,480 an unbelievable number of platforms. I counted 15 and I'm 353 00:25:30,480 --> 00:25:32,620 pretty sure I'm wrong. I'm pretty sure it's more than that 354 00:25:32,620 --> 00:25:35,380 when you consider everything. AX and Linux were the ones I dealt 355 00:25:35,380 --> 00:25:39,680 with explicitly because that's what we run. Case insensitive 356 00:25:39,680 --> 00:25:41,240 file systems actually are interesting because they're 357 00:25:41,260 --> 00:25:46,560 not vulnerable to the JSP bug. This actually I believe has to do 358 00:25:46,560 --> 00:25:50,000 with an earlier fix for security problems with case insensitive 359 00:25:50,000 --> 00:25:53,920 file systems. The only one I know of is of course Windows that WAS 360 00:25:53,920 --> 00:25:56,440 runs on. So if you're running Windows you don't have to worry 361 00:25:56,440 --> 00:25:59,360 about this one. Well, you still have to worry about the encoding 362 00:25:59,360 --> 00:26:03,580 issues and that. The overly long UTF-8 encoding obviously depends 363 00:26:03,580 --> 00:26:07,820 on the JVM that's in use on the application server. In non-IBM 364 00:26:07,820 --> 00:26:11,000 JVMs hopefully this will be fixed before the IBM one at this 365 00:26:11,000 --> 00:26:15,180 point. Those two that I know of are going to be HPUX which runs 366 00:26:15,180 --> 00:26:18,020 on the HPVM, JVM and Solaris which runs on the Sun one 367 00:26:18,020 --> 00:26:23,640 obviously. In terms of versions 6.0 was fixed in 6.0.3.5 which 368 00:26:23,640 --> 00:26:27,900 is the same as 6.0.2.3 which is fixed pack 35. 6.1 was in fixed 369 00:26:27,900 --> 00:26:33,140 pack 23. 7.0 fixed pack 3. And other versions you can apply the 370 00:26:33,140 --> 00:26:35,980 IFIX. There was also fixed packs for 5.1 and 5.2 but I don't have 371 00:26:35,980 --> 00:26:40,320 access to those to try them. So hopefully you have this done. 372 00:26:41,220 --> 00:26:46,640 Let's talk about IBM for a second. 15 platform variants that 373 00:26:46,640 --> 00:26:49,160 I count. I'm on the low side. I'm pretty sure because I didn't 374 00:26:49,160 --> 00:26:52,440 count things like IA64 for Windows and such. Four maintained 375 00:26:52,440 --> 00:26:56,120 versions about 60 different variants. Can you guess how 376 00:26:56,120 --> 00:27:03,920 long it took them to fix this? Ballpark? Eight months? How 377 00:27:03,920 --> 00:27:08,840 about two weeks? I'm impressed. How do you do 60 different 378 00:27:08,840 --> 00:27:10,980 variants in two weeks out of a public library? I don't know. I 379 00:27:12,860 --> 00:27:18,000 was very surprised. If you are dealing with IBM for security 380 00:27:18,000 --> 00:27:21,280 vulnerabilities I would recommend that when possible you always 381 00:27:21,280 --> 00:27:24,400 submit them as a PMR that is a service request because that is 382 00:27:24,400 --> 00:27:26,500 how they handle everything related to their software and if 383 00:27:26,500 --> 00:27:30,120 you don't do it that way you're kind of in the la la land where 384 00:27:30,120 --> 00:27:32,500 they're not sure what they're doing and you may get forgotten 385 00:27:32,500 --> 00:27:34,760 about but if you do as a PMR they will get it done and 386 00:27:34,760 --> 00:27:37,560 sometimes they can do absolutely amazing things like two weeks to 387 00:27:37,560 --> 00:27:40,660 fix this sort of thing. They also kicked off a lot of people too as 388 00:27:41,000 --> 00:27:44,520 we'll talk about in a second. Their fix is actually very 389 00:27:44,520 --> 00:27:49,660 elegant. This is my pseudocode for it. Basically they look at the 390 00:27:49,660 --> 00:27:51,780 file they're trying to open and they ask the operating system to 391 00:27:51,780 --> 00:27:53,720 canonicalize it and they compare the two and say is this 392 00:27:53,720 --> 00:27:56,560 really the file I'm opening and if they don't match it I'll throw 393 00:27:56,560 --> 00:28:01,600 it as a 404 which is nice. This actually has problems, it caused 394 00:28:01,600 --> 00:28:04,960 a lot of problems with people running on UNIX systems that for 395 00:28:04,960 --> 00:28:08,220 whatever reason were putting symbolic links in their exploded 396 00:28:08,220 --> 00:28:10,980 wires because that will fail. That's the problem. That's the 397 00:28:11,000 --> 00:28:14,720 test right there because the canonicalization of a file path 398 00:28:14,720 --> 00:28:17,880 in UNIX will actually return the absolute path not the symbolic 399 00:28:17,880 --> 00:28:21,160 link. So that was a problem. There's some fixes for that. I 400 00:28:21,160 --> 00:28:25,200 haven't looked at it specifically. The webmfix is not 401 00:28:25,200 --> 00:28:27,900 quite as elegant. They just check to make sure you don't 402 00:28:27,900 --> 00:28:31,060 have webmf anywhere in the URL path which solves this problem. 403 00:28:31,440 --> 00:28:36,100 It does work very well. My guess is if you try to have a 404 00:28:36,100 --> 00:28:39,340 subdirectory that's called webmf it won't work but hopefully that 405 00:28:39,340 --> 00:28:40,320 shouldn't happen too frequently. 406 00:28:41,100 --> 00:28:43,940 So before we talk about workarounds we're going to talk 407 00:28:43,940 --> 00:28:48,380 about some workarounds that you can do. But first, you're more 408 00:28:48,380 --> 00:28:51,380 than a year behind on patches at this point if you're working in 409 00:28:51,380 --> 00:28:53,720 workarounds. It's a really good thing you're not running on 410 00:28:53,720 --> 00:28:59,100 other servers. So the best workaround that I like the best 411 00:28:59,100 --> 00:29:02,120 is actually disable the runtime compilation and reloading of 412 00:29:02,120 --> 00:29:05,300 JSPs. This is a little frustrating. The information 413 00:29:05,300 --> 00:29:07,180 center will actually tell you you can disable it at the 414 00:29:07,180 --> 00:29:10,900 application level. This is done with putting some specific 415 00:29:12,240 --> 00:29:17,860 features into the IBM web. There used to be a way to do this 416 00:29:17,860 --> 00:29:19,900 at the container level. It's still in the information center 417 00:29:19,900 --> 00:29:22,320 and I can't get it to work. So I don't believe it's supported 418 00:29:22,320 --> 00:29:26,020 anymore. This makes the fix a little hard because you're 419 00:29:26,020 --> 00:29:28,100 dealing with it at an application level instead of 420 00:29:28,100 --> 00:29:32,600 actually doing it on your entire server or your cell. Of course 421 00:29:32,600 --> 00:29:35,460 once you disable runtime compilation JSPs you're going to 422 00:29:35,460 --> 00:29:38,580 want to make sure that you precompile your JSPs either at 423 00:29:38,580 --> 00:29:40,980 deployment time or batch compilation. You want to make 424 00:29:41,000 --> 00:29:42,400 sure that you precompile them before you go in there. Doing 425 00:29:42,400 --> 00:29:46,180 that works great. The other way to do this is to block JSPs. 426 00:29:46,940 --> 00:29:49,880 Which we have to talk about a little bit. Of course if you 427 00:29:49,880 --> 00:29:52,960 actually need direct access to JSPs this is not going to work. 428 00:29:53,040 --> 00:29:55,300 It's going to break your application. But for a lot of 429 00:29:55,300 --> 00:29:57,360 people these days who are using all of your controller whether 430 00:29:57,360 --> 00:30:02,140 that's Struts or Spring MVC or some other web framework usually 431 00:30:02,140 --> 00:30:05,080 your JSPs are only in views and only forwarded to internally so 432 00:30:05,080 --> 00:30:08,720 you actually can do this without breaking stuff. There's a lot 433 00:30:08,720 --> 00:30:10,980 more issues here that we can talk about before blocking JSPs. 434 00:30:11,920 --> 00:30:15,660 So I've got a question. What are the following byte sequences 435 00:30:15,660 --> 00:30:22,020 having call on if the title is a giveaway? So AD through C1BF. I'm 436 00:30:22,020 --> 00:30:24,820 not going to read these. They're all invalid byte 437 00:30:24,820 --> 00:30:31,380 sequences for UCF8. Guess what the IBM JVM does with them? This 438 00:30:31,380 --> 00:30:36,580 is the fixed JVM. Any of you think this is a problem? It's an 439 00:30:36,580 --> 00:30:40,980 empty string. This actually in the untranslated version of the 440 00:30:41,000 --> 00:30:43,460 fixed JVM. It only does it for AD through FF because they didn't 441 00:30:43,460 --> 00:30:46,500 consider over long invalid anymore. This is obviously very 442 00:30:46,500 --> 00:30:48,920 useful for IDS invasion because you can throw as many invalid 443 00:30:48,920 --> 00:30:53,040 UCF8 characters into your URL as you want and the IBM JVM will 444 00:30:53,040 --> 00:30:57,080 ignore them when it parses them. So suddenly you can be 445 00:30:57,080 --> 00:31:00,880 requesting a whole path and replace every other add a new 446 00:31:00,880 --> 00:31:05,180 character, new invalid percent 80 or something invalid UCF8 code 447 00:31:05,180 --> 00:31:08,760 anywhere you want and get around it. Of course this also makes 448 00:31:08,760 --> 00:31:10,980 it very difficult to write JSPs. It's not going to be 449 00:31:11,000 --> 00:31:15,140 blocking rules. So if you're going to write a JSP blocking 450 00:31:15,140 --> 00:31:18,640 rule you have to worry about this. And there's lots of fun 451 00:31:18,640 --> 00:31:22,240 games you can play with encoding issues honestly. The other thing 452 00:31:22,240 --> 00:31:24,220 you need to remember if you're going to try to block JSPs is 453 00:31:24,220 --> 00:31:28,280 that there's more than JSP that by default was. Start at JSP, 454 00:31:28,400 --> 00:31:32,480 start at JSW are also handled as JSPs and in some cases also start 455 00:31:32,480 --> 00:31:37,480 at JSPX. Of course if you're using newer versions. So if 456 00:31:37,480 --> 00:31:40,980 you're actually going to go and try to do blocking JSPs you're 457 00:31:41,000 --> 00:31:42,520 going to have to use the JSP rules. You need to actually use 458 00:31:42,520 --> 00:31:46,780 the UTF8 decoding. Got to keep that in mind. Got to keep the 459 00:31:46,780 --> 00:31:52,160 decoding of invalid ones, the replacement string and of course 460 00:31:52,160 --> 00:31:55,200 multiple JSP connections, extensions. At which point I 461 00:31:55,200 --> 00:31:57,140 would really recommend applying the patch because this is not 462 00:31:57,140 --> 00:32:00,500 trivial to do. One of my friends tried. He did a good job on it 463 00:32:00,500 --> 00:32:04,220 actually but it was not very pretty. So a node in browsers 464 00:32:04,220 --> 00:32:06,700 it really goes home and starts playing with this. Don't forget 465 00:32:06,700 --> 00:32:10,860 that your browser will normalize your dots and such. It also does 466 00:32:11,000 --> 00:32:14,760 the same thing with URL encoding in some cases. Firefox and 467 00:32:14,760 --> 00:32:18,160 Windows actually for some reason will translate a percent to E into 468 00:32:18,160 --> 00:32:23,400 a slash which it won't do in Linux interestingly enough. If 469 00:32:23,400 --> 00:32:26,040 you're dealing with the plug in and load balancing you need to 470 00:32:26,040 --> 00:32:28,960 hit the same server every time obviously otherwise you're going 471 00:32:28,960 --> 00:32:31,640 to be bouncing between servers and the JSP that you upload may 472 00:32:31,640 --> 00:32:35,180 not be on the server you're hitting. So server affinity with 473 00:32:35,180 --> 00:32:40,420 the server plug in, the web server plug in is handled by the J session 474 00:32:41,000 --> 00:32:45,520 so JSP's by default on their first run actually give you a 475 00:32:45,520 --> 00:32:48,400 cookie. So as soon as you baseline the attachment 476 00:32:48,400 --> 00:32:50,580 directory you just need to make sure that you keep your cookie 477 00:32:50,580 --> 00:32:53,800 and you should be hitting the same server unless that server 478 00:32:53,800 --> 00:32:58,800 goes down. They never go down, right? So on the DEF CON CD 479 00:32:59,220 --> 00:33:03,140 there's one text file with the URL to a website because I missed 480 00:33:03,140 --> 00:33:07,640 the CD. I'm sorry. But on the website and I'll be uploading 481 00:33:07,640 --> 00:33:10,980 this. There are flights. There are a lot of flights. There are 482 00:33:11,000 --> 00:33:12,960 a lot of files. There's a tool to do the mapping of your JVM 483 00:33:12,960 --> 00:33:16,380 which actually will list out all the different byte combinations 484 00:33:16,380 --> 00:33:19,660 for UTF-8, go through them and then show you what they're being 485 00:33:19,660 --> 00:33:22,200 converted to and also what they do with the file system. Actually 486 00:33:22,200 --> 00:33:24,580 reveals some other issues with IBM JVM if you're interested. 487 00:33:25,820 --> 00:33:28,320 There's also a sample application that has nice URLs to 488 00:33:28,320 --> 00:33:30,920 try this on your own. Obviously you'll need to download the 489 00:33:30,920 --> 00:33:35,120 trial if you don't have WAS yourself. There's also an 490 00:33:35,120 --> 00:33:37,540 exploit for the access one faults that I showed you, the 491 00:33:37,540 --> 00:33:40,620 same one with the source code for all of the above. So there's a 492 00:33:40,620 --> 00:33:40,980 lot in there. There's a lot in there. There's a lot in there. 493 00:33:41,000 --> 00:33:43,480 And you're more than welcome to send me an e-mail on this and 494 00:33:43,480 --> 00:33:47,040 tell me that my code sucks. I would appreciate that actually. 495 00:33:47,920 --> 00:33:53,140 So in conclusion, any time you're dealing with a barrier 496 00:33:53,140 --> 00:33:56,020 between one implementation of a specification and another 497 00:33:56,020 --> 00:33:58,580 implementation of a special specification, whether it's 498 00:33:58,580 --> 00:34:01,420 UTF-8, whether it's HTTP, whatever it is, this is a 499 00:34:01,420 --> 00:34:04,220 really great place to look for bugs. In this case, of course, 500 00:34:04,280 --> 00:34:06,500 we did it between the plug-in and Java and then between Java 501 00:34:06,500 --> 00:34:09,620 and the OS. Now sometimes we have to deal with multiple cases. 502 00:34:11,660 --> 00:34:14,820 Some people, I talk to people about Java and I had to do Java 503 00:34:14,820 --> 00:34:18,560 for my job for the last several years. Not a lot of interest in 504 00:34:18,560 --> 00:34:20,700 Java, but these same sort of things actually happen in 505 00:34:21,240 --> 00:34:24,560 managed environments like Java and .net. And Java is of course 506 00:34:24,560 --> 00:34:27,380 not immune to that. And what I really like about this is that 507 00:34:27,380 --> 00:34:30,560 you have a small series of these little vulnerabilities that you 508 00:34:30,560 --> 00:34:34,140 write down your reports as low or medium and never get fixed. 509 00:34:34,460 --> 00:34:36,780 But sometimes when you can weave these all together, you can 510 00:34:36,780 --> 00:34:39,100 actually make something that really makes a big problem. 511 00:34:39,100 --> 00:34:45,180 So, with that, are there anybody who has questions about this?