1 00:00:00,000 --> 00:00:12,260 I'm glad to see you here, Jess Tulpa. This is excellent. Jess Tulpa is from DC9111 in 2 00:00:12,260 --> 00:00:16,780 New Delhi, India. And by the way, if you ever want to see an excited Discord, go look at 3 00:00:16,780 --> 00:00:24,380 their Discord. It is amazing. Jess Tulpa is presenting shifting left and reversing applications 4 00:00:24,380 --> 00:00:30,740 by converting Smalley to Java. This should be interesting. Jess Tulpa is currently pursuing 5 00:00:30,740 --> 00:00:36,080 a master's in information security and is really interested in Android security. So 6 00:00:36,080 --> 00:01:01,160 with that, Jess Tulpa, take it away. Yes, sure. Yeah. So an introduction about myself. 7 00:01:01,160 --> 00:01:10,040 I am not currently in any job or anything, but I do like to research about security and 8 00:01:10,040 --> 00:01:18,480 digital forensics or whichever topic I like. I am also, as you can see, the tech support 9 00:01:18,480 --> 00:01:26,280 of my family and friends like what anything related to technology, which might be trouble 10 00:01:26,280 --> 00:01:34,200 for my families, I am there to help them. Also, my real name is Iain Ambesh. As you 11 00:01:34,200 --> 00:01:43,840 can see that my surname is similar to Bash. So I used to call myself Iain Bash. So yeah, 12 00:01:43,840 --> 00:01:52,040 that's fun. And the thing, why did I wanted to convert Smalley to Java? So in my batch 13 00:01:52,200 --> 00:02:00,680 years, I was doing an internship where I was supposed to use ZX, which is JADX. It is 14 00:02:00,680 --> 00:02:11,200 a Dex to Java decompiler, which was used for Android applications, static testing. So how, 15 00:02:12,200 --> 00:02:25,320 yeah, how does it work? How does JADX works? For JX, Dex is native for it, like the input 16 00:02:25,320 --> 00:02:35,040 which goes into the JX, it is native for it. So it can, and why does Dex is converted to 17 00:02:35,040 --> 00:02:45,800 Java directly? Because the Dex format, which is in dialogue bytecode is similar to Java AST. 18 00:02:45,800 --> 00:02:54,280 That is why Java code is generated. This is based on the comment made by the author of the tool, 19 00:02:54,960 --> 00:03:06,520 who is SkyLot. And on, in one issue, he, he talked about this, like how does Java is converted 20 00:03:06,520 --> 00:03:20,680 from Dex and so on. And yeah, yeah, the purpose of my talk, why, why do I wanted to give this 21 00:03:20,680 --> 00:03:28,680 talk and why I wanted to convert Smalley to Java? As you can see, JDX is not 100% 22 00:03:29,800 --> 00:03:37,240 error free. There are a lot of errors. And sometimes since applications can be overstated, 23 00:03:37,880 --> 00:03:47,560 or they can be like abstracted in multiple times, there, the ZX trick is unable to convert it into 24 00:03:47,640 --> 00:03:58,520 Java. And thus it gives inconsistent Java code. But it is not the problem with Smalley. Smalley is 25 00:03:59,720 --> 00:04:08,120 all right when it, like it's like, you can convert Dex to Smalley easily, but you are not able to 26 00:04:08,120 --> 00:04:25,000 convert from Dex to Java that much easily. When I was like, when I was in, when I was researching 27 00:04:25,000 --> 00:04:35,480 about it, there were very less resources on Smalley. Since it's not like, it's not, I don't know why, 28 00:04:36,120 --> 00:04:44,280 but there were not many resources on the language. And then I was searching about it. I found out 29 00:04:44,280 --> 00:04:53,000 about a person named Gabe Palla, and his work in Android, his work was quite nice, which gave me 30 00:04:53,000 --> 00:05:00,440 the idea that I can understand Dalvik and I can then maybe try to read Smalley and then convert 31 00:05:00,520 --> 00:05:09,080 it into Java. It's not that another person has not tried converting Smalley to Java. They have, 32 00:05:09,800 --> 00:05:19,000 but it's not like, they don't, it's like, they are just not talking about it or anything like that. 33 00:05:19,960 --> 00:05:28,760 As you can see, Smalley syntax is like, it's basic syntax, like for void we use v, 34 00:05:29,480 --> 00:05:38,760 for boolean we use z, for byte we use v, for short s and so on. For class def, class def is like 35 00:05:39,480 --> 00:05:47,240 the class name or the interface name, we use l for that. And for array we use bracket and so on. 36 00:05:49,000 --> 00:05:56,360 As you can see, the project I am currently working on, I was able to convert a Smalley 37 00:05:56,360 --> 00:06:06,440 hello world program to Java, but this is not the conclusion I wanted to reach. I wanted to convert 38 00:06:06,440 --> 00:06:17,320 an application, which is from dex, then to Smalley and then to Java. Since this is directly Smalley, 39 00:06:17,880 --> 00:06:25,240 there is no application and any layers upon it, so it's just directly converting Smalley to Java. 40 00:06:26,360 --> 00:06:37,880 The thing about converting Smalley is that it has a lot of spaces. If you can see like a constrain 41 00:06:37,880 --> 00:06:48,360 in the method and constrain, there are a lot of spaces. So it's like if you were to read Smalley 42 00:06:48,360 --> 00:06:57,400 and like read each word by word and then take word by word, it would be a little hard, but it's 43 00:06:57,400 --> 00:07:06,280 manageable. As you can see, I have instructions and of course, and I have regarded them as different. 44 00:07:07,080 --> 00:07:16,520 So, yeah. Also, you can see that why I wanted to convert Smalley to Java is that the Smalley 45 00:07:16,520 --> 00:07:27,400 language, if you can read it, you can find out that it gives out like in method, it gives out 46 00:07:27,400 --> 00:07:36,440 that it is public static main and then it's using string of array and then as you can see, 47 00:07:36,440 --> 00:07:45,320 let's get that it is using a sprint stream out, the function of print stream out and then it is 48 00:07:45,320 --> 00:07:52,760 using a constrain string hello world and then it is invoking the virtual and it is using that. 49 00:07:53,320 --> 00:07:57,160 So, it's easy to convert Smalley to Java like that. 50 00:08:01,240 --> 00:08:13,720 And yeah. Also, since ZX is literally an industrial 51 00:08:14,440 --> 00:08:24,200 industrial level tool, I'm not saying that it is like it is bad or anything else, but it has errors 52 00:08:24,200 --> 00:08:35,240 and it is like impossible to reach 100% error free. So why the thing is that 53 00:08:35,880 --> 00:08:46,200 the why I wanted to convert Smalley to Java is that in Android testing, static application 54 00:08:46,200 --> 00:08:53,720 testing, when you are given an Android application and you don't know anything about it, you have 55 00:08:53,720 --> 00:09:04,520 to convert it to code to understand it. Smalley is like a language type assembly type language for 56 00:09:05,640 --> 00:09:11,720 Android, but it's not that, but it is similar. And 57 00:09:14,600 --> 00:09:22,120 yeah, yeah, yeah, that is all. I'm sorry. This is my first yeah. Any questions? 58 00:09:35,240 --> 00:09:43,160 So, what's next for your research? What are you trying to take it to next? 59 00:09:44,920 --> 00:09:52,440 For next, I'm taking it to like, as you can see the applications, there are multiple 60 00:09:53,320 --> 00:09:58,600 DEX files. And so, you have to convert those DEX files into Smalley and then 61 00:09:59,320 --> 00:10:05,160 that Smalley to Java. So, you have to create a whole structure of the application 62 00:10:05,880 --> 00:10:13,240 and JADX does it quite nicely. So, I want to reach at least that much, 63 00:10:19,320 --> 00:10:25,160 but only by Smalley to Java, not by the ZX way. Yeah. 64 00:10:25,160 --> 00:10:31,400 What has been the biggest challenge for you this far? 65 00:10:32,600 --> 00:10:42,840 The biggest challenge this far is like, if you can see, yeah, if you can see the spaces between 66 00:10:42,840 --> 00:10:54,040 like, yeah, there's not like the spaces between objects, strings is not constant. It's like 67 00:10:54,920 --> 00:11:00,840 you have to use, sometimes use regex or sometimes you have to use some other method to 68 00:11:01,640 --> 00:11:08,200 you know, break out a string from a line, like in method public static main, 69 00:11:09,000 --> 00:11:18,200 you have to like the break public then static then main. And then from main you have to break 70 00:11:18,760 --> 00:11:26,280 the bracket for the array and this far. So, that's the biggest challenge I have been dealing with. 71 00:11:26,440 --> 00:11:38,920 Would it be possible to collapse all the multiple spaces down to single spaces without help? 72 00:11:40,440 --> 00:11:47,560 Are your voices breaking in there here? Okay, how's that? Is that better? Yeah, yeah. Okay. Well, 73 00:11:47,560 --> 00:11:53,720 would it be possible to automatically replace all the multiple spaces down to a single space 74 00:11:53,720 --> 00:11:57,320 would that help? Yeah, that would help. Yeah. 75 00:12:00,920 --> 00:12:02,600 Yeah, that would make it easier. 76 00:12:05,000 --> 00:12:09,080 So, a series of regex tools might help with cleaning that up? 77 00:12:11,480 --> 00:12:20,760 Yeah, but with regex the problem is that sometimes regex don't work. Like it may not be constant 78 00:12:20,760 --> 00:12:32,440 for the same string as well. Like for array in method, it may be different in any another instruction. 79 00:12:33,160 --> 00:12:41,160 So, it may it may be possible that some keywords or whichever I'm trying to find, 80 00:12:41,160 --> 00:12:44,680 it might not be able to regex it. 81 00:12:44,680 --> 00:12:54,440 Hmm. Yeah, I have tried it out. Yeah, but I'm still working on it. Yeah. 82 00:12:55,320 --> 00:13:02,600 That's an interesting problem. Yes. Yes, it is. That's why I was fascinated by it and I 83 00:13:02,600 --> 00:13:09,800 wanted to talk about it. Although I don't think it is anything fancy or like that. It's just a small 84 00:13:09,800 --> 00:13:18,440 thing. Yeah. I have a question. Yeah, sure. Go ahead. Is it something just conceptual for the 85 00:13:18,440 --> 00:13:34,040 research or do you have? It is for research, but I do want to make anything something like that. 86 00:13:40,200 --> 00:13:48,760 Like the people who want to learn about security, they can maybe, you know, 87 00:13:48,760 --> 00:13:56,920 run this up and then try to read the Java code and then be like, oh, this, this function works 88 00:13:56,920 --> 00:14:04,840 like this. Maybe I can make the free descriptor like that and so on. Yeah. Oh, so you're saying 89 00:14:04,840 --> 00:14:13,160 you can develop it into a sort of a security tool, essentially. Yeah. Jadex is also like that. 90 00:14:13,160 --> 00:14:21,320 If you see the Jadex interface, you can like right click any function and then you can basically 91 00:14:21,320 --> 00:14:28,360 create a free descript which you can run and then hook the function directly. Yeah. 92 00:14:28,760 --> 00:14:36,920 Any more questions? 93 00:14:41,400 --> 00:14:47,240 I hope in the future you can return and let us know how it went with your, you know, 94 00:14:47,240 --> 00:14:53,160 provide us with an update in your research. Yeah. Yeah. I will be sure to do that. Yeah. 95 00:14:53,160 --> 00:15:06,280 I don't think it will take that much, but yeah, I will do that. Yeah. Thank you. Thank you very much.