1 00:00:00,250 --> 00:00:05,667 >> Good morning. I'd like to say it is nice to see all of you bright and early, but I can't 2 00:00:05,667 --> 00:00:10,167 see anybody at all right now so I've got bright lights in my face. We're going to be talking 3 00:00:10,167 --> 00:00:16,500 about Oracle data redaction and how it failed to protect data at the moment. Or actually not at 4 00:00:16,500 --> 00:00:22,917 the moment because it has to be patched so I won’t be dropped an 0day at the moment. But before 5 00:00:22,917 --> 00:00:30,957 we get there who am I? I'm David Lichtfield. I'm been a security researcher for 12, 14 years now 6 00:00:30,958 --> 00:00:38,667 or so. I work for some companies work with really cool people. At stake back in the day NCC, we 7 00:00:38,667 --> 00:00:48,060 were acquired by NCC back in 2008 and since then they Accu- vant. I'm working for a company 8 00:00:48,060 --> 00:00:56,980 in Australia called DataCom TSS well, TSS is a nice company. It's more for the sharks and 9 00:00:56,980 --> 00:01:08,120 Australian waters. Buffer exploitation was my forte. I enjoyed the bits and bytes but 10 00:01:08,125 --> 00:01:14,083 commercially I was driven towards database security. No one seemed to be doing it or 11 00:01:14,083 --> 00:01:21,458 doing it very well, and so basically I took a decision that I would get out of the bits and 12 00:01:21,458 --> 00:01:28,083 bytes; well to be fair, I still do a lot of bits and bytes because database obviously have 13 00:01:28,083 --> 00:01:32,875 data overflows. >> Probably the best bit of work I did was in 2003. I've not really done 14 00:01:32,875 --> 00:01:37,083 anything great since then or what I feel is good. When I wrote the first paper on 15 00:01:37,083 --> 00:01:42,483 defeating the MicroSoft stack protection and SafeSEH. Ever since then, I have not really 16 00:01:42,483 --> 00:01:56,460 been writing exploits (inaudible) To be fair I gave this presentation at BlackHat a few days ago and 17 00:01:56,460 --> 00:02:01,220 the person said the exploit you're doing now and I was like whoa whoa these are not exploits 18 00:02:01,220 --> 00:02:06,820 this is straight SQL so I just want to be fair about this. Obviously it might bypass security 19 00:02:06,820 --> 00:02:12,060 and everything but by todays standards I would not call these exploits. I've written a couple of 20 00:02:12,060 --> 00:02:17,320 books. The Oracle Hackers Handbook, The Database Hackers Handbook and some of the Windows exploit 21 00:02:17,320 --> 00:02:25,500 stuff in the Shellcoders Handbook. If you're interested in security or sharks, you can follow me at D 22 00:02:25,500 --> 00:02:31,042 Lichtfield on twitter or if you wander to have a session longer conversation not necessarily in 23 00:02:31,042 --> 00:02:35,702 public I can be contacted. 24 00:02:37,540 --> 00:02:45,040 So I want to put a framework or a foundation for this talk. At the beginning of this year 25 00:02:45,040 --> 00:02:50,360 Larry E said To the best of our knowledge an Oracle database hasn't been broken into in a 26 00:02:50,360 --> 00:02:58,340 couple of decades by anybody. (inaudible) I know, exactly. What? Who remembers Sony PlayStation 27 00:02:58,340 --> 00:03:03,040 Network breach in 2011? That was the biggest breach of it's kind to date. That was 28 00:03:03,042 --> 00:03:11,660 an Oracle based server. That senior Oracle management didn't know it was their database. It 29 00:03:11,660 --> 00:03:14,740 was criminal. He should spend less time on his boat and more time concentrating on his 30 00:03:14,740 --> 00:03:21,440 software. His CSO whom I'm actually quite friendly with, she's actually a nice person we 31 00:03:21,440 --> 00:03:27,120 just don't necessarily see eye to eye at a professional level. She said Customers 32 00:03:27,120 --> 00:03:32,600 should hold their vendors to a high standard. The only way to do that is through your 33 00:03:32,600 --> 00:03:42,200 checkbook. Pocketbook. Checkbook is UK. So essentially what she said is we need to be getting 34 00:03:42,200 --> 00:03:47,240 on our vendors cases. If they're not delivering a secure product we need to be voting with money. 35 00:03:47,240 --> 00:03:53,240 We should be buying other products. So standing by those words I would like to then 36 00:03:53,250 --> 00:03:59,690 continue this talk. I want to give you some background before we get to how we bypass Oracle 37 00:03:59,690 --> 00:04:06,340 Data Redaction, stuff like that I want to cut to the more interesting stuff. 38 00:04:06,340 --> 00:04:11,240 Let's do it from the beginning. So, the guy a few years ago about 12, 14 years ago called 39 00:04:11,250 --> 00:04:19,667 RFP, still around but he was one of the greatest researchers of our time and he did a lot of 40 00:04:19,667 --> 00:04:23,625 research into SQL injection. It wasn't called SQL injection at the time. 41 00:04:23,625 --> 00:04:30,820 In fact the term SQL injection was invented by Chip Andrews who manages SQLsecurity.com 42 00:04:30,820 --> 00:04:35,570 People were talking about things like sequence session at the time. RFP had written a couple papers 43 00:04:35,570 --> 00:04:40,370 and we had a conversation about it. I was like I've never really looked at database service. 44 00:04:40,370 --> 00:04:46,430 So it was actually RFP who got me into database server security and one of my 45 00:04:46,430 --> 00:04:49,610 colleagues, Chris H and I were doing a pentest on one of our customers back in servers 46 00:04:49,610 --> 00:04:56,210 and they had a Microsoft SQL server, this was back in the days when SQL was trivial to 47 00:04:56,210 --> 00:05:01,710 exploit and own and we discovered some new techniques that allowed us 48 00:05:01,710 --> 00:05:07,760 to workout what the backend was doing, come across the data structures and so I 49 00:05:07,760 --> 00:05:15,380 put together a paper called web application disassembly. This was my first venture into the 50 00:05:15,380 --> 00:05:23,660 database world essentially. And then we were kicking the hell out of Microsoft server. I wrote 51 00:05:23,660 --> 00:05:29,840 a paper called threat profiling SQL Server and then I covered a couple of buffer overflows 52 00:05:29,840 --> 00:05:36,340 Who remembers what happened on January 25th 2003? Slammer exactly. So there's a worm 53 00:05:36,340 --> 00:05:42,260 basically that came out and exploited a buffer overflow in Microsoft SQL server. It 54 00:05:42,260 --> 00:05:47,880 happened over UDP port 1434. And that was a bug I had discovered and spoken about 55 00:05:47,880 --> 00:05:53,560 at BlackHat and said listen if you don't patch this it will be the next big worm. The 56 00:05:53,560 --> 00:05:58,280 reason I'm including Microsoft is because I don't want to look like I'm just bashing Oracle. 57 00:05:58,280 --> 00:06:03,940 I'm bashing database servers in general because they should be secure but they're not. 58 00:06:03,940 --> 00:06:07,700 Well, they're much better these days. Anyway. 59 00:06:09,400 --> 00:06:16,440 Then Larry E. turned around announced his product was unbreakable and you know 60 00:06:16,440 --> 00:06:23,560 when everyone heard that JFK was assassinated they remember exactly what they 61 00:06:23,560 --> 00:06:27,440 were doing at that time. I remember exactly what I was doing when he said his 62 00:06:27,440 --> 00:06:33,620 product was unbreakable. I looked up from my keyboard and said what? >> [laughter] >> 63 00:06:33,620 --> 00:06:42,860 So my brother and I spent some time, 24 hours, and we sent Oracle 35-40 64 00:06:42,860 --> 00:06:47,960 critical flaws, many of them not requiring user ID and password to gain full control 65 00:06:47,960 --> 00:06:57,200 so much for an unbreakable Anyway that led to this ongoing love hate relationship with Oracle. 66 00:06:57,200 --> 00:07:06,360 Some more interesting patching stories we've had with Oracle, I want to, the reason I'm 67 00:07:06,360 --> 00:07:10,340 bringing this up is because as I said it's sort of setting the scene for where we are today and 68 00:07:10,340 --> 00:07:16,280 why we are called data re‑‑ the Oracle data redaction stuff is as bad as it is. It's not so 69 00:07:16,280 --> 00:07:20,240 much that it can be bypass. It's more representative of what's going on in the Oracle security 70 00:07:20,240 --> 00:07:26,240 world or their approach to security. Any way I want to give background. One of the reports I 71 00:07:26,250 --> 00:07:33,667 reported to them was essentially you could without user ID and password cause the database 72 00:07:33,667 --> 00:07:39,820 server to load an arbitrary library, execute an arbitrary function. Now the way this 73 00:07:39,820 --> 00:07:47,080 operates is through (inaudible) what happens when you have a PR package that sort of like PR 74 00:07:47,080 --> 00:07:54,958 sequel is the stuff that extends an Oracle database server, the, if you want to load 75 00:07:54,958 --> 00:08:03,538 the library and call a function or something like that what happens is the IBBMS, sorry, 76 00:08:03,542 --> 00:08:09,958 sorry, the IBBMS connects to the T nest listener the great way to all Oracle communications 77 00:08:09,958 --> 00:08:17,798 essentially so the database connects to the listener. When you execute this function it 78 00:08:17,800 --> 00:08:23,792 says no no I won't do that but I know a program that will. It launches a program and passes 79 00:08:23,792 --> 00:08:31,333 Oracle back, the handle sort of redirects it to a port basically and the Oracle connects to X 80 00:08:34,680 --> 00:08:42,660 pock loads the library and executes the function. There's no authentication going on 81 00:08:42,660 --> 00:08:47,417 there. IBBMS from the other side of the network and say to the listener will you load the 82 00:08:47,417 --> 00:08:54,958 library for me. It goes no way will I do that but I know a program that will. Lo and behold 83 00:08:54,958 --> 00:09:03,158 Xbox loads the library in this case in the case of windows executes the system function and 84 00:09:03,167 --> 00:09:11,020 executes an operating system without using any password and of course the network so that's 85 00:09:11,020 --> 00:09:15,500 pretty bad so I report this to Oracle of course because I'm one of these people who wander to 86 00:09:15,500 --> 00:09:22,820 find a bug and report it straight to the vendor, I'm quite happy nowadays but let's 87 00:09:22,820 --> 00:09:30,420 be honest about it, you know, computer security is a fine distinction am I report my bugs 88 00:09:30,420 --> 00:09:36,417 to the vendors when I find them and so Oracle said yeah, okay, we're going to fix this and what 89 00:09:36,417 --> 00:09:41,542 they do now or did at the time was basically turned around and said if someone attempts to do 90 00:09:41,542 --> 00:09:45,250 this we'll block it but we'll log it which is good because we want to see if someone is 91 00:09:45,250 --> 00:09:52,690 attempting to attack us. The problem is they (inaudible) and I was like, aw crumbs. 92 00:09:52,690 --> 00:09:58,260 >> [laughter] >> I can hear people laughing already. The C programmers know exactly what's going on 93 00:09:58,260 --> 00:10:04,260 There's a stack box for the overflow. So I was like Oracle we can still exploit this 94 00:10:04,260 --> 00:10:12,660 without using (Inaudible). And then we were like oh yeah we'll fix that. So what we'll do this 95 00:10:12,667 --> 00:10:18,960 is Oracle speaking here, I'm paraphrasing of course, we'll put a link check in before we 96 00:10:18,960 --> 00:10:28,660 call S print out. Why they didn't say SSM print I don't know. They expanded environment 97 00:10:28,660 --> 00:10:34,660 variables. That's in between you remember so if I said don't sign par that is expanded off to a 98 00:10:34,667 --> 00:10:45,140 line check so that's five characters and that expands. So suddenly we have a (Inaudible). 99 00:10:45,140 --> 00:10:53,333 They should have just done SFM print F260 bites max but they didn't do that. This went over a 100 00:10:53,333 --> 00:11:00,917 period of years backwards and forward until eventually they fixed all supported versions. 101 00:11:00,917 --> 00:11:06,208 Unsupported versions are still vulnerable to this. There are still people out there using 102 00:11:06,208 --> 00:11:17,708 Oracle seven. So, this was the kind of, you know, approach to patching that Oracle would take. 103 00:11:17,708 --> 00:11:21,833 You would wait two years for a patch and it would be insufficient and I'll give you 104 00:11:21,833 --> 00:11:28,292 another good example of this. So, way back when, Oracle application seven, originally 105 00:11:28,292 --> 00:11:34,572 called the Oracle web listener had something called PL SQL it's a cool function especially 106 00:11:34,580 --> 00:11:40,580 if you want to hack into it, essentially what it does is the PR sequel gateway allows you to 107 00:11:40,583 --> 00:11:47,708 program your web application in PISQUELL and have it execute in the database and the results are 108 00:11:47,708 --> 00:11:55,417 broadcast back to the browser. Essentially what happens is the web server takes the user's web 109 00:11:55,417 --> 00:12:06,037 request, get flash PLSv package dot procedure, basically the web server turns around and takes 110 00:12:06,042 --> 00:12:10,000 that request, strips out the package dot feature, turns around to database server and 111 00:12:10,000 --> 00:12:15,458 says execute that for me and pass me back the results. This is going to be riddled with 112 00:12:15,458 --> 00:12:19,708 security bugs because nothing is being validated and it's just being executed by the database 113 00:12:19,708 --> 00:12:27,360 server. If you knew of a vulnerable package or procedure, that allows you to execute 114 00:12:27,360 --> 00:12:32,760 arbitrary SQL for example How many actual Oracle people do we have in here? 115 00:12:32,760 --> 00:12:36,880 Show of hands? Who remembers dry load. It was a package that 116 00:12:36,880 --> 00:12:40,620 basically had a procedure validate statement and what it did was 117 00:12:40,625 --> 00:12:50,380 basically and remember it was a DBA at the time. You passed SQL query would execute it. 118 00:12:50,380 --> 00:12:56,460 Executes would deviate privileges and so you could say grant BBA to public and suddenly 119 00:12:56,460 --> 00:13:03,320 the public was a DDB essentially. We could execute this through the server. We 120 00:13:03,320 --> 00:13:14,333 could just go get slash dolt validate statement question mark C buffer equals select star from 121 00:13:14,333 --> 00:13:18,833 whatever or create user or load, create library, whatever we wanted to do we 122 00:13:18,833 --> 00:13:23,333 would deviate privileges essentially. So that's pretty bad. Oracle introduced the PL SQL 123 00:13:24,460 --> 00:13:28,800 exclusion list and on that list are things in the sys schema, sys is like root basically. It's 124 00:13:28,800 --> 00:13:32,700 the most powerful account on an Oracle system. So anything in the sys schema 125 00:13:32,708 --> 00:13:38,167 would be rejected. Anything that starts with DBMS underscore would be rejected because most 126 00:13:38,167 --> 00:13:45,167 of the sys stuff has a synonym so we can access it without specifying a schemer and they will be given 127 00:13:45,167 --> 00:13:51,000 that uh most of the packages start with DBM underscore schemer. They decide 128 00:13:51,000 --> 00:13:56,292 to reject that. Anything that started with the OWA underscore because the Oracle web 129 00:13:56,292 --> 00:14:01,083 application toolkit basically had things like, there was a package called OWM underscore 130 00:14:01,083 --> 00:14:07,333 and one of the features was sells print and it presented the results back to you so this was 131 00:14:07,333 --> 00:14:12,333 banned. So, it became incumbent upon you if you wanted to break into an Oracle database 132 00:14:12,340 --> 00:14:20,300 server to execute things like CTX were not in the band from the get go so you could still 133 00:14:20,300 --> 00:14:29,958 exploit things like the dry load validate. And assuming we wanted to execute scheme load we had to 134 00:14:29,958 --> 00:14:36,042 bypass the PR SQL exclusion. So having reported this and them introducing the exclusion list 135 00:14:36,042 --> 00:14:44,662 it was now important to bypass the list. And so certainly the first way of doing it was put up 136 00:14:44,667 --> 00:14:51,625 imprint assist 'cause it's a space and a space does not match of course SIS. They're two 137 00:14:51,625 --> 00:14:59,805 different things. Or you could go zero wave new line, zero defer line feed and all of these 138 00:14:59,805 --> 00:15:05,580 things would bypass the exclusion list so we could gain access to everything for 139 00:15:05,583 --> 00:15:10,833 example. So I reported this to Oracle, Oracle fixed it so on and so on. All good. We came 140 00:15:10,833 --> 00:15:17,833 across another Oracle application and they all patched. We have to bypass the 141 00:15:17,840 --> 00:15:23,840 exclusion list again so this way next time was basically using angle brackets. If you do double 142 00:15:24,375 --> 00:15:29,458 angle bracket, double angle bracket that's like a go to label. You would request get 143 00:15:29,458 --> 00:15:35,458 slash PL slash angle bracket angle bracket, bar angle bracket angle bracket and that would 144 00:15:39,080 --> 00:15:51,020 break the matching. Oracle fixed it. This is now about year three and another time they, uh I'd 145 00:15:51,020 --> 00:15:55,292 found a few bugs in the schemer and they were like they're not going to fix them because the 146 00:15:55,292 --> 00:16:01,292 only risk is through the application server. What if we find another bypass. They're we 147 00:16:01,300 --> 00:16:09,160 fixed all the bypasses. You're not going to get around it this time. And I was like well I'll 148 00:16:09,160 --> 00:16:17,540 stop you guys. And it's silly, I should have thought of it from the get go. Double quotes 149 00:16:17,542 --> 00:16:25,458 bypasses their exclusion list. So they go ahead and fix that and eventually, you know, we're 150 00:16:25,458 --> 00:16:32,598 now sort of like ping pong or tennis they fix it, I bypass it, they fix it, I bypass. 151 00:16:32,600 --> 00:16:39,875 Eventually and this is a real funny one. Who knows what the character with the value hex FX 152 00:16:39,875 --> 00:16:47,792 looks like? Anyone many like a Y with a numeral on top of it. Looks like a letter Y and guess 153 00:16:47,792 --> 00:16:53,672 what the database server thinks it is? So, anyway the web application server would look at 154 00:16:53,680 --> 00:17:01,540 it you go SFS, you know, for SIS essentially, the web server would go well that is not SYS 155 00:17:01,542 --> 00:17:07,208 because that FF character, that's not a Y, that's some weird thing, I've never seen that, 156 00:17:07,208 --> 00:17:12,458 pass it through. The database searcher depending upon the language eventually says what 157 00:17:12,458 --> 00:17:17,458 the hell is this double doing on there. I don't think you mean it. Convert it to a Y. >> [laughter] >> 158 00:17:17,458 --> 00:17:24,917 So then you would get access to the SYS schemer. >> Eventually Oracle decides that they can't 159 00:17:24,917 --> 00:17:31,542 rely on the web developers to do the validation so here's a really smart idea. Let's get the 160 00:17:31,542 --> 00:17:39,167 guys to do the validation. So I'm sorry I was expecting a laugh. You're getting the 161 00:17:39,167 --> 00:17:45,500 database server to do its own validation. So guess what? That first attempt is vulnerable 162 00:17:45,500 --> 00:17:51,500 SQL injection. We're now six years into this. So, you send this stuff and you wait six 163 00:17:53,542 --> 00:17:59,000 months or eight months for them to come back with a suitable patch and it's just not 164 00:17:59,000 --> 00:18:05,640 sufficient enough. You've paid it lip service. We'll come back to Oracle patch in a minute. 165 00:18:06,380 --> 00:18:14,160 Spend some time looking at DB2 I'm not just pulling at Oracle here. Sent IBM is 166 00:18:14,167 --> 00:18:20,167 bunch of bugs I think about 50 in all. We'll talk about common criteria in a minute and a 167 00:18:22,708 --> 00:18:28,208 problem Oracle had with it but info Mex had a buffer flow way long user name. The 168 00:18:28,208 --> 00:18:40,600 authentication procedure I said we'll come back to that. As time progresses you start 169 00:18:40,600 --> 00:18:45,375 looking for these wonderful things, you know, and coming up with new classes of attacks such 170 00:18:45,375 --> 00:18:53,292 or new classes of flaws. Lateral SQL injection but here's the thing. Nine times out of ten you 171 00:18:53,292 --> 00:18:56,958 go and do an assessment of someone and they still got like weak password management in 172 00:18:56,958 --> 00:19:01,000 place so they don't care about things like lateral SQL injection and stuff like that. 173 00:19:01,000 --> 00:19:07,000 They've not even got the password stuff right. It's a bit of a disappointment. And so yeah 174 00:19:07,000 --> 00:19:17,200 long story short I went by eventually and came back to it: Most of the time they used to 175 00:19:17,208 --> 00:19:22,125 fix the flaw. They didn't fix the flaw they would fix the exploit. If my exploit had a 176 00:19:22,125 --> 00:19:28,917 space in it because you like select start from SYS user dollar or whatever it happens to 177 00:19:28,917 --> 00:19:35,375 be they would say well if the parameter being supplied by the user has a space in it, reject 178 00:19:35,375 --> 00:19:42,208 it. Well, hold on, we don't need a space. We could replace the space with forward slash star, 179 00:19:42,208 --> 00:19:50,375 star forward slash. And or you know double pipe. There's a whole number of things. It was 180 00:19:50,375 --> 00:19:57,335 still vulnerable. They hadn't fixed the actual flaw itself but just the exploit. So that was 181 00:19:57,340 --> 00:20:02,375 typically the kind of response you would get. Or they would use a super secret that no one is 182 00:20:02,375 --> 00:20:06,000 supposed to ever know but of course that's what hackers do, researchers do that, they 183 00:20:06,000 --> 00:20:11,417 reverse engine. As long as you knew what that secret was you would pass that as a parameter 184 00:20:11,417 --> 00:20:19,250 and you would still be able to execute the flaw. You would typically report an issue and 185 00:20:19,250 --> 00:20:24,958 often you would find the same vulnerability in the probe two lines later that they had 186 00:20:24,958 --> 00:20:29,917 neglected to fix but they fixed the one you had reported so again I just wanted to stress it 187 00:20:29,920 --> 00:20:35,375 that this is, Oracle often takes a long time to patch. Two years you used to 188 00:20:35,375 --> 00:20:41,815 wait for a patch to come out and it would be broken severely broken. I do want to point out 189 00:20:41,820 --> 00:20:53,220 though that who remembers the hacker group, they found this is the flaw 190 00:20:53,220 --> 00:20:59,958 that slammer, uh Blaster ended up exploiting. Anyone remember that? It was very nice. 191 00:20:59,958 --> 00:21:08,618 Any way, just, you know, showing that even people like Microsoft basically after the whole SDL 192 00:21:08,625 --> 00:21:14,167 stuff they fell vulnerable to this. There was a heap of overflow they forgot to overfix. 193 00:21:14,167 --> 00:21:24,220 Two lines of code later they fixed the base overflow. So, it's not that this is just 194 00:21:24,220 --> 00:21:32,860 Oracle doing this, it's the other vendors, too. So, I want to do some comparisons between 195 00:21:32,860 --> 00:21:39,792 Oracle and Microsoft in terms of just the database side of things. So, we can see that 196 00:21:39,792 --> 00:21:46,417 they're actually getting better. Back in 2004 days, you know, they would patch you 28 197 00:21:46,417 --> 00:21:52,583 issues, sorry, each one of these blue blocks represents a flaw that they have caught in their 198 00:21:52,583 --> 00:22:01,583 advisories basically and so before 2004 they patched things on an ad hoc basis. Now, this 199 00:22:01,583 --> 00:22:07,980 was at time when Microsoft was turning towards patch Tuesday. And Microsoft was saying we have 200 00:22:07,980 --> 00:22:13,120 to patch so many things we need to really get on top of this so our customers can have a 201 00:22:13,125 --> 00:22:21,417 recognizable date when they know they're going to have to look for patches. Excuse me. Oracle 202 00:22:21,417 --> 00:22:26,125 at the time slagged them off. Oracle was like that's leaving your customers exposed for a 203 00:22:26,125 --> 00:22:36,745 month, you know. Says the company that waits two years to patch things crappily. Oracle 204 00:22:36,745 --> 00:22:43,333 has three months, a quarterly patch update. So, after slagging off Microsoft for doing a 205 00:22:43,333 --> 00:22:49,333 monthly patch cycle, Oracle will do a three month, you know. So, I think one of the things that 206 00:22:51,333 --> 00:22:57,333 Oracle doesn't like to do is be like schooled by Microsoft but they really should and one of 207 00:22:57,340 --> 00:23:02,500 the things we'll talk about is SDR, the security development life cycle and really if, 208 00:23:02,500 --> 00:23:06,500 I know Oracle says they've got one but I see no evidence of it at this stage of the game and 209 00:23:06,500 --> 00:23:13,125 this what we'll talk about towards the end of the talk. So, here is for all Microsoft SDL 210 00:23:13,125 --> 00:23:21,833 server products is the comparison. So, this is Oracle remember eventually that 211 00:23:21,833 --> 00:23:29,250 died out. So, all the way to Oracle 12C, so this is all Oracle's products. This is all 212 00:23:29,250 --> 00:23:34,500 Microsoft SQL server products. That's a pretty good record so it sorter of those SDL is 213 00:23:34,500 --> 00:23:41,708 probably working. On the left hand side of the graph is the days when people who like 214 00:23:41,708 --> 00:23:52,880 myself were weekly kicking the crap out of it basically. And at that point Microsoft turned 215 00:23:52,880 --> 00:23:58,240 around and said you know what, enough is enough. In fact, bill gates trustworthy memo was at 216 00:23:58,250 --> 00:24:03,500 this time, they were hemorrhaging customers and what's important here is that 217 00:24:03,500 --> 00:24:08,208 they took everyone off, this is unheard of in, you know, at the time was unheard of, they 218 00:24:08,208 --> 00:24:14,750 took everyone off the development review con and said you know what, let's get back to 219 00:24:14,750 --> 00:24:20,667 sequel server 2000 do thorough code review and the results have paid off as far as I'm concerned. 220 00:24:20,667 --> 00:24:29,260 That's a fantastic graph compared to that one. Even SQL 2005 it was a number of years before some 221 00:24:29,260 --> 00:24:34,440 decent bugs were found in it. I think it was a bit more from security assessment found a 222 00:24:34,440 --> 00:24:42,120 couple overflows or something and again there's been so many ‑‑ so few flaws. I 223 00:24:42,125 --> 00:24:48,900 don't want to talk about IE because IE doesn't follow this track record so well, but when 224 00:24:48,900 --> 00:24:54,900 was the last time you saw a bug in internet information server. Everyone's scratching their 225 00:24:54,900 --> 00:24:59,220 heads. When was the last time you saw a decent overflow in exchange server? 226 00:25:00,760 --> 00:25:05,240 It was a long time ago. They got the service side down and it is due 227 00:25:05,250 --> 00:25:12,708 to the script. I don't know what's going on with internet Explorer. I think they're trying 228 00:25:12,708 --> 00:25:19,833 to compete with fire fox and Chrome or something but those guys are doing really well. You 229 00:25:19,833 --> 00:25:26,250 know, the other people, yeah, it's just like IE what is going on? I'm confused. So they 230 00:25:26,250 --> 00:25:34,083 actually work for the same company, they read the same documentation. Where are we? 231 00:25:34,083 --> 00:25:41,167 Yeah. So, this is the background. This is the back drop to Oracle. And when I 232 00:25:41,167 --> 00:25:47,167 retired from the industry in 2010ish I went shark diving and decided I'm never coming back. 233 00:25:49,625 --> 00:25:56,458 I'm back unfortunately. I actually gave them a B plus am I was like, you know, they've sold 234 00:25:56,458 --> 00:26:03,042 they oversold the PL sequel injection problem so that's pretty good. Their 235 00:26:03,042 --> 00:26:08,667 processes are looking much healthier and so on. When they're releasing products, like when 236 00:26:08,667 --> 00:26:16,667 release 2 came out not bad Oracle, B plus and I go away diving for a couple years and I come back 237 00:26:16,667 --> 00:26:20,907 and I'm like what the hell. What's going on? They revert back and they're back to an F. 238 00:26:25,500 --> 00:26:30,708 We are going to be looking a the something very, very simple. Oracle data redaction. At any 239 00:26:30,708 --> 00:26:37,542 stage this is, these are points from the Microsoft SDL by the way. If Oracle had an SDL in 240 00:26:37,542 --> 00:26:44,250 place, a decent one, any one of these stages would have found and stopped the bugs that I'm 241 00:26:44,250 --> 00:26:49,208 about to speak about in their tracks. They would not have reached the public. So, 242 00:26:49,208 --> 00:26:55,750 establish security and privacy requirements, attack service analysis, skipping through to 243 00:26:55,750 --> 00:27:01,958 the end, conduct a final security review, okay. That means pen test the product 244 00:27:01,958 --> 00:27:08,083 before it goes out the door. Anyone with a modicum of SQL would have found these bugs as 245 00:27:08,083 --> 00:27:12,583 far as I'm concerned. And I think you'll agree with me by the time you get to the end of 246 00:27:12,583 --> 00:27:21,333 this talk. So you're going to be really disappointed so what is Oracle data redaction? It's a 247 00:27:21,333 --> 00:27:28,583 simple but it's a great idea. So, if you have a web, a database application there has 248 00:27:28,583 --> 00:27:34,667 some kind of potentially confidential information in one of the columns, for example, 249 00:27:34,667 --> 00:27:40,292 Email addresses, passwords, credit cards, whatever it happens to be, you can redact it 250 00:27:40,292 --> 00:27:47,917 so what is presented to the user, if they select from that table, is a list of X's or 251 00:27:47,917 --> 00:27:52,625 whatever you want to redact it with essentially. It's not a bad idea. We don't have to change 252 00:27:52,625 --> 00:27:58,250 any redaction code. We change the policy on a particular table and if our web application is 253 00:27:58,250 --> 00:28:04,875 vulnerable and someone tries to do a union collect stop in customer kind of situation, you 254 00:28:04,875 --> 00:28:10,667 know, and snap all the juicy stuff out there they're not going to get the secret stuff 255 00:28:10,667 --> 00:28:15,542 because we redacted it. The no change necessary to the application code which is I 256 00:28:15,542 --> 00:28:23,042 think really cool. The problem is at the door, this is in Oracle 12C, the back port to 257 00:28:23,042 --> 00:28:31,720 Oracle 11 release, it's trivial bypass. It failed within the first five minutes of simple 258 00:28:31,720 --> 00:28:38,580 assessment so it's real, it really speaks to Oracle not pen testing their products 259 00:28:38,583 --> 00:28:44,458 before they, you know, in their flagship product before they go out the door. So, let's look at 260 00:28:44,458 --> 00:28:55,917 some demos. So, before we do anything I'm going set up a table called redaction tests and 261 00:28:55,917 --> 00:29:05,077 insert a fake credit card number into it and then we'll commit it. Okay. And now so if we 262 00:29:05,083 --> 00:29:13,263 select it. Can everyone see or do I need to increase the font size? Increase. Come closer. 263 00:29:13,340 --> 00:29:15,520 (Laughter). 264 00:29:30,000 --> 00:29:36,000 >>> Let me see. All right. I'm just going to modify the size of the window now. Layout, width. 265 00:29:47,800 --> 00:30:05,833 All right. And zero. Okay. No, I said zero. Okay, perfect. Okay, so if we select from select CC, 266 00:30:05,833 --> 00:30:10,042 that's the name of the column we're going to redact and ID from redaction test see if we 267 00:30:10,042 --> 00:30:15,482 get the credit card. We don't want the world seeing that credit card We're going to create a policy. 268 00:30:19,040 --> 00:30:27,920 and now if we grant select and update to David, then connect as David, we 269 00:30:27,920 --> 00:30:37,160 do a select from the redaction test table, we can see we get a list of X's essentially so we 270 00:30:37,167 --> 00:30:42,250 can't see that date today. The data has not been changed. The data is still there, it's just 271 00:30:42,250 --> 00:30:48,708 the way it's been presented to us has been modified. If I had bypassed policy and stuff like, 272 00:30:48,708 --> 00:30:55,288 that redaction policy wouldn't patch me and I would get to see the stuff. If I was like a DBA 273 00:30:55,288 --> 00:30:59,500 for example I can see the data but I'm not a DBA so I can't see the data. All there is is the 274 00:30:59,500 --> 00:31:09,792 redacted data. Let's get the data out. There are a couple of X and L inquiries that allow you 275 00:31:09,792 --> 00:31:18,252 to run X inquiry. One of those XML query functions is called XML query and it 276 00:31:18,252 --> 00:31:26,652 allows you to query using X query. This stuff in the middle (inaudible) 277 00:31:26,660 --> 00:31:32,040 this is x query stuff and we're using SQL and XML query 278 00:31:32,042 --> 00:31:39,417 function. Now, those of you who do penetrate testing and get involved in exploiting sequence 279 00:31:39,417 --> 00:31:47,697 injection rule understand the importance of functions. We can execute this XML inquiry to 280 00:31:47,700 --> 00:31:56,980 get the unredacted data back. We are going through a path that they've forgot about. A simple 281 00:31:56,980 --> 00:32:02,840 pen test anyone with an idea of how the Oracle data server works and everything like that would 282 00:32:02,840 --> 00:32:09,792 have said they should probably check XML inquiry to see if they can bypass redaction and of 283 00:32:09,792 --> 00:32:15,125 course you can. If you're going to, if you're looking for information like, you know, 284 00:32:15,125 --> 00:32:23,917 monitor and everything like that the XML table function is also vulnerable so it's not just 285 00:32:23,917 --> 00:32:29,917 sufficient to protect against XML inquiry. Table needs to be do as well. These are trivial. 286 00:32:33,880 --> 00:32:45,333 This is SQL. One of the DML operations update, we'll concentrate on update has a 287 00:32:45,333 --> 00:32:51,750 returning into sub codes and what returning into basically says once I get this table if 288 00:32:51,750 --> 00:32:56,500 there's an auto column for example a sequence that's incremented or whatever return 289 00:32:56,500 --> 00:33:01,542 that value to me so I can include it later on in a further application code. This returning 290 00:33:01,542 --> 00:33:06,708 into feature, guess what? We don't, it doesn't have to be incremented or whatever. You 291 00:33:06,708 --> 00:33:13,958 can just basically specify return the credit card column information into this buffer and 292 00:33:13,958 --> 00:33:21,000 print it to the screen so there we go. So, we can see what's going on there. We've updated 293 00:33:21,000 --> 00:33:28,960 the redaction test column set the ID to itself so it doesn't modify data but it returns the 294 00:33:28,960 --> 00:33:34,958 credit card column into the buffer and then printed the buffer to the screen. So, again, 295 00:33:34,958 --> 00:33:41,458 trivial way. Anyone who has done will know the returning into clause. So anyone at Oracle who 296 00:33:41,458 --> 00:33:48,000 I assume they know SQL because they work in Oracle would have said well, do a pen test on this 297 00:33:48,000 --> 00:33:52,583 project and we got to check this because without it you'll be able to bypass redaction, you 298 00:33:52,583 --> 00:34:02,420 know. The predicate is not is not protected either so I would like to take 299 00:34:02,420 --> 00:34:09,500 credit for this one but turns out Al Cornbusker had already done this. He noticed that the 300 00:34:09,500 --> 00:34:15,542 web predicate was not protected either so you could pass it to UTL underscore HTTP, you know, 301 00:34:15,542 --> 00:34:21,292 dot request and send it tout some server somewhere and there's a couple other functions 302 00:34:21,300 --> 00:34:29,640 that can be used that generate an error or alternatively what you can do is simply force it. 303 00:34:29,640 --> 00:34:39,240 So we'll create a, sorry, create a little procedure here and let's talk about what it 304 00:34:39,240 --> 00:34:49,360 does. We select from the redaction test table the where, the credit card column sub 305 00:34:49,360 --> 00:34:57,620 string so we get the first character of the proper credit card column and convert it to a 306 00:34:57,625 --> 00:35:04,440 letter and check if that letter is a zero, one, a two, a three, a four up to nine. Once we find 307 00:35:04,440 --> 00:35:09,000 out what the answer is we then go to the second character and the third character and the 308 00:35:09,000 --> 00:35:15,000 fourth character. Essentially we guess it as we go along. Now we created that procedure where we 309 00:35:22,220 --> 00:35:28,220 sorry. So, if we execute that little procedure now, it 310 00:35:30,700 --> 00:35:38,875 basically, you know, returns the information. So, given that the information once we can't get 311 00:35:38,875 --> 00:35:45,835 that information back from the where inquiry unless of course you're shelling out using UPI 312 00:35:45,840 --> 00:35:51,040 it's not protected its another thing to be aware of. They can't fix it in the where clause. The 313 00:35:51,042 --> 00:35:55,875 other stuff has been patched apparently but this they can't fix because they need to be able 314 00:35:55,875 --> 00:36:04,695 to inquiry in the predicate. So just be aware of that if you are using that redaction. If you 315 00:36:07,333 --> 00:36:12,875 If you have the privileges to execute DDMS underscore redact you have the privileges to create 316 00:36:12,875 --> 00:36:19,417 redaction policies in other peoples schemas. You have the privileges to remove redaction 317 00:36:19,417 --> 00:36:23,167 qualities from other people schemers. Again that's another thing you need to be aware of. 318 00:36:23,167 --> 00:36:28,875 If you've got privileges on DDMS redact you have control over everyone basically. There is a 319 00:36:28,875 --> 00:36:36,583 thing called a lateral sequence injection in most database sis and what it essentially does is 320 00:36:36,583 --> 00:36:40,750 where there's information coming from, say, environment variables or stuff like that, that's 321 00:36:40,750 --> 00:36:48,583 considered obviously trusted, you know, by database server and often the developers will like, 322 00:36:48,583 --> 00:36:53,208 you know, do simple straight encapsulation and that may become vulnerable to sequence 323 00:36:53,208 --> 00:37:00,333 injection. For example, in, um, a couple years ago people used to think if it was a 324 00:37:00,333 --> 00:37:09,233 number, you could not exploit a number, a numeric sequel injection. You can because you 325 00:37:09,250 --> 00:37:15,625 can specify the number format in a certain way that the comma or the decimal sign is actually a 326 00:37:15,625 --> 00:37:22,417 letter. So, essentially we can provided we can create a synonym, we can create a 327 00:37:22,417 --> 00:37:27,917 function that eventually is concantonated as a number and would be translate it 328 00:37:27,917 --> 00:37:37,117 into a, P01. If we have a P01 that gets executed. So, because of developers thinking you 329 00:37:37,125 --> 00:37:42,000 can't, if it's a number how are you going get arbitrary SQL into a number there is a way but 330 00:37:42,000 --> 00:37:48,042 they forgot about that. So remember I spoke about PL sequel injection almost being gone and 331 00:37:48,042 --> 00:37:54,083 Oracle doing a good job in that regard. They have left all of the numeric sequel injection 332 00:37:54,083 --> 00:37:58,917 flaws so typically this stuff I'm sending them these days is a numeric sequel injection flaw. 333 00:37:58,917 --> 00:38:04,557 or a (inaudible) which is a whole other ballgame. 334 00:38:04,560 --> 00:38:09,340 But anyway, we have to I've got five more minutes for questions and stuff like that. 335 00:38:09,340 --> 00:38:14,833 So I'll wrap up. Just last point. As I said this is basic stuff. A pen test of the product 336 00:38:14,833 --> 00:38:19,083 before it was shipped should have found this stuff and this really speaks to the Oracle 337 00:38:19,083 --> 00:38:25,583 security processes so going back to what Mary Anne Davidson said, the beginning, you know, that I 338 00:38:25,583 --> 00:38:30,792 spoke about, holding the vendors to a higher standard, well, this is what we need to do. If you 339 00:38:30,792 --> 00:38:34,000 don't, if you're running Oracle database servers and you don't like the way they're 340 00:38:34,000 --> 00:38:40,000 treating you as far as security is concerned get on the phone to them and tell them I'm going to 341 00:38:40,000 --> 00:38:49,040 start buying something else instead because we really need to get this improved. So thank 342 00:38:49,042 --> 00:38:55,040 you for listening. Are there any questions? >> (Inaudible). >> Sure. Oracle, which features? >> 343 00:39:02,660 --> 00:39:11,400 (Inaudible). >> Database vault. No, I haven't. But I know other people have done sorry. 344 00:39:11,400 --> 00:39:15,858 Oracle database, I have played with Oracle database vault yet. I know some other people have done 345 00:39:15,860 --> 00:39:23,040 great research in that area and I can't think of who it was off the top of my head but if you 346 00:39:23,040 --> 00:39:27,820 Google it, you know, you'll find it but it's on my list to do because they've patched a lot of 347 00:39:27,840 --> 00:39:37,333 stuff. The same with audit volt as well. I suspect it's going to be like the rest of Oracle 348 00:39:37,333 --> 00:39:43,333 product. Sure. Any other questions. Sure. In the front here. >> (Inaudible). >> I'm 349 00:39:46,083 --> 00:39:53,542 sorry? >> (Inaudible). >> It should be, yeah. You just need to. yeah. Right. I think 350 00:39:53,542 --> 00:40:00,125 we'll wrap up. I thank you everybody for attending. Hopefully it was useful.