text
stringlengths
0
2.35k
**Ivan Kwiatkowski:** Yes, of course. \[laughter\] Yeah, this might be real life for a lot of people out there. Shout-out to them, I guess... But this is exact what reverse-engineering is. You receive some source code; whether it is assembly or high-level code - that does a bit of a difference, because assembly is hard...
**Natalie Pistunovich:** This brings me to the next question, that generally Go best practice, let's say, or the right way to do Go is to write simple, readable code, rather than sophisticated, and like ternary operations and whatnot, and complicated things... Does this in any way help, or not?
**Ivan Kwiatkowski:** \[35:45\] I wish, but it turns out that for the compiler, whether you write the simple way or the ternary operation, if the compiler is smart enough, then at the end of the day it's going to generate the very same assembly construct. Hopefully, the compiler, if you do this "if then... else", or if...
**Natalie Pistunovich:** Yeah, that's a great point.
**Ivan Kwiatkowski:** Actually, one callback from one question you asked earlier - you asked how many different things can the compiler do when it comes to different languages... An additional example I can give for Go is Go programs, Go functions, they can return any number of return values, right? This is not somethi...
And the difference between the languages are going to be small things like this when it comes to conventions, but actually, some of all of them are going to result in having a source code or an assembly code at the end of the day that is really extremely different from one another.
**Natalie Pistunovich:** Would you say, from what you see, that the way Go handles on the compiler level the return of multiple arguments is efficient, overall?
**Ivan Kwiatkowski:** Yeah, it really feels like it, as far as I recall. Maybe this is me making a mistake, but it feels like the return values from one function call are placed exactly where they should be on the stack, so that another function can use them as arguments immediately. And so chained calls between differ...
**Natalie Pistunovich:** Nice. Good to know; it's always encouraging... So Go is kind of built in a way that you don't debug this line by line, with breakpoints and so on, as you do in many other languages, but you do something and you check for errors, all the time. I will not ask you whether malware is generally writ...
**Ivan Kwiatkowski:** I do know, actually, because I end up reading the code, right? So what I learned about Go by reading assembly code, and also by trying it myself to understand what was going on, is the fact that the Go language will not allow you to not catch the errors, right? If you have a function that returns ...
**Natalie Pistunovich:** Yes...!
**Ivan Kwiatkowski:** Right. But as far as I can tell now, at least for the programs that I've seen, they do catch the errors, and they check for the errors, and they handle them properly... Which I think makes sense, right? Because if the language forces you to do it, then you're going to do it. Of course, you can cir...
**Natalie Pistunovich:** \[40:25\] That is a little bit sparking joy to know that, even \[unintelligible 00:40:27.06\] the best practices... But it's true that errors have a lot of information in them.
**Ivan Kwiatkowski:** Is that something that, as a developer, you are not seeing? Do you see a lot of co-workers and the code you receive where the error-checking is bypassed and not used at all?
**Natalie Pistunovich:** No, usually those things will not pass peer review... But I just don't know enough whether hackers do peer review. So that's -- that is interesting.
**Ivan Kwiatkowski:** Well, this is what I've seen; it's going to be anecdotal at best. Of course, there are always going to be hackers out there that do things their own way, their own bad way, just like real world developers that work on other legitimate projects... And so I can only speak about the few malware progr...
**Natalie Pistunovich:** That, of course, makes sense. But still, I'm happy to hear that generally good practices are followed everywhere... But another thing that I wanted to ask about that is how does this represent in assembly, given that this is generally not a very common practice...? I guess because you don't see...
**Ivan Kwiatkowski:** Well, the way I see it is that when I look at the assembly code, most of the times, since I'm not a Go developer, I have to look up the functions that are being called. Sometimes the names are self-explanatory... But most of the times I have to go to the Go documentation... Which by the way, I thi...
So the way that you would see it in assembly would be like you have this function call, and then you see some random variable being taken back from the stack, and compared with value zero. So basically, if err=nil, and then you have a block, and whether or not the error is or is not nil, then you can go into that block...
**Natalie Pistunovich:** So earlier you mentioned something that you -- you compared kind of your work to getting code from a colleague, but it's all kind of no parameter names, no documentation, no function names, and so on... And that reminded me how sometimes you can use all sorts of AI tools like Codex and Copilot ...
**Ivan Kwiatkowski:** \[43:48\] I didn't. Now, I know that GitHub released this project. I personally have a very religious fear of such projects, just because I know that the way it works is that all the source code that I write gets uploaded into the cloud, and analyzed, and gets to feed the machine learning algorith...
**Natalie Pistunovich:** And if it's on GitHub, it goes to the same place.
**Ivan Kwiatkowski:** Exactly. It also ends up there. So overall, there's not really a good reason for me not to do it. But I didn't try it yet. I've been told by some co-workers... I think they've used it for Python, and I've been told that it's amazing. It can pretty much guess what you're thinking, which is kind of ...
**Natalie Pistunovich:** When you write code, or when you reverse it?
**Ivan Kwiatkowski:** Yeah, exactly. When you write code. I am not aware of a machine learning project that would help you reverse-engineer programs... Although I am 100% sure that this is possible. I've been playing a lot with the image generation AI, especially Midjourney. I tried the one that generates text which is...
**Natalie Pistunovich:** So a follow-up question to that... For code generation, some languages are better than other; for example, Go is performing even better than Python and such, just because NGO has this built-in linter, and there's many things that it's not either/or, but it's definitely tabs. It's definitely cur...
**Ivan Kwiatkowski:** Yes and no. So what you're referring to is the fact that the more strict languages are, then the easier for an AI it is to understand what this meant and to generate code. And I think it makes sense, because Python, for instance, as a language, is extremely ambiguous, right? Not as ambiguous as Ja...
On the other end, when you have some assembly code, then assembly code is going to be this very strict, unique language that probably all AIs will have to work on. And I'm not exactly sure how they are going to work their way back up to either recognizing a function, or actually generating corresponding high-level code...
\[48:08\] But the good thing that AIs will have going for them is that assembly is going to be like the exact opposite of ambiguous, right? Like, you have ambiguous, and at the exact other end of what's possible you have assembly, which is 100% precise...
**Natalie Pistunovich:** As consistent as it gets.
**Ivan Kwiatkowski:** Yeah, consistent, and actually done in some ways, but it's just very simple operations that can only do a single thing in a very defined way. So on that front, I think that this is actually going to be a very, very good thing for the AIs, whenever they are ready.
**Natalie Pistunovich:** So there's already good tools out there, that just take binary and translate that into assembly; not 100%, but a very good coverage. And assembly is consistent enough, so that means that some IDA Pro plugin that uses AI must be developed as we speak, to say "Here's assembly input. Please transl...
**Ivan Kwiatkowski:** Well, it's a good question, because you would think that someone would be working on this... But when you look at the market for reverse engineering tools, it's actually quite small. You have Hex Rays, the creators of IDA Pro, and Hex Rays are kind of an old-school company. Their product is amazin...
The way that the compiler is working at the moment, as far as I understand, is purely through algorithmic means, and they do not use any form of machine learning. There is no AI applied to their decompilation process. Maybe they have started working on this, but as a company - and maybe I'm totally mistaken about this,...
I think Ghidra, which has a decompiler as well, is open source, and I think this decompiler is doing pretty well, too... But I don't think it uses AI in any shape or form either, and I'm not aware of any plans to like to start working on this. Probably developing some AI product focused on reverse engineering would req...
I think if it were public, or if it was out there, I think I would know about it; maybe I don't. But overall, if there was this big project about to be released, I want to believe I would have heard about it. But I do still hope that some company somewhere, probably in Israel, is working on this in a secret lab, and ev...
**Natalie Pistunovich:** \[51:59\] Yeah, another idea for the followers who are tuning in. So in addition to an AI that translates from assembly to Go, it would be personally interesting for me to have some AI that says "This malware is written in the style of..." And what I mean by that is that already now you can wri...
**Ivan Kwiatkowski:** Yeah, that's a very nice idea. And actually, there have been, maybe not rumors, but open research projects working exactly on this for probably decades in the \[unintelligible 00:53:08.15\] intelligence field. I think I recall, a CCC presentation from maybe 2010 or 2012, one of those years... And ...
Now, it's been 10 years, 15 years... I'm not sure -- I haven't heard about this for a while, so maybe this either didn't work as well as they expected, or this was actually absorbed into some intelligence service somewhere... Because there are very obvious intelligence applications there, that I think would -- like, th...
So this is something we know they want, and this is something that we also know they spent money on, and I remember that some universities were actually working on those types of projects... For research, not for intelligence, but those worlds, they tend to communicate with each other anyway, when there are application...
If this came to fruition, then this did so in secret. The way that they used to be working on this was, again, algorithmic; they were trying to extract the characteristics, and they were not using those blackbox AI capabilities that we have now. Maybe this is a new avenue of research for those applications. Maybe we'll...
**Natalie Pistunovich:** This episode took very interesting turns, like new ideas for tools and projects and whatnot, and remember where you heard this first.
**Ivan Kwiatkowski:** Yeah, I was not expecting that.
**Natalie Pistunovich:** Yeah, but that's very cool. That's really inspiring to speak with you, Ivan. Thank you for this hour of the conversation.
**Ivan Kwiatkowski:** Of course.
**Natalie Pistunovich:** As the previous episode, it also ended with me having lots of open questions... Please consider joining me again next year for one more episode, or ten more. \[laughs\]
**Ivan Kwiatkowski:** Yeah, of course. Eventually - and I think it will be pretty soon - we're going to expand the whole knowledge that I have on the Go language, right? If I have to come back, then at this point I will really have to look into the language more, and maybe try to come with actual research that I can sh...
**Natalie Pistunovich:** Well, next time we'll talk about generics maybe... See how that Go proposal goes.
**Ivan Kwiatkowski:** And I'll work on that.
**Natalie Pistunovich:** Yeah. And instead of unpopular opinion, we have provided two unicorn ideas... So you're welcome, everyone. \[laughs\]