WEBVTT

00:00.000 --> 00:01.460
Okay, hello everyone.

00:01.460 --> 00:03.200
Thank you for being here.

00:03.560 --> 00:08.260
My name is Cyrus Parzian and I am an AI retimer at one of the largest U.S.

00:08.260 --> 00:09.660
healthcare companies.

00:10.900 --> 00:12.780
Okay, can you hear me better?

00:13.660 --> 00:15.620
Okay, my name is Cyrus Parzian.

00:15.620 --> 00:17.620
I'm an AI retimer at one of the largest U.S.

00:17.620 --> 00:18.980
healthcare companies.

00:18.980 --> 00:25.720
Just a disclaimer, what I will be sharing today is my personal view and opinion and does not reflect my employer.

00:26.660 --> 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.

00:39.520 --> 00:44.120
And about last year, we actually started our own dedicated AI retiming.

00:44.280 --> 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.

00:52.200 --> 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.

01:00.300 --> 01:02.840
So today we're gonna talk about that.

01:03.140 --> 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.

01:16.740 --> 01:22.640
So first, I'm not the first person to actually talk about Pickle Falls and the danger of them.

01:22.640 --> 01:32.620
Back in Black Hat 2011, Marco first talked about Pickle Falls and highlighted the security issues with Pickle Falls.

01:32.880 --> 01:38.240
And then in DEF CON Theory, Jonathan talked about how you could actually backdoor Pickle Falls.

01:38.240 --> 01:44.400
And today we're gonna talk about the dangers of Pickle Falls in the age of AI.

01:44.900 --> 01:53.520
So in this demo, I just show you real quick how you can actually turn an object into a Pickle file.

01:53.520 --> 01:55.480
It's a very simple method.

01:55.580 --> 02:02.000
And then next, we're gonna look into how you can actually create a malicious Pickle, which is, again, very simple.

02:02.000 --> 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.

02:14.980 --> 02:17.640
So that really what the demo is.

02:17.640 --> 02:25.220
But really what Pickle is, Pickle is a way or usually default way in Python to serialize and deserialize objects.

02:25.480 --> 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.

02:35.740 --> 02:41.860
And one of the main issues with it is that it can execute code when it's loaded.

02:42.260 --> 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.

03:01.680 --> 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.

03:09.920 --> 03:15.800
So let's think about how an attacker would go and actually try to use this vulnerability.

03:15.980 --> 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,

03:34.980 --> 03:36.800
we're gonna focus on that.

03:36.840 --> 03:43.100
And then after we downloaded that chatbot, for example, we're gonna try to insert our malicious code inside that chatbot.

03:43.100 --> 03:48.440
And then we're gonna republish the model file to a website such as Hugging Face or GitHub.

03:48.440 --> 03:52.400
And then we're gonna, at that point, we really have two options.

03:52.400 --> 03:58.040
We could just sit back and relax and see who's gonna download our model or chatbot and run it.

03:58.040 --> 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.

04:14.600 --> 04:20.320
So when I wanted to do that, I really didn't trust a lot of chatbots that were on Hugging Face.

04:20.320 --> 04:22.900
So I just decided to create my own chatbot.

04:23.080 --> 04:24.800
This is not a Rack chatbot.

04:24.800 --> 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.

04:33.640 --> 04:40.120
This chatbot just relies on Flan-T5 small model, which is a model that you can run in most CPUs.

04:40.120 --> 04:42.980
And that's why I actually chose that.

04:42.980 --> 04:48.020
And there's another thing as well, is the Pickle Fall.

04:48.020 --> 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.

04:55.120 --> 04:59.200
So I might go ask a question, what are the symptoms of the flu?

04:59.200 --> 05:06.240
And you see the answers, because our Flan-T5 small model is so small that it actually repeats the word fever.

05:06.300 --> 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.

05:20.840 --> 05:28.460
So there's no problematic problem with this chatbot, but here is the modification version of it.

05:28.460 --> 05:31.040
And in this version, we went and made two changes.

05:31.040 --> 05:36.000
First to the Python Fall, which is the main fall we have here, and also to our Pickle Fall.

05:36.460 --> 05:42.040
And if you notice here, there is a change to our white square, and now it has turned into orange.

05:42.040 --> 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.

05:51.740 --> 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.

06:01.400 --> 06:08.700
And when they did, you have to actually go and click on that orange square to see the problem.

06:09.420 --> 06:15.140
Now let's take a look at what we changed about our Python Healthcare chatbot.

06:15.140 --> 06:21.160
We added the function, reverse shell fix function, which is a very simple function.

06:21.160 --> 06:24.120
I call back to a server and port address.

06:24.120 --> 06:27.700
Now if you want, you can set up a content delivery network or a CDN.

06:27.780 --> 06:32.120
And in our Pickle Fall, which I said, we have a set of questions and answers.

06:32.420 --> 06:36.800
At the end, we have a callback to war zero, which is our reverse shell fix function.

06:36.800 --> 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.

06:46.620 --> 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.

06:56.240 --> 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.

07:08.760 --> 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,

07:25.400 --> 07:28.000
which calls back to reverse shell fix function.

07:28.560 --> 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.

07:48.880 --> 07:54.060
But not every open source or actually commercial tool is gonna point that out.

07:54.060 --> 08:02.000
So on the right side of the screen, I have two very well-known open source tools for scanning Pickle Falls.

08:02.000 --> 08:07.060
I use them, and as you notice, they actually not point out any problems with that Pickle Fall.

08:07.240 --> 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,

08:25.640 --> 08:28.960
so they hope that they can actually detect it in the future.

08:30.480 --> 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...

08:41.960 --> 08:44.880
Sorry, this keeps going to the next slide.

08:44.880 --> 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.

09:02.160 --> 09:04.980
Now let's take a look at a different demo.

09:04.980 --> 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.

09:20.040 --> 09:25.340
And I bring up Microsoft Defender Endpoint EDR because it's one of the greatest EDRs out there.

09:25.340 --> 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.

09:36.660 --> 09:41.960
And I was able actually to install Microsoft Defender Endpoint trial in here without any issues.

09:42.600 --> 09:44.820
Next, we're gonna look at ONNX.

09:44.820 --> 09:53.360
ONNX is a deep learning model that's used for actually converting a framework to another framework.

09:53.360 --> 09:58.320
So you might have a PyTorch model that you're trying to change it to TensorFlow.

09:58.920 --> 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.

10:09.540 --> 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.

10:21.180 --> 10:27.600
And if we go to the protection history, we don't see any signs of our malware being detected.

10:27.600 --> 10:31.920
And in the virus and protection settings, everything is good as well.

10:32.440 --> 10:34.760
So now let's take a look at the code.

10:35.000 --> 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.

10:47.960 --> 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.

11:00.280 --> 11:05.420
So that's a very easy way that we could actually compare those two together.

11:06.400 --> 11:08.260
Now let's put everything together.

11:08.260 --> 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.

11:15.940 --> 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.

11:26.380 --> 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.

11:46.020 --> 11:50.260
Sorry, it seems we are running at issue, okay.

11:51.360 --> 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.

12:14.580 --> 12:16.460
I have to load this.

12:18.180 --> 12:19.980
Yeah, we're waiting for it here.

12:20.260 --> 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.

12:39.040 --> 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?

12:45.440 --> 12:50.560
And there are multiple cases of that over this year and last year that has happened.

12:50.560 --> 12:59.240
One case was in February, Hugging Face found multiple malicious pickle falls on their website.

12:59.700 --> 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.

13:18.600 --> 13:21.220
So, still a big issue.

13:22.440 --> 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.

13:32.200 --> 13:38.460
In here, I created four other different versions as well and uploaded to Hugging Face.

13:38.500 --> 13:43.900
In the case of Egg, Egg is a, think of it like a zip file for Python packages.

13:43.900 --> 13:49.720
So I went and created a version that only specifically focuses on egg files.

13:49.980 --> 13:53.180
Then I created a Cloud Pickle version.

13:53.180 --> 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.

14:02.100 --> 14:10.860
Joblib is another one that you only use to save models, but under the hood it actually has pickle.

14:10.860 --> 14:15.020
And then lastly is Feather, which I call it Fast CSV.

14:15.300 --> 14:19.740
So those are like all of the four type of healthcare chatbot I created.

14:19.740 --> 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.

14:27.440 --> 14:33.780
And that really, the issue is that some of them could easily bypass Hugging Face security.

14:34.420 --> 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.

14:44.820 --> 14:50.900
So Pickle is one that being used in LLMs, Cloud Pickle is another one, and we mentioned ONNX.

14:51.020 --> 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.

15:01.240 --> 15:09.000
They could go and choose to use other Python modules such as Egg, such as Feather that we mentioned.

15:09.000 --> 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.

15:23.820 --> 15:26.020
Lastly, this is our last demo.

15:26.020 --> 15:31.900
In all of the previous demos I showed you, you actually needed to have Python installed on the machine.

15:31.900 --> 15:37.320
But using PyInstaller, you actually can turn your ONNX file into an EXE.

15:37.320 --> 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.

15:48.940 --> 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.

15:56.880 --> 16:06.060
But as you can see, we were able to actually bypass Microsoft Defender Endpoint without any issues using the ONNX EXE.

16:06.780 --> 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.

16:13.760 --> 16:19.540
As you can see, VirusTotal gives our EXE a score of zero out of zero.

16:19.540 --> 16:24.900
And if you look, there is no sign of malicious activity as part of our EXE.

16:24.900 --> 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.

16:34.560 --> 16:38.780
And that would absolutely bypass a lot of AV and EDRs.

16:38.780 --> 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.

16:49.080 --> 16:55.080
But apparently, if you actually focus on a lot of these Python modules, you're able to do that.

16:55.980 --> 16:59.080
Okay, what is the mitigation or recommendations?

16:59.280 --> 17:03.460
Well, probably the main thing is do not run untrusted code.

17:03.460 --> 17:06.220
So if you don't trust it, do not run it.

17:06.220 --> 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.

17:16.440 --> 17:24.660
And after they download it, they trust the AV and EDR to actually basically detect any type of malicious activity.

17:24.660 --> 17:26.900
But in this case, it doesn't happen.

17:26.900 --> 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,

17:42.860 --> 17:46.260
they may actually give access to the machine, to the attacker.

17:46.800 --> 17:49.260
And why traditional security fails?

17:49.260 --> 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.

18:01.420 --> 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.

18:09.480 --> 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.

18:20.360 --> 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.

18:28.620 --> 18:33.620
So those are some of the things that I think could be great to implement.

18:33.620 --> 18:38.000
With that, thank you for your attention and I hope you found this informative.

18:38.000 --> 18:38.360
Thank you.

