Open Source This — Make No Mistakes
Skills:
LLM Engineering80%
Key Takeaways
Utilizes LLMs for reverse engineering of proprietary binaries, protocols, and system behavior to enable open source reimplementation
Full Transcript
[music] Welcome to the last presentation. Open source. This Daniel show us how. [laughter] >> Okay. Thanks a lot. Uh so I'm Daniel Daniel Bipik and I have uh two messages for you a bad one and a good one. So the bad one is this will be an AI related talk but the good one is that it's the last AI talk for today. So there's something positive here to get out. Um actually three months ago when I was thinking about what kind of talk I want to give I would not have thought at all that it will be about AI but then sadly I procrastinated um CFP and when it was actually time to submit I actually stumbled over this article and I'm not sure if anyone of you have seen that um if not then just a brief summary there is this Python library called Shardet and um maintainer of this library actually decided for version 7 to rewrite this Python He didn't rewrite it in rust. He w it rewrote it from Python to Python. But while doing the rewrite, the interesting was um that he did it AI guided essentially and at the end he considered himself to be in a position to change the license. So now I'm not an open source fundamentalist. In the end he changed it from LGPL first to I think MIT and then zero and clause BSD. So it's still open source but something stuck with me when I um was reading that because I thought hypothetically if I would work for a company who is selling proprietary software and um I'm seeing that then I have somewhat um hard argument why should I respect any kind of open-source license and that obviously made me a little bit angry to be honest and um I know um usually now if you're angry the first sword is not a good idea so I saw But my proposal for this talk should be something like let's turn it around. So let's say instead of uh removing open source licenses why can we not just take proprietary software throw it into an AI and have AI assisted essentially open source generation. So now I know the proposal is a little bit juvenile. So I was thinking a little bit okay maybe I can do something better a little bit more constructive. So what I want to do today is actually to go through with you through the process of having an artifact, reverse engineering it, writing a clean room specification and then re-implementing it and then looking a little bit what are the consequences out of that and of course most important doing it essentially with AI so that uh that the audience is is fitting. Okay, with that said let's get started. Um a brief introduction to reverse engineering. So I know probably most of you maybe think reverse engineering is kind of a dirty thing something like only in nefarious people are doing maybe some um yeah some garage hacker who want to break in somewhere or some evil corp who want to steal trade secret but I want to make the claim and if you take one thing with you today is reverse engineering is a is a great thing it's a very positive thing and only a very minor amount of usage of reverse engineering is could should actually be considered bad most of it is actually pretty good and I give you some examples. Um now yeah okay um so even even ch actually considers um it to be a problem from time to time. Um I still need to register for the trust access. Um either way I give you some examples for why engineering is actually good thing. So one thing is actually now research and study. So one thing I do at work quite oftenly is to procrastinate and I surf a little around on Taoba and look at some gadgets and what I found actually now recently was this kind of gim here which is a device you put into your car's uh cigarette igniter and then it claims that it will reduce your fuel usage of your car. So so that's u huh the that seems quite amazing. Um so um I mean I I like to learn things. Um um so we could apply now reverse engineering on top of that one. So one thing is we could do a blackbox uh reverse engineering. We could maybe put put it into an IC engine first and then afterwards into an electrical vehicle and see does it also save actually battery because if it works for two then maybe we can uh now reverse engineer the working principle or we could cut it a little bit short and just take it apart and have a look at it and then we see there's actually a capacitor and some resistors and LED inside and the only thing what it's doing is actually glowing blue. Um so it's it's obviously a scam but but it's interesting to learn. I mean we do not really learn something technically here but we learn a little bit about society which accepts to have these kind of products. Another interesting thing is interoperability. So um I guess there are a lot of Linux users here and you make a lot of fun in the past about the fruit company users but actually it's hard time for the last six years to make fun of them because their hardware is so impressively good. So actually this project actually brings Linux to the Apple silicon and the majority of the work is actually done based on reverse engineering because obviously Apple doesn't release their specification. Another example is digital preservation. So many of you might know that the best games actually were developed in the 80s and '90s. And if we wouldn't have um this kind of old console anymore, they all falling apart. And if there wouldn't be people who reverse engineer the hardware and the game engine and bring it to the non current platforms, then we couldn't play these amazing games anymore. Then uh we have um cars. So there's the right to repair. And that's a really nice thing to have. But what is it good for to have a right to repair if you are not able to actually repair something because you do not know how to talk to your car. So there are huge open source communities who actually do reverse engineering of the canvas and um um in a diagnostic port of your cars so that you actually can do it by yourself or by a small car repair shop instead of going uh to the big car shops. And then something which goes a little bit closer to home. Every now and then uh some guys come by and my desk and put a piece of heart on my table and say we have the theory that this company is duplicating something. Um oh sorry actually this one is the seams one. Um um so um so we have we have we have this theory that this this company is infringing our IP and I mean and thinking positive it could be that it's just accidentally looking the same. It works the same. it runs suddenly also our software and it's compatible to all our products but of course it doesn't say a lot so reverse engineering is one approach now to figure out okay does that thing actually now have some of our trade secrets or it's infringing our P um very common so with that said I hope I can make the the point that reverse engineering is by far anious thing it's something everybody should do to actually learn more about uh this amazing world we are living in with all the gadgets around us no matter if it's software or hardware. So there are then of course strategies of how to do that. Um one approach you probably could understand is you take an artifact might be a software and you do some kind of static analysis of it. Um but then you can also approach the problem of course of checking for the behavior and um so for example keep the system running and check was doing and then uh derive out of that one um how it's functioning and um my hypothesis here would be that things like static analyzers and protocol tracing should be something in LM could assist us because in the end it is kind of a pattern matching and this is actually what I would like to show you now. But um in the beginning I was actually thinking um I should probably now introduce every single of these strategies to you and give you a prompt for it. But then I actually noticed this shouldn't be a prompt engineering talk. And as a matter of fact having all these prompts cascaded gives you a reliability of maybe 80 to 90% that um certain things work again and again and again. So that that is not very helpful for you. So instead I would like to go with you through three case studies today where um I essentially took three kind of products um for this presentation and show you how that actually could be done. So first of all let's think about what would be a good device uh to reverse engineer considering that an LM is not really reliable. So the reverse engineering done by LM might not be very accurate but also the reimplementation might be full of bugs. So what would be a product which is ideal to handle the things and I think it's obvious it's of course medical devices. So um more specifically CGMs. So um a CGM is actually a continuous glucose monitor. Um so the working principle is that you essentially shoot an electrode now through your skin and then it's actually measuring the molecule count uh of the glucose elements inside. Then there are these days um of course a battery inside of course and everything has Bluetooth. So it then sends you essentially uh telegrams to your phone and then plots it essentially um and I hear some people use it for diabetes. But actually uh we had a look at it because a colleague of mine wanted to run a half marathon and we wanted to optimize to figure out when is the best time during this marathon to actually add some energy into it because you could actually measure that out of the glucose. um a much better use case. And if we actually could now remove the mobile phone and instead maybe put a Linux device in between, I could actually like in formula one remotely actually see his glucose values which is of course very interesting case. So um how would be the procedure? So the number one important thing if you essentially start to reverse engineer something is that you build some kind of test harness where you are in control of the environment of the device. And I mean one pro way would be that I shoot that into my arm and then I drink a lot of coke and see okay now the glucose value is is increasing. So now these bits and um protocol should be increasing but um as I learned that actually takes quite a long time. So instead I actually created this kind of um test setup on the right side. Um I didn't have anything fancy so I just use honey and salt water. Uh so that I can actually now create a solution where I say okay I start with a little bit glucose and then I increase it so they can see boo the bits change. So then we want to have it on a Linux system running. Most notebooks these days have um a Bluetooth interface but we want to use a programmable one because we also want to follow um um the device when it's frequency hopping and we want to sniff which is not necessarily always possible. And then essentially we started and um took the original APK. So um um the APK you have from the Android app and actually push it into the um and um essentially guide it to um perform um an um yeah a static analyzers of the code and then create a clean specification. You can essentially imagine it as a markdown document which um doesn't just document the the exact code but documents what it believes the function of this app is. Afterwards we take this clean room specification and generate a Linux application and um then um to be honest um it didn't work in immediately but um after certain iterations so we did perform some uh dynamic analyzes. So we now started to interact with the sensor. At the beginning it believed it was a Bluetooth device but it was actually Bluetooth low energy device. So the behavior was a little bit wrong. And as a matter of fact is actually what you see there at the moment. So I'm actually um I have this sensor here. Um now now shoot in and um this one is actually capturing now uh the readings and as a matter of fact and that's very important if you reverse engineer something you need some kind of baseline. So I shoot another one in this arm and um I'm actually now synchronized that with the official lab so that I can see are the values actually plausible. Okay. So um so case study number one case study number two is a little bit more close to home. So maybe you know maybe you don't know um Semens is actually building 5G systems in the uh the infrastructure and the terminals but actually we do not always sell to all customers both sides and 5G is a very complex protocol and different inner vendors actually interpret it a little bit different. So if some customer actually maybe want to save some money and buy the infrastructure from someone else but use our terminals then um they actually might be in conflict. So maybe the protocol is interpreted differently and for um actually diagnosing that it's so common that most basement modem provider or mod providers for give you an diagnostic tool but these diagnostic tools usually run on Windows which might be okay if you just do it shortly but we actually had in the past some issues where maybe once in a half moon and um an error occurs so we had actually to have a system which runs for a very long period of time and actually there's a lot of data being created from the signaling So I think a very good use case um again so um now could we not just now take this um app in this case it was a Windows app the C++ one perform again a static analyzers create a cleanification and I hate to say that word but we really one shot a Linux imp implementation so really the very first implementation immediately worked which is quite helpful because in this kind of process I never needed to start any kind of Windows PC and that's something very special because if I would have performed the reverse engineering, I would have created the Windows app um PC, started the app and then look at the protocol and then essentially try to figure out how it works. So here the whole Windows part completely was removed because we could do it completely statically and then we performed actually the possibility check with old LO files. Um so that's actually nearly an order of magnitude less effort than for the first um the process. So now now we have this two now use cases we could say some of it probably works very well because um the LMS already know a little bit about the protocol. So what about taking an app which is a little bit more complicated but then again we need to find an app which at the same time where it doesn't really matter if it's actually not working so accurately. So I was thinking I was thinking I was thinking what would be a really good app to look at. Um um [laughter] now if you could check so now that this g only works if you are working at seammens if if you might not work at seammens then uh let me explain. So at at semens uh we have a zero trust endpoint connector. So this um is a tool for desperate users who just want to access the internal and um external network resources. Um it does a lot of sava security stuff additionally but in the end it's a VPN even if all the providers claim it's it's something more. The challenges we have or I personally have maybe other people are okay with that one is that the protocol is proprietary. It's optimized for Windows and Mac. um the Linux exists but it's not really good. It's actually really really bad and um it lacks support for the latest distribution and also um it's not really flexible. So I always need a GUI to have it running. So maybe uh to just cut it short because I'm running a little bit out of time. Let's have a look. So uh so this is an Ubuntu 604. So this client does not exist for this distribution. Um let me just show you briefly that uh we are here in a network um which is um not zero trust anything. So I just show you my IP. So this is from my home one. It's in China Unicorn Beijing. Maybe just remember it's starting with 221. Then we go to the diagnostic website of the zero trust um um infrastructure and we will see that we are not inside of the zero trust network and then we have another check about the speed test which only works if you're inside of the zero trust network uh which doesn't work so this doesn't resolve here okay so um now um let's have a look if the reimplementation works so actually I um I told um during the clean room specification to reimplement this thing actually in Ruby and instead of actually implementing it as an IP routing based system I said remove all these IP routs I want a proper proxy it's much better to be integrated into my workflow so essentially here we um now activate the proxy um from um this reimplementation and let's have a look so here with IP 221 when we reload it we in the zero trust network now so obviously Cloudflare is now afraid about because it's not too secure and then you will see that we are now uh actually coming out from another access point we have 202 and from Beijing tenin which is actually the ISP from this company so if you're really running the diagnostics so now actually the system understands oh we are now inside of the zor trust network that's surprising and um then also we can start actually the speed test and we see yes we are indeed inside of the zor trust network it recognizes that we are inside of the tunnel. Um yeah, it is actually working. So what does it take to do something like that? Because the tool has a certain kind of complexity. So it is more like two orders of magnitude more um stuff you have to throw into the LM. Um it took quite a bit. So I'm a little bit more than 15 hours all together. But um to be to be very honest, I would not have done that now without that one. It would have taken me much much longer. Um so the approach was essentially um doing a static analysis of the Linux application generating again the cleanome spec but then I changed the cleanup spec to um um essentially tell it um um to instead of providing me this IP routes a proxy interface um and then we essentially generated version one but then we had to yeah I would say dozens of times now iterate against the actual back end. Um and I was actually surprised that um um the zero trust infrastructure didn't blacklist me at one point because um a lot of the implementation was not really correct but in the end it works. Um I needed though to extract the credentials from the original app. So the whole credential workflow uh was not implemented just for the sake of our cyber security people that I do not get any complaints. Okay. So um just uh now to ground now where is this actually going? So um the the stuff I showed you it it is working. It's um it's prototypes which work end to end. Um it is to certain extent significant amount of um money you have at the moment to sort the problem. But it's possible but you have certain kind of issues and um this is actually not the interesting thing. If you throw the stuff into the LM it will tell you ah I implemented everything everything is great but no nothing is great. So for example the CGM first of all it loses 30% of all data. Um you might not not have seen that and the reason for that is actually that it doesn't implement the low power properly. So it actually doesn't put my tech into a low power mode which actually means this side will die earlier than this side. Um then and this is actually a critical thing the calibration doesn't really work. So I would not recommend to anyone to adjust their insulin based on this data. Um and and then there are some other issues like for the zero trust actually it seems we are using using the version two tunnel but um during the reverse engineer I actually noticed there's a version one tunnel I didn't even know that um but it actually was easier to implement uh so the protocol was a little bit easier and apparently it's still working so we I used that one from now but to summarize the stuff is slop I mean we we have to we have to be very clear about this what is generated is slop But it is useful slop. I mean going through when there was this process I learned a lot about all these kind of tools. So it actually is um in the sense of reverse engineering very helpful to help me to understand the the systems better. Um also it is motivating slop because the biggest issue you have with um reverse engineers at one point your motivation will drop if you do not have any progress and as you have seen it was very quick to have an end toend setup which didn't work perfectly but at least you were at a state where you could then iterate now with the full system. So this is very very powerful I have to say. So I uploaded some some of it not all of them for certain reasons and also this um um the slop engine which essentially has all these prompts um now to go through it. I I also upload if you're interested now have a look um but only submit AI generated code I do not want to see any human generated code. So legal uh so um actually I wanted to start with legal but if I would have done that uh the presentation would be much shorter. So what does legal say? So I'm not a lawyer and I didn't ask CH GPT but I did the third best thing you can do. I asked actually real lawyers. So actually uh for redundancy reason I asked civil ones in civil jurisdiction also inside of semens outside of semens and um surprisingly they always they all gave me the same feedback. It depends actually that oh that's amazing I maybe cannot really use that for a presentation. So I thought could we maybe make a business 101 chart uh where I give you a jurisdiction maybe China, Europe and US then I give you a legal question about the things I just done there and then you just give me a feedback like um how many gray hair do you get when I when I would want to do that at work or how uh much how angry or how um much tears do you leave when I when I actually want to implement that one. But as as a male, it turns out that um the uni code emoji set is too small to u replicate all the emotions our lawyers have. So instead instead um I think I do something better than that. I give you some of the questions they have uh which guide a little bit um um if it's meaningful to do. So if we have this pipeline, the first question they will ask and you should have an answer to that one is where did you actually got the original artifact? Did you sign NDNDDA? Uh did you download it from some strange website or was it really just freely available? So this is one they will immediately ask for the reverse engineering. One important thing they will ask is what's the purpose? Do you actually reverse engineer to extract trade secrets or now why do you want to do that? I think one of the most important and often forgot one also this guy in the very beginning of um who did a charted redevelopment actually missed it. What about the leakage between the reverse engineering and the reimplementation? Um do you actually have leaked things from the reverse engineering in form of code and implementation to the reimplementation? This is a no no. And uh I know at the moment agentic AI is quite big thing and a lot of people say that you should use a lot of agents. I do not sure how good that is but here I would make a claim it would make sense to have different agents without any context sharing for the reverse engineering of the reimplementation for the reimplementation then again do use trade secrets and IP and then in the end can that stuff actually be copyrighted or copy left and the answer I mean everybody has a different opinion but so far it's very difficult if this is all automated to show significant human input so I would actually say this pipeline doesn't work at the output cannot be licensed but I'm not a lawyer. So with that said summary um so I would say there's an undeniable speed up for reverse engineering AI assisted um you need to have a clearly automatable test setup against uh which you can run the AI and something I would be now quite um interested in is actually to integrate more hardware. So we do a lot of wireless systems. So it would be very interesting to um perform that one also on radio waves and then essentially have an SDR where we actually know recreate them with that also and we maybe the question comes up what is open source for you so I would say if open-source software for example is for you a piece of software which has a certain license then you are in for a bad time so I would say licenses are dead but there is a good news here if for you um open source is something you can learn from, something you can modify or control, then now the world is great because essentially everything is now open source. So with that said, AI is reverse engineering changes the economic rules. That's definitely the case, but not the legal ones. And with that said, I would just like to make one announcement and I'm end. Um, so Roger started the conference yesterday with mentioning his trip to China. So we have this open source at Chimemenzi event which is essentially the sister event of this one and this year we want to do another one. So we have every time first day uh doing general open source and second day making something special realtime artificial intelligence and semiconductors last year. So this year we would like to do open source robotics. So if you would be interested uh in joining that one as a speaker of course or as a guest feel free to hit me up and um maybe we can manage to find some excuses for your manager of why you need to come to China. So with that said thank you very much and have a nice day. [applause] [applause] Thank you. Fantastic. Can you comment a little bit on how how easy would it be to automate assessment of if a certain clean room's back is really clean? Is this something you can automate or would you ever need to go to? >> I I have no idea how how to do that because to be honest that was the reason why I set this leakage part. um you would need to uh know that um your reverse engineering activity in itself doesn't have created any kind of information which might be reused and if you use one of these cutting edge um um LMS in the cloud I do not know uh how and frequently they actually train so if I use them in one session and I start a new one with another agent does that one maybe have already learned from the first session so I would say um and this is actually what I try to do mostly if I have a local LM Um I would say um I'm feeling quite sure that there's no leakage whatsoever. I can control that quite good. But with commercial ones which are somehow running in the cloud I I I I wouldn't know. I wouldn't trust there anything that there's no leakage between sessions. >> Write the spec with GPT and limit it with cloud. >> Yeah. But uh how do you know that there's not a leakage between them both? >> Well, that I would be expecting not to be. Yeah. Yeah. But I mean you you have setups where um a third party like Microsoft is hosting both models. So So I do I do not know. I do not have any further insight. I have probably less insight than most of you into all these western AI models. But um I I I I do not know. Um >> uh great talk. Thank you. Um, how much did you have to fight token context limits or other limitations of the LLMs when feeding binary data into the LLM? >> That wasn't actually a big problem. Um, I mean I I I solved the problem with money mostly. So I I just uh I subscribed to the biggest one, but um I mean if you do not have a million token context, you will run into into some um but with the million token context with with the apps I used um it wasn't an issue. I mean of course there there's some compressing involved which automatically happens by the engines but um I didn't had any issues like that. >> Cool. Thanks. >> Just for the connectivity solution you analyzed there. [laughter] >> Can you say the reliability improved when you like >> No actually I mean now what you have now is um I can provide you slow internet also on uh uh on Ubuntu 604. Uh so I mean I can only provide what the back end provides. Yeah, I mean now to to um to clarify uh what was implemented was this um um internet access. Uh the private access on purpose I didn't implement because maybe someone would start to complain. Um but um of course the in so far I do not have this horrible GUI app. I can just do it from the comment line. So um I for sure have less memory usage [laughter] >> significantly. >> Thank you. In your experiments, have you thought a little bit about if you have, I don't know, some magic source trade secret that you absolutely would not want to leak, how you could engineer an implementation of that so that it is with these tools specifically not reverse engineerable, >> not give uh any customers access to this um to the binaries. >> So I would just put every everything as a service. >> Okay. >> Yeah. Yeah. I know. I mean to be honest I do not believe that you can obuscate anything here. This um zero trust thingy um is actually doing some kind of obuscating techniques which are completely meaningless. >> Okay, >> there's a [laughter] thanks for this thought. >> Perfect. Then I would say thank you very very much Daniel for this excellent presentation. [applause] >> [music]
Original Description
"It turns out that LLMs are useful not just for code generation, but also for reverse engineering. In this talk, I will show how LLMs can support the analysis of proprietary binaries, protocols, and system behavior to enable open source reimplementation. The focus is on reducing dependency on black boxes, increasing flexibility and rebuilding critical knowledge in the open."
Daniel is a researcher located in Beijing, where he works for Siemens on industrial communication systems.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: LLM Engineering
View skill →Related Reads
🎓
Tutor Explanation
DeepCamp AI