1 00:00:00,000 --> 00:00:01,460 Okay, hello everyone. 2 00:00:01,460 --> 00:00:03,200 Thank you for being here. 3 00:00:03,560 --> 00:00:08,260 My name is Cyrus Parzian and I am an AI retimer at one of the largest U.S. 4 00:00:08,260 --> 00:00:09,660 healthcare companies. 5 00:00:10,900 --> 00:00:12,780 Okay, can you hear me better? 6 00:00:13,660 --> 00:00:15,620 Okay, my name is Cyrus Parzian. 7 00:00:15,620 --> 00:00:17,620 I'm an AI retimer at one of the largest U.S. 8 00:00:17,620 --> 00:00:18,980 healthcare companies. 9 00:00:18,980 --> 00:00:25,720 Just a disclaimer, what I will be sharing today is my personal view and opinion and does not reflect my employer. 10 00:00:26,660 --> 00:00:39,380 So I've been in offensive security, especially in the areas of phishing, creating and modifying payloads, and finding new ways to bypass an AV and EDR for the last 10 years or so. 11 00:00:39,520 --> 00:00:44,120 And about last year, we actually started our own dedicated AI retiming. 12 00:00:44,280 --> 00:00:52,200 And I've been focusing a lot on prompt injection and different ways to bypass healthcare chatbots or different type of chatbots. 13 00:00:52,200 --> 00:00:59,560 But one area I think that might not get enough attention is the supply chain risk attacks in AI and large language models. 14 00:01:00,300 --> 00:01:02,840 So today we're gonna talk about that. 15 00:01:03,140 --> 00:01:14,480 Also, as part of my presentation, I will be mentioning a few well-known and top-tier tools and platforms, but the main goal is to stay vigilant and raise awareness. 16 00:01:16,740 --> 00:01:22,640 So first, I'm not the first person to actually talk about Pickle Falls and the danger of them. 17 00:01:22,640 --> 00:01:32,620 Back in Black Hat 2011, Marco first talked about Pickle Falls and highlighted the security issues with Pickle Falls. 18 00:01:32,880 --> 00:01:38,240 And then in DEF CON Theory, Jonathan talked about how you could actually backdoor Pickle Falls. 19 00:01:38,240 --> 00:01:44,400 And today we're gonna talk about the dangers of Pickle Falls in the age of AI. 20 00:01:44,900 --> 00:01:53,520 So in this demo, I just show you real quick how you can actually turn an object into a Pickle file. 21 00:01:53,520 --> 00:01:55,480 It's a very simple method. 22 00:01:55,580 --> 00:02:02,000 And then next, we're gonna look into how you can actually create a malicious Pickle, which is, again, very simple. 23 00:02:02,000 --> 00:02:14,980 In this example, we're just gonna basically pop up a calculator and then we have our load.pickle, which is just gonna load our Pickle Fall and then just gonna pop up a calculator. 24 00:02:14,980 --> 00:02:17,640 So that really what the demo is. 25 00:02:17,640 --> 00:02:25,220 But really what Pickle is, Pickle is a way or usually default way in Python to serialize and deserialize objects. 26 00:02:25,480 --> 00:02:35,740 Think of it as a way that Python, Pickle turns objects into byte stream and then when we load it, it turns it back into objects. 27 00:02:35,740 --> 00:02:41,860 And one of the main issues with it is that it can execute code when it's loaded. 28 00:02:42,260 --> 00:03:01,680 And Pickle Falls usually have the extension Pickle or .pkl, but not every, but some files could actually not have the extension Pickle or .pkl and they still be a Pickle Fall because what really matters is the content of the file, not what really is the extension. 29 00:03:01,680 --> 00:03:08,880 And that's one of the security issues is that you can't really rely on the extension to actually run that. 30 00:03:09,920 --> 00:03:15,800 So let's think about how an attacker would go and actually try to use this vulnerability. 31 00:03:15,980 --> 00:03:34,980 So they may go and download a model file from a website such as Hugging Face or GitHub, and they could go and create a model or a chatbot themselves as well, but we attackers like to use name camouflage so whenever we can use the popularity and the familiarity of people with another model or chatbot, 32 00:03:34,980 --> 00:03:36,800 we're gonna focus on that. 33 00:03:36,840 --> 00:03:43,100 And then after we downloaded that chatbot, for example, we're gonna try to insert our malicious code inside that chatbot. 34 00:03:43,100 --> 00:03:48,440 And then we're gonna republish the model file to a website such as Hugging Face or GitHub. 35 00:03:48,440 --> 00:03:52,400 And then we're gonna, at that point, we really have two options. 36 00:03:52,400 --> 00:03:58,040 We could just sit back and relax and see who's gonna download our model or chatbot and run it. 37 00:03:58,040 --> 00:04:13,440 Or if you're trying to actually go after a specific environment or target, we might make a very enticing phishing ruse and send that to them and entice that, in this case, probably most likely a developer to download our chatbot and run it. 38 00:04:14,600 --> 00:04:20,320 So when I wanted to do that, I really didn't trust a lot of chatbots that were on Hugging Face. 39 00:04:20,320 --> 00:04:22,900 So I just decided to create my own chatbot. 40 00:04:23,080 --> 00:04:24,800 This is not a Rack chatbot. 41 00:04:24,800 --> 00:04:33,440 Rack chatbots are chatbots that you have a data set, you have basically some data that you go create embedding of it, you set in a vector database. 42 00:04:33,640 --> 00:04:40,120 This chatbot just relies on Flan-T5 small model, which is a model that you can run in most CPUs. 43 00:04:40,120 --> 00:04:42,980 And that's why I actually chose that. 44 00:04:42,980 --> 00:04:48,020 And there's another thing as well, is the Pickle Fall. 45 00:04:48,020 --> 00:04:55,120 The Pickle Falls have a set of questions and answers that we're relying on in here to help our chatbot to answer it. 46 00:04:55,120 --> 00:04:59,200 So I might go ask a question, what are the symptoms of the flu? 47 00:04:59,200 --> 00:05:06,240 And you see the answers, because our Flan-T5 small model is so small that it actually repeats the word fever. 48 00:05:06,300 --> 00:05:20,840 Another note here is that if you look at, in the Hugging Face, next to our Pickle Fall, there's a white square that says Pickle, and if you click on that, it says that Hugging Face scanners didn't find any issues with the Pickle Fall. 49 00:05:20,840 --> 00:05:28,460 So there's no problematic problem with this chatbot, but here is the modification version of it. 50 00:05:28,460 --> 00:05:31,040 And in this version, we went and made two changes. 51 00:05:31,040 --> 00:05:36,000 First to the Python Fall, which is the main fall we have here, and also to our Pickle Fall. 52 00:05:36,460 --> 00:05:42,040 And if you notice here, there is a change to our white square, and now it has turned into orange. 53 00:05:42,040 --> 00:05:51,720 And if you actually click on it, you see that Hugging Face mentioning that the reverse shell fix function that we're mentioning here might be the issue. 54 00:05:51,740 --> 00:06:01,180 But one note is, I think when I actually uploaded this, it took a week or two weeks for Hugging Face scanners to have enough time to actually load that. 55 00:06:01,400 --> 00:06:08,700 And when they did, you have to actually go and click on that orange square to see the problem. 56 00:06:09,420 --> 00:06:15,140 Now let's take a look at what we changed about our Python Healthcare chatbot. 57 00:06:15,140 --> 00:06:21,160 We added the function, reverse shell fix function, which is a very simple function. 58 00:06:21,160 --> 00:06:24,120 I call back to a server and port address. 59 00:06:24,120 --> 00:06:27,700 Now if you want, you can set up a content delivery network or a CDN. 60 00:06:27,780 --> 00:06:32,120 And in our Pickle Fall, which I said, we have a set of questions and answers. 61 00:06:32,420 --> 00:06:36,800 At the end, we have a callback to war zero, which is our reverse shell fix function. 62 00:06:36,800 --> 00:06:45,960 So what really happens here, when the chatbot loads the Pickle Fall, it actually calls back to that reverse shell fix function, which gives us a shell. 63 00:06:46,620 --> 00:06:56,220 One of the greatest tools out there is Fickling for basically analyzing, creating Pickle Falls, and also check the safety of Pickle Falls. 64 00:06:56,240 --> 00:07:08,760 So in here, I used Fickling first in the above screenshot to analyze the, this keeps going, to analyze the Pickle Fall and the modified version of the Pickle Fall. 65 00:07:08,760 --> 00:07:25,400 So as you can see here, in the previous version of the Pickle Fall, we only have the set of questions and answers, but in the modified version of the Pickle Fall, we have added a new question and answer, which is the stealth payload, and also the war zero, 66 00:07:25,400 --> 00:07:28,000 which calls back to reverse shell fix function. 67 00:07:28,560 --> 00:07:48,380 In the bottom screenshot, you see that I actually check the safety of the modified Pickle Fall using Fickling, and as you notice, it exactly points out the issue with the Pickle Fall, which is the war zero and reverse shell fix function, and says this fall could maybe malicious. 68 00:07:48,880 --> 00:07:54,060 But not every open source or actually commercial tool is gonna point that out. 69 00:07:54,060 --> 00:08:02,000 So on the right side of the screen, I have two very well-known open source tools for scanning Pickle Falls. 70 00:08:02,000 --> 00:08:07,060 I use them, and as you notice, they actually not point out any problems with that Pickle Fall. 71 00:08:07,240 --> 00:08:25,640 And I actually created this chatbot in February of this year, and when I ran it against most AV and EDRs, they did not detect any issues with it, and one of the very well-known commercial tools for scanning Pickle Falls said, this attack may be a little bit complex because it's using the Pickle Fall and also Python together, 72 00:08:25,640 --> 00:08:28,960 so they hope that they can actually detect it in the future. 73 00:08:30,480 --> 00:08:41,320 After I created this chatbot, I notified Microsoft about it, so starting April this year, if you try to actually download this... 74 00:08:41,960 --> 00:08:44,880 Sorry, this keeps going to the next slide. 75 00:08:44,880 --> 00:09:01,320 But starting this April, if you try to actually download the healthcare chatbot, you notice that it would say virus detected, and if somehow you had an option to actually try to run the chatbot, it would say this is a reversal Trojan and would not allow you to do that. 76 00:09:02,160 --> 00:09:04,980 Now let's take a look at a different demo. 77 00:09:04,980 --> 00:09:20,040 In this demo, I'm gonna put all the reversal fix function and also the call to that function in a single Pickle Fall, and we're gonna just try to run it as an example to see if you're actually able to bypass Microsoft Defender Endpoint. 78 00:09:20,040 --> 00:09:25,340 And I bring up Microsoft Defender Endpoint EDR because it's one of the greatest EDRs out there. 79 00:09:25,340 --> 00:09:36,660 And as you can see here, using our one-liner, we can actually bypass Microsoft Defender Endpoint and it does not raise any flags or issues. 80 00:09:36,660 --> 00:09:41,960 And I was able actually to install Microsoft Defender Endpoint trial in here without any issues. 81 00:09:42,600 --> 00:09:44,820 Next, we're gonna look at ONNX. 82 00:09:44,820 --> 00:09:53,360 ONNX is a deep learning model that's used for actually converting a framework to another framework. 83 00:09:53,360 --> 00:09:58,320 So you might have a PyTorch model that you're trying to change it to TensorFlow. 84 00:09:58,920 --> 00:10:09,480 You're doing the same thing that we did in Pickle Fall, but we're just gonna use a one-liner to see if we're actually, in this time, we can actually bypass Microsoft Defender Endpoint. 85 00:10:09,540 --> 00:10:21,040 And as you can see here as well, we get a callback to our command and control, which is just a very simple Python server, but I was just curious if that would actually bypass Microsoft Defender Endpoint as well. 86 00:10:21,180 --> 00:10:27,600 And if we go to the protection history, we don't see any signs of our malware being detected. 87 00:10:27,600 --> 00:10:31,920 And in the virus and protection settings, everything is good as well. 88 00:10:32,440 --> 00:10:34,760 So now let's take a look at the code. 89 00:10:35,000 --> 00:10:47,960 In our Pickle version, we just go define the reverse shell payload, we encode it in a Base64, we create a malicious class for that, and then we just dump the Pickle Fall. 90 00:10:47,960 --> 00:11:00,280 And very similar in the ONNX version, we define the reverse shell payload, we encode it with Base64, and we create a ONNX model, and then we embed our payload and we save it. 91 00:11:00,280 --> 00:11:05,420 So that's a very easy way that we could actually compare those two together. 92 00:11:06,400 --> 00:11:08,260 Now let's put everything together. 93 00:11:08,260 --> 00:11:15,940 We've gone to the ONNX, now we want to take a look at what happens if we actually try to inset that ONNX as part of our healthcare chatbot. 94 00:11:15,940 --> 00:11:26,380 Because what I want you to think about at this point, that healthcare chatbot is just a loader that we try to load various Python modules that may allow us to run code. 95 00:11:26,380 --> 00:11:45,420 So in here, we're just going to try to create our ONNX malicious file, and then using ONNX.load in our healthcare chatbot, we're going to load that malicious ONNX, and we're going to use Flan-T5 model, similar as before, to run that code. 96 00:11:46,020 --> 00:11:50,260 Sorry, it seems we are running at issue, okay. 97 00:11:51,360 --> 00:12:14,040 Okay, in here, as you can see, we're going to run the Flan-T5, we're going to run our healthcare chatbot using Stemlet, and, apologies for some reason, and then in here, as you can see, we are running the healthcare chatbot, we are waiting to load our ONNX model in the background. 98 00:12:14,580 --> 00:12:16,460 I have to load this. 99 00:12:18,180 --> 00:12:19,980 Yeah, we're waiting for it here. 100 00:12:20,260 --> 00:12:38,280 And as you can see, we get a callback to our command and control, and now chatbot is functional, the developer or whoever is using the chatbot may just click on it, they get answers to their questions without any issues, and we as attackers got an access to their machine without them knowing that. 101 00:12:39,040 --> 00:12:45,420 So, this was just some theories of, we're doing it in a lab, but does this attack actually happens in real world? 102 00:12:45,440 --> 00:12:50,560 And there are multiple cases of that over this year and last year that has happened. 103 00:12:50,560 --> 00:12:59,240 One case was in February, Hugging Face found multiple malicious pickle falls on their website. 104 00:12:59,700 --> 00:13:18,600 Another developer in Disney actually gave access to their machine voluntarily because of AI Trojan horse, and the hackers were actually able to download 1.1 terabyte of data, and there was a malicious case of PyPy when they actually put some pickle falls there as well. 105 00:13:18,600 --> 00:13:21,220 So, still a big issue. 106 00:13:22,440 --> 00:13:32,140 So I talked about healthcare chatbot and how we could actually use that to make it a loader for various Python modules. 107 00:13:32,200 --> 00:13:38,460 In here, I created four other different versions as well and uploaded to Hugging Face. 108 00:13:38,500 --> 00:13:43,900 In the case of Egg, Egg is a, think of it like a zip file for Python packages. 109 00:13:43,900 --> 00:13:49,720 So I went and created a version that only specifically focuses on egg files. 110 00:13:49,980 --> 00:13:53,180 Then I created a Cloud Pickle version. 111 00:13:53,180 --> 00:14:02,000 Cloud Pickle, think of it still pickle, but it has extended functionality for other type of file types that you may wanna do. 112 00:14:02,100 --> 00:14:10,860 Joblib is another one that you only use to save models, but under the hood it actually has pickle. 113 00:14:10,860 --> 00:14:15,020 And then lastly is Feather, which I call it Fast CSV. 114 00:14:15,300 --> 00:14:19,740 So those are like all of the four type of healthcare chatbot I created. 115 00:14:19,740 --> 00:14:27,440 And as you notice, two of those are actually being detected by Hugging Face, but two of them are not being detected. 116 00:14:27,440 --> 00:14:33,780 And that really, the issue is that some of them could easily bypass Hugging Face security. 117 00:14:34,420 --> 00:14:44,820 In the next two slides, what I really wanna point out here is that there are a lot of Python modules that some of them are being used in LLMs. 118 00:14:44,820 --> 00:14:50,900 So Pickle is one that being used in LLMs, Cloud Pickle is another one, and we mentioned ONNX. 119 00:14:51,020 --> 00:15:01,240 But because of the prevalence of Python in large language models and in the AI workflow and pipeline, attackers don't necessarily need to go and use them. 120 00:15:01,240 --> 00:15:09,000 They could go and choose to use other Python modules such as Egg, such as Feather that we mentioned. 121 00:15:09,000 --> 00:15:22,900 So those are some of the notes that we wanna look into because we may go and just focus on the AI pipeline and just the modules that being used in AI pipeline, but we may miss the other important ones as well. 122 00:15:23,820 --> 00:15:26,020 Lastly, this is our last demo. 123 00:15:26,020 --> 00:15:31,900 In all of the previous demos I showed you, you actually needed to have Python installed on the machine. 124 00:15:31,900 --> 00:15:37,320 But using PyInstaller, you actually can turn your ONNX file into an EXE. 125 00:15:37,320 --> 00:15:48,680 So in here, I just turn our ONNX file that I showed you into an EXE, and we are able to get a callback to our command and control center here without any issues. 126 00:15:48,940 --> 00:15:56,880 And I'm actually, I'm gonna go as far as trying to scan this EXE with Microsoft Defender Endpoint, which usually they don't suggest you do that. 127 00:15:56,880 --> 00:16:06,060 But as you can see, we were able to actually bypass Microsoft Defender Endpoint without any issues using the ONNX EXE. 128 00:16:06,780 --> 00:16:13,760 Next, let's take a look at the Microsoft console and see what's the artifact look like for the EXE that we just ran. 129 00:16:13,760 --> 00:16:19,540 As you can see, VirusTotal gives our EXE a score of zero out of zero. 130 00:16:19,540 --> 00:16:24,900 And if you look, there is no sign of malicious activity as part of our EXE. 131 00:16:24,900 --> 00:16:34,300 So there are a lot of other models, there are other Python modules that you can go and try to turn them into EXE using PyInstaller. 132 00:16:34,560 --> 00:16:38,780 And that would absolutely bypass a lot of AV and EDRs. 133 00:16:38,780 --> 00:16:49,080 And that's one of the issues I had when I was doing full-time red teaming is that we had to spend days, weeks, or months trying to find a new payload that would bypass AV and EDR. 134 00:16:49,080 --> 00:16:55,080 But apparently, if you actually focus on a lot of these Python modules, you're able to do that. 135 00:16:55,980 --> 00:16:59,080 Okay, what is the mitigation or recommendations? 136 00:16:59,280 --> 00:17:03,460 Well, probably the main thing is do not run untrusted code. 137 00:17:03,460 --> 00:17:06,220 So if you don't trust it, do not run it. 138 00:17:06,220 --> 00:17:16,440 And if you want to think about from the developer's side of view, they trust the websites that they're downloading that to detect this type of activity. 139 00:17:16,440 --> 00:17:24,660 And after they download it, they trust the AV and EDR to actually basically detect any type of malicious activity. 140 00:17:24,660 --> 00:17:26,900 But in this case, it doesn't happen. 141 00:17:26,900 --> 00:17:42,860 So another thing that you might want to focus on is restricting access to websites such as GitHub and Hugging Face for most of the users in the environment because it is so easy to actually download the type of, this type of healthcare chatbots that in the background, 142 00:17:42,860 --> 00:17:46,260 they may actually give access to the machine, to the attacker. 143 00:17:46,800 --> 00:17:49,260 And why traditional security fails? 144 00:17:49,260 --> 00:18:01,340 Well, traditional security fails because the reality is a lot of AV and EDRs are not looking into the supply chain risk attacks with AI and ML file formats. 145 00:18:01,420 --> 00:18:09,480 And it is not an easy job to actually try to, you know, go and patch the issues and the securities with those. 146 00:18:09,480 --> 00:18:20,360 So in a, for example, an example for a HTA file or a JavaScript file, it is very easy to go and block or detect a .HTA or JavaScript. 147 00:18:20,360 --> 00:18:28,420 But as we showed, a Pico file, if it doesn't have the .pko pickle, still could be a secure risk but we wouldn't know that. 148 00:18:28,620 --> 00:18:33,620 So those are some of the things that I think could be great to implement. 149 00:18:33,620 --> 00:18:38,000 With that, thank you for your attention and I hope you found this informative. 150 00:18:38,000 --> 00:18:38,360 Thank you.