00:00:00.834 --> 00:00:06.840 >> Welcome folks. may name is bart, I will be talking about 00:00:10.177 --> 00:00:17.751 the legacy or the AS400. IBM system whatever you call it the 00:00:17.751 --> 00:00:24.157 guys at IBM get nice bonuses for changing the names every few 00:00:24.157 --> 00:00:31.331 years. I will call it AS4 hundred. Short introduction, I'm 00:00:31.331 --> 00:00:39.273 google able so you can check my twitter and Polish national 00:00:39.273 --> 00:00:47.180 living in the Netherlands and what I present here is my 00:00:47.180 --> 00:00:53.186 personal views and not always or necessarily -- so why should we 00:00:55.822 --> 00:01:03.697 care about legacy or AS4 hundred? It is legacy which is 00:01:03.697 --> 00:01:09.703 hard to get rid of if you work in a in institution you will see 00:01:14.474 --> 00:01:20.480 a lot of customer data, a lot of old programs and it is very 00:01:24.551 --> 00:01:30.023 difficult with all the history and for example if you have 00:01:30.023 --> 00:01:33.260 insurance policies or bank accounts very difficult to 00:01:33.260 --> 00:01:38.498 migrate to new environments so what you see often is that you 00:01:38.498 --> 00:01:45.973 have knew shiny front end a back end you have still mainframe 00:01:45.973 --> 00:01:53.347 systems running because just good for what they do. So many 00:01:53.347 --> 00:01:59.353 times we do care about the front end but not the back end and 00:02:02.656 --> 00:02:08.996 that leads to situation that back ends are somewhat less 00:02:08.996 --> 00:02:16.470 secure than the front end. Still to my surprise the systems are 00:02:16.470 --> 00:02:23.110 accessible while even by internet SM2P servers or if you 00:02:23.110 --> 00:02:29.116 go tore tailer you can see a 50 to 50 screen and you can find 00:02:33.120 --> 00:02:40.460 them every where. I mean all banks, insurance if you google 00:02:40.460 --> 00:02:46.466 that you will find a lot of as 400 systems and there was a 00:02:48.835 --> 00:02:54.975 great talk back in 2006 by -- talking about security system 00:02:54.975 --> 00:03:02.015 but not touch has change from the IBM perspective. They are 00:03:02.015 --> 00:03:08.021 still say -- they are still like this 90s mentality we have a 00:03:11.058 --> 00:03:17.064 green screen and it is secure enough. There is not too much 00:03:19.366 --> 00:03:25.372 new things from IBM. There is some patching but I will say not 00:03:28.408 --> 00:03:34.414 too much from my perspective. So if you want to start your -- 00:03:37.417 --> 00:03:43.423 well, some joy with as 400 you can buy one. I recently bought 00:03:46.460 --> 00:03:52.466 one for just 60 bucks on E-bay. I could not find a cheap one now 00:03:56.870 --> 00:04:02.809 but every now and then you can find a cheap AS4 hundred system 00:04:05.812 --> 00:04:11.818 so start or you can just hack one. If you go to Sheldon I you 00:04:16.223 --> 00:04:22.229 will find a lot of systems open. Just example from last week, I 00:04:25.265 --> 00:04:32.906 would say about get access to Italian coffee maker which was 00:04:32.906 --> 00:04:40.514 just fully exposed to the internet for default spas so you 00:04:40.514 --> 00:04:46.520 could log in and enjoy the system. They just put it on the 00:04:49.556 --> 00:04:55.562 web and forget it. So going to security of these systems, there 00:04:57.898 --> 00:05:03.837 was a talk from (indiscernible) about the 50 to 50 security, I 00:05:06.139 --> 00:05:12.145 want to talk about something else. I want to focus on Java. 00:05:14.481 --> 00:05:21.421 Why because, it comes together with AS4 hundred access and 00:05:21.421 --> 00:05:27.427 gives you pretty much a lot of access to the system and if you 00:05:31.131 --> 00:05:37.137 look at the IBM toking box for Java allows for remote system 00:05:39.472 --> 00:05:45.478 IMI calls or use of comments so you can compile your programs in 00:05:49.216 --> 00:05:53.453 Java externally you don't have to write your programs in CO or 00:05:53.453 --> 00:05:57.924 RPG so you can. It bypasses 50/50 limitations so gets access 00:05:57.924 --> 00:06:04.664 to the common lines and by a passes the navigation 00:06:04.664 --> 00:06:10.670 restriction so if you have set up navigator so the user cannot 00:06:12.873 --> 00:06:20.347 download files or access LDBS you can bypass with your own 00:06:20.347 --> 00:06:27.187 Java functions. And gives you flexible of working with AS4 00:06:27.187 --> 00:06:34.661 hundred outside of system so no need to access development tools 00:06:34.661 --> 00:06:40.667 on the box itself. If you decompile the JT400 given by IBM 00:06:42.836 --> 00:06:50.477 it is generally poorly written it is inconsistent. So sometimes 00:06:50.477 --> 00:06:56.483 they just use CLCL in the background. So I found that I 00:07:10.964 --> 00:07:16.970 had to write my own functions. So I encourage you to decompile. 00:07:31.418 --> 00:07:37.424 I will give you a short demo about the visibility. So first 00:07:51.905 --> 00:07:57.911 we are going to connect to the system so that user does not 00:08:13.993 --> 00:08:19.999 have access to the comments. I have four profiles on the 00:08:32.779 --> 00:08:38.885 system. That one has signed off is you cannot log in. 00:08:38.885 --> 00:08:42.856 Administrator I have talked to say if you sign off you cannot 00:08:42.856 --> 00:08:48.862 connect directly into the system. Bullshit. So this one 00:08:59.639 --> 00:09:06.146 gives you already more rights. We have access to comment lines 00:09:06.146 --> 00:09:09.682 that is all the profiles that I can see with that system, with 00:09:09.682 --> 00:09:15.688 that user profile. I will also go to -- so these are library 00:09:27.033 --> 00:09:33.039 that we can see. It mostly the system libraries. So let's 00:09:43.950 --> 00:09:49.956 switch to Java tool. This takes a while. So when we go to work 00:10:13.480 --> 00:10:19.486 with objects and we want the see all objects uses and the user 00:10:30.396 --> 00:10:36.402 profiles. You can see more profiles 50/50 so Java handles 00:10:43.409 --> 00:10:49.415 the authorization in a different way but you are not authorized 00:10:57.724 --> 00:11:03.663 (indiscernible) you can enumerate for the use. You will 00:11:07.734 --> 00:11:11.971 see there are some additional libraries which were not vise 00:11:11.971 --> 00:11:17.977 able. So as you can see the difference in authorization 00:11:17.977 --> 00:11:23.983 handling between Jay and 50 to 50. If connect with -- (lost 00:11:44.504 --> 00:11:50.510 audio) -- so don't believe your administrator if they say sign 00:12:08.728 --> 00:12:15.635 off you cannot use the (indiscernible). That is only 00:12:15.635 --> 00:12:21.641 visible but we want to do something more. We want to 00:12:30.183 --> 00:12:36.189 escalate the privileges and say in the old times you have to 00:12:38.858 --> 00:12:44.864 have a program -- or you have to use the AMI and still compile on 00:12:51.371 --> 00:12:57.377 the system to be able to (indiscernible) the thing is 00:12:59.746 --> 00:13:05.084 that, if you use group profiles which is difficult for every 00:13:05.084 --> 00:13:11.891 larger application, we have like one common profile which is used 00:13:11.891 --> 00:13:17.897 for all the business accounts so to say and many times you add 00:13:21.000 --> 00:13:27.840 privileges by adding group profiles. I have seen these in 00:13:27.840 --> 00:13:32.645 both business applications and banking and insurance 00:13:32.645 --> 00:13:40.153 applications and many times you see the ownership for the user 00:13:40.153 --> 00:13:46.159 is set to group profile. For one reason, you don't want to have a 00:13:49.729 --> 00:13:55.735 situation if one user leaves and the account is deleted that is 00:13:57.970 --> 00:14:03.910 lot of problems so sometimes you see a default is set up and the 00:14:07.480 --> 00:14:15.188 ownership is set up in the group profile. So if you use that set 00:14:15.188 --> 00:14:21.994 up and you have a lot of users, it is likely that you will have 00:14:21.994 --> 00:14:27.533 some administrator users and you will have some users that switch 00:14:27.533 --> 00:14:33.106 between departments and they might have some extra rights 00:14:33.106 --> 00:14:39.112 that you would not expect and it is also likely that you not 00:14:41.748 --> 00:14:49.422 (indiscernible) it is quite challenging to monitor and again 00:14:49.422 --> 00:14:56.129 using Java there is no need to write and compile problems with 00:14:56.129 --> 00:15:02.435 the AS4 hundred so can use the profile handle IMIs, grab the 00:15:02.435 --> 00:15:08.441 profile handle and repeat. We have one common group which the 00:15:33.599 --> 00:15:39.605 Def con23 and one group for hot chicks and we have bots which 00:15:44.510 --> 00:15:47.480 are the administrator on the system. So what we're going to 00:15:47.480 --> 00:15:50.750 do -- we also have hot chicks S69 which is not administrator. 00:15:50.750 --> 00:15:56.756 (indiscernible) so let's try escalate the privileges and I 00:16:13.706 --> 00:16:19.712 like one click solutions so I made some extra implementation. 00:16:36.596 --> 00:16:42.602 So let me log in chick perhaps to show the -- just to show you 00:17:05.992 --> 00:17:11.998 there is no fake authorities here. That is hot chick -- no 00:17:18.137 --> 00:17:24.143 special authorities and hot chick profiles cannot create any 00:17:26.412 --> 00:17:32.418 other profiles so the just add in with any of the hot chicks 00:17:41.827 --> 00:17:47.833 three, user profile. I will get the error message. So let's log 00:17:53.839 --> 00:17:59.845 in with the same chick L3. We can connect again. Let's 00:18:17.763 --> 00:18:23.769 generate the list that we can see. Let me switch to hot chick 00:18:44.557 --> 00:18:50.563 69. So I just click and hot chick 69 and as you can see I 00:18:56.936 --> 00:19:02.875 escalated privileges so if I go now the system um -- let me 00:19:46.352 --> 00:19:52.358 escalate from hot chicks 69 or let me generate the user list so 00:20:00.666 --> 00:20:06.672 I have access to much longer list of users. So let's click 00:20:15.214 --> 00:20:21.220 once again and we escalated user offer. Can you see the whole 00:20:26.959 --> 00:20:32.965 screen now? Now? So I just run a comment and now using the offer 00:21:56.949 --> 00:22:02.888 I created the user profile. You can see there is one button on 00:22:04.890 --> 00:22:10.896 the right side. So if I get back to system you can see the new 00:22:16.001 --> 00:22:21.407 created system user profile. So that is something knew with 00:22:21.407 --> 00:22:27.413 Java. You don't have extra problem. All right. What is also 00:22:30.783 --> 00:22:36.789 interesting I don't have a demo for that but you can try on your 00:22:44.763 --> 00:22:50.536 systems by the way, this already available online at the end of 00:22:50.536 --> 00:22:56.542 the presentation will be a link and you can find a link to where 00:22:58.911 --> 00:23:04.850 the tool link is and up load it. I will make some updates in the 00:23:07.853 --> 00:23:15.060 coming weeks but you can contact me if you have questions. For 00:23:15.060 --> 00:23:21.667 part two (indiscernible) using Java gives you a lot of possible 00:23:21.667 --> 00:23:29.441 options. You can run CL comments or queries you can run system C 00:23:29.441 --> 00:23:37.249 MI and you can combine all of those. So many times what you 00:23:37.249 --> 00:23:42.988 see is you use commercial programs to block access to RBC 00:23:42.988 --> 00:23:48.994 using exit points or you use your own exit points. Usually, 00:23:53.132 --> 00:23:59.138 there is a lot of focus for external connections. But if you 00:24:01.774 --> 00:24:07.780 connect by Java and if you try say run a query from a system it 00:24:12.685 --> 00:24:18.691 will not defect there is any outcoming -- because it will be 00:24:21.427 --> 00:24:28.667 rerouted internally from the system and then outside. So in 00:24:28.667 --> 00:24:35.941 that way you can circumvent the RBC limitation connections. I 00:24:35.941 --> 00:24:41.947 put here a small example that is query by Java so what you do is 00:24:46.852 --> 00:24:53.392 round the well-known comment (indiscernible) in that you go 00:24:53.392 --> 00:24:59.398 to (indiscernible) so you insert Q comment and inside that you do 00:25:02.034 --> 00:25:08.040 DB2 and then select and then you put R to get some out your 00:25:12.211 --> 00:25:20.219 principle device and the will connect to local host. So will 00:25:20.219 --> 00:25:27.459 check is there external connection from host to DB2. No, 00:25:27.459 --> 00:25:33.465 there is not only one log on host. So go. So that way you can 00:25:38.370 --> 00:25:45.644 (indiscernible) you circumvent the some of the exit points if 00:25:45.644 --> 00:25:52.184 they are poorly written. And to be honest, I checked a number of 00:25:52.184 --> 00:25:59.958 exit points and or sorry exit program software and like 00:25:59.958 --> 00:26:05.898 (indiscernible) for example, if that is not for you and this 00:26:09.968 --> 00:26:15.974 program many times have some unknown vulnerabilities like the 00:26:18.210 --> 00:26:25.517 error case for example. So I would say use the tools to try 00:26:25.517 --> 00:26:28.687 to necessary -- and dependent on what is protection you used for 00:26:28.687 --> 00:26:34.693 exit points you may be able to test whether you can circumvent 00:26:42.134 --> 00:26:47.806 the exit points. Then the next -- and I think interesting part 00:26:47.806 --> 00:26:53.812 the security and hash grabbing and that is something I did not 00:26:56.548 --> 00:27:02.488 know before. There is 1IPI offered by IBM called Q 00:27:04.790 --> 00:27:12.297 (indiscernible) to grab the hashes. It is used for 00:27:12.297 --> 00:27:18.804 synchronizing hashes or spas between systems and basically 00:27:18.804 --> 00:27:25.177 using the API but also using from version six and common to 00:27:25.177 --> 00:27:31.183 dump user profile, you can get hashes from a particular user. 00:27:34.720 --> 00:27:40.726 The output format that was me published and I talked to IBM 00:27:43.028 --> 00:27:49.935 and that say said IBM (indiscernible) nor do we plan 00:27:49.935 --> 00:27:56.174 to document output format. Obviously. So after a long 00:27:56.174 --> 00:28:02.314 exchange of e-mails from Rochester and there was no 00:28:02.314 --> 00:28:09.421 denial from their side to publish it, so no word on the 00:28:09.421 --> 00:28:15.427 whether they will fix it or change anything. And if you go 00:28:18.630 --> 00:28:24.736 to API, depending on your spas level system value may be able 00:28:24.736 --> 00:28:30.742 to retrieve different hash words from the system. If you look at 00:28:33.679 --> 00:28:37.849 security guide from IBM some how they still don't enforce 00:28:37.849 --> 00:28:44.723 password level (indiscernible) so password left zero, one, two 00:28:44.723 --> 00:28:50.729 you will still be able the get the dash or hashes or LM hashes. 00:28:55.367 --> 00:29:01.306 So take the lesson and escalate the privileges first but then 00:29:03.675 --> 00:29:11.283 after words you can grab the hashes using the (indiscernible) 00:29:11.283 --> 00:29:15.287 basically, if you look at the IBM documentation they only 00:29:15.287 --> 00:29:21.293 state what you get is output is encrypted user password data. 00:29:25.697 --> 00:29:31.703 That is it. I looked closer into that format and what you can see 00:29:40.979 --> 00:29:46.985 is the first (indiscernible) 56 bits password substitute. So you 00:29:51.890 --> 00:29:57.896 can look at RBC 2877 to see how it is created. Then the third 00:30:07.139 --> 00:30:13.145 position is LM hash which is interesting for us. And then 00:30:19.151 --> 00:30:25.157 there is bunch of other hashes. So grab some hashes and we will 00:30:33.331 --> 00:30:39.337 try to do it now. Let me just for the sake of time saving -- 00:30:44.076 --> 00:30:50.082 so let's generate the user list and say let's pick one profile. 00:31:02.461 --> 00:31:08.467 Up with quick solution grab the hash. See all the hashes I was 00:31:45.404 --> 00:31:51.410 talking about. I cannot move the screen. So what I can do is just 00:32:14.299 --> 00:32:20.305 move that to LM hash. Just save it and I run my favorite 400. So 00:32:36.888 --> 00:32:42.894 that is where the password is 2015 and we are locked. I just 00:33:02.814 --> 00:33:08.820 finished a demo. It 5:00 somewhere. So again we talked to 00:33:24.803 --> 00:33:30.809 IBM on that and IBM was not reactive so I if there is any 00:33:46.424 --> 00:33:50.362 IBM representatives here perhaps you want to talk after the talk. 00:33:50.362 --> 00:33:56.368 Okay. So I also have some other research. Focusing on the 00:34:02.407 --> 00:34:08.413 isolation. >> Now, stop talking. I'm kidding. Go back. You guys 00:34:17.589 --> 00:34:22.294 know the drill what are we going to do. This is called shop a 00:34:22.294 --> 00:34:28.300 new. It is tough to be a speak at Def Con listen anyway we want 00:34:38.276 --> 00:34:42.547 to thank you for making it and as a speaker and we have our 00:34:42.547 --> 00:34:48.553 little tradition. So to Def Con. (CLAPPING) when I came in here 00:35:06.638 --> 00:35:11.042 he did not have a accent. >> My accent it getting better with 00:35:11.042 --> 00:35:17.048 every shot. So I still have some research going on and look caps 00:35:19.618 --> 00:35:27.559 standing at -- there is some changes inversion seven 00:35:27.559 --> 00:35:34.265 basically IBM decided to put the GVM elsewhere. Still I run some 00:35:34.265 --> 00:35:39.904 test with the same tools on version release and I can see 00:35:39.904 --> 00:35:45.310 the same box. So there is not too much lesson learned on the 00:35:45.310 --> 00:35:50.715 Java isolation so I still want to look at inside and at the 00:35:50.715 --> 00:35:55.353 moment I am analyzing the server site of DVM to look whether 00:35:55.353 --> 00:35:58.857 there is still possibility to get more access to the system. 00:35:58.857 --> 00:36:04.796 What I also created is a common shelf for AS4 00 so if you 00:36:08.833 --> 00:36:14.839 happen to have un-security web sphere you can up load that file 00:36:18.176 --> 00:36:24.182 and you will get comment line allowing you for running some 00:36:26.718 --> 00:36:32.724 comments on AS4 00 and creating and account and I am doing some 00:36:36.828 --> 00:36:44.602 work in MI security and so isolation between the more 00:36:44.602 --> 00:36:50.608 virtual part of the system and the hardware layer. The last 00:36:53.178 --> 00:37:00.885 three versus 50 to 50LTP and sometimes I am testing 00:37:00.885 --> 00:37:08.660 environments that behind a firewall. So you only get access 00:37:08.660 --> 00:37:14.666 to FTP which let's you run comments and other stuff so what 00:37:18.002 --> 00:37:24.008 I was thinking it would be handy to make 50/50 proxy. So that is 00:37:28.880 --> 00:37:34.886 something I am working on and in a few months you will see some 00:37:39.757 --> 00:37:47.565 tool links on the website. Just short summary. Fifty/50 security 00:37:47.565 --> 00:37:53.571 measures don't trust them. There is a lot of information on the 00:37:56.875 --> 00:38:02.814 hardening of say green screen. You can also look at the book of 00:38:06.918 --> 00:38:13.925 Shaun (indiscernible) but don't trust these measures only. Also 00:38:13.925 --> 00:38:21.032 look and Java and be sceptical for IBM reps they promote 00:38:21.032 --> 00:38:26.638 (indiscernible) so take it with common sense and have this 00:38:26.638 --> 00:38:32.644 presentation look at whether you need to improve your security 00:38:35.346 --> 00:38:41.352 measures. And visit hack legacy. I up loaded the tool. You are 00:38:45.790 --> 00:38:51.796 free the change it. The whole project is encode there had and 00:38:56.234 --> 00:39:02.173 I included it already compiled (indiscernible) so you can click 00:39:04.842 --> 00:39:10.848 and open and enjoy. You can find me on twitter and you can also 00:39:15.720 --> 00:39:21.726 approach me by the hack legacy website. And now it is time for 00:39:36.174 --> 00:39:42.180 questions. Can you repeat the question? The public authority 00:40:00.531 --> 00:40:06.537 is excluded? I think that is group profile if you use the 00:40:09.140 --> 00:40:15.146 ownership, if you use one common profile and if you use -- I will 00:40:20.118 --> 00:40:25.323 just show you. The question is what is object authority of 00:40:25.323 --> 00:40:31.329 profile I was swiping to. So the problem is if you use the 00:40:40.371 --> 00:40:46.377 ownership for the profile as group profile, it will still 00:40:57.121 --> 00:41:03.061 have axis by the group from file and as long as you don't have 00:41:21.045 --> 00:41:25.249 exclude on the list to the profile object, you are not able 00:41:25.249 --> 00:41:31.255 to mitigate it. It's not a emulator it is (indiscernible) 00:41:37.161 --> 00:41:43.167 the question was, whether I am running am emulator? It is just 00:41:48.473 --> 00:41:54.479 (indiscernible) port forwarding to the Netherlands. The question 00:41:57.548 --> 00:42:03.488 was whether Java is installed by default? Yes. If you install 00:42:09.961 --> 00:42:15.967 client access you get the JT400 you can use and the problem is 00:42:24.709 --> 00:42:30.715 all the tools used by the IBM so the alcohol client access pack 00:42:39.457 --> 00:42:45.463 is Java based so has to be enabled because other -- (lost 00:42:53.071 --> 00:42:59.077 audio) I write only Java. If there are no other questions -- 00:43:16.861 --> 00:43:22.867 the question is what ports Java is using there is number of 00:43:26.971 --> 00:43:32.977 ports so refer to IBM website. I don't know them by heart. There 00:43:37.949 --> 00:43:43.955 are like three ports starting with 2000 depend on will you use 00:43:48.092 --> 00:43:54.098 SSL there are also different ports. Question was if I found 00:43:57.368 --> 00:44:03.307 mitigation for those types of hacks it is difficult you have 00:44:06.577 --> 00:44:12.583 to have good object security with a lot of excludes, the u 00:44:16.721 --> 00:44:22.727 you have legacy environment with group profiles you should just 00:44:25.162 --> 00:44:31.169 limit access to the Java part because most of the time that 00:44:35.306 --> 00:44:42.880 user don't need access to regulator and dependent on 00:44:42.880 --> 00:44:48.886 whether you use I pH which requires extra ports for the 00:44:52.190 --> 00:44:58.196 sign on server or use external tooling like 50 to 50 you can 00:45:03.067 --> 00:45:09.073 limit the ports like 992 for secure connection. I am 00:45:11.509 --> 00:45:17.515 available the whole conference, so if you have questions feel 00:45:19.951 --> 00:45:25.957 free to approach me. I will be around here. You can just sent 00:45:30.928 --> 00:45:36.934 me e-mail or twitter. just look up on the website, alright, 00:45:40.237 --> 00:45:42.740 thanks alot. (CLAPPING)