WEBVTT

00:00.000 --> 00:03.080
Welcome everybody to our talk, Malicious Fungible Tokens.

00:03.360 --> 00:06.260
My name is Mauro and my partner today is Ivel.

00:06.260 --> 00:07.260
We welcome you.

00:07.260 --> 00:08.800
Thank you for choosing our talk.

00:09.820 --> 00:11.880
Hey everyone, good evening.

00:11.880 --> 00:13.260
Hi, how are you doing?

00:13.260 --> 00:15.480
Thanks for being here to our talk.

00:15.620 --> 00:18.440
First, of course, English is not our first language.

00:18.440 --> 00:24.020
We have a little bit of accent, so if you don't understand any word, please raise your hand.

00:24.020 --> 00:26.820
You are saying so much bullshit in English.

00:26.820 --> 00:31.880
That's okay, because we can improve our English, okay?

00:31.880 --> 00:33.140
Thank you.

00:33.360 --> 00:34.840
So, let's start.

00:35.380 --> 00:37.220
As I said, my name is Ivel.

00:37.220 --> 00:39.220
I'm from Brazil, Sao Paulo, Brazil.

00:39.220 --> 00:44.080
I work at Cyber Threat Intelligence and, well, I like malware.

00:44.080 --> 00:48.480
I like to research about malwares, hands-on wares, and things like this.

00:48.480 --> 00:49.860
It's pretty cool, you know?

00:49.860 --> 00:52.020
I know how it works.

00:53.280 --> 00:54.740
Well, my name is Mauro.

00:54.740 --> 00:56.660
I'm a Uruguayan-Argentinian hacker.

00:56.660 --> 00:58.340
I'm here today to show this talk.

00:58.660 --> 01:07.400
I spoke at different events around the world, and I'm the leader of the Bitsock Quetzal team, which is the first Latin American Web3 threats research team.

01:09.700 --> 01:15.540
This talk, we are going to use NFTs as immortal command and control servers.

01:15.540 --> 01:17.480
We are not going to sell you any NFT.

01:17.480 --> 01:22.380
We are not going to try to put you into crypto, so we are not going to make you invest into anything.

01:22.380 --> 01:36.700
This talk is the continuation or the spiritual successor of Everything is a C2, If You're Brave Enough, which was a talk at the previous Adversary Village, where we used Spotify, World of Warcraft, Wikipedia, and whatever you can name, as a C2 server in the past.

01:37.760 --> 01:43.640
So, this talk is 30 minutes only, but it's divided in two parts, okay?

01:43.740 --> 01:48.400
First, I will give ingredients, and then, Mauro, you cook this, okay?

01:48.400 --> 01:56.200
First, let me introduce you, Podo, or Leopoldo, is his dog, amazing dog, a Golden Retriever, okay?

01:56.960 --> 02:07.080
So, let's talk, let's clarify what's NFT, C2 servers, and lovely Golden Retriever, the lovely dog.

02:07.080 --> 02:17.740
So, NFTs, basically, they are all information when you upload, you know, NFT in a blockchain.

02:17.740 --> 02:25.680
This is all information stored, and well, everything is there, data, metadata, and things like that.

02:25.680 --> 02:44.220
But, you can store this image as well, and off-chain, I mean, in a decentralized platform for this, and is immortal as well, you know, you can change like in blockchain, this is very important.

02:44.220 --> 02:53.920
So, we have two types, you know, how we can store our image, on-chain and off-chain, on blockchain and not in blockchain.

02:54.300 --> 02:58.100
Oops, sorry, okay, sorry.

02:58.100 --> 03:00.920
So, what is a C2 command and control server?

03:00.920 --> 03:09.660
It's a server that we can send and receive information of malware, so we can use this in everywhere, right?

03:09.660 --> 03:11.360
But not in this case.

03:11.360 --> 03:21.140
But the problem is, if I try to do something in NFT, if I use a regular server, you know, for C2, what can happen?

03:21.680 --> 03:36.160
This can be banned, or blacklisted, you know, and the list that denies a list, or everything can be messy and can be taken down, even if it's in Tor browser.

03:36.160 --> 03:40.620
So, yeah, it works, of course, but not in this case.

03:40.620 --> 03:45.280
In this particular case, we need something more resilient, right?

03:46.500 --> 03:56.600
So, as I said, blockchain, I don't know if everybody is familiar with blockchain, I guess, right?

03:56.600 --> 04:04.040
So, everything is there, backup assets there, it's permanent, you can change, it's there, and that's it.

04:04.040 --> 04:06.300
You just upload there, and you keep there.

04:06.300 --> 04:09.780
Can ban it, can flag anything.

04:09.940 --> 04:15.720
But, usually, NFTs can be stored there, or no.

04:15.720 --> 04:18.660
NFT is an image.

04:19.200 --> 04:27.400
In NFT image, you can put, like, name, description, trade, and everything, including metadata is there, right?

04:28.440 --> 04:44.820
So, instead, we do this with that ugly monkeys, we, everybody saw that ugly monkeys are rare, or weird image, because we see weird image from artists that say, oh, this is brand new thing, but it's not my thing, sorry.

04:44.820 --> 04:47.380
What about Golden Retriever?

04:47.380 --> 04:49.980
They are really, really cool, and it's a dog.

04:49.980 --> 04:54.240
Too bad it's not a cat, but let's start with a dog, maybe the next time, right?

04:54.340 --> 04:55.200
Maybe.

04:55.580 --> 04:58.400
Now, let's explain what is this.

04:59.220 --> 05:04.140
Mostly, NFTs, there's a platform, the most known one is OpenSea.

05:04.140 --> 05:11.560
That one, with the ugly monkey, that was hacked several times, but it's not about this talk.

05:11.560 --> 05:22.280
This is a very big market, probably is white list for almost all Web3, you know, companies, all traffic go through this API.

05:22.280 --> 05:26.060
Okay, but that is off-chain, too.

05:26.180 --> 05:39.140
It's partially stored in on-chain, I mean, in the blockchain, but the metadata is decentralized in other places, like this file systems in other place.

05:39.140 --> 05:41.140
Now, this is very important.

05:41.140 --> 05:44.760
When we use decentralized metadata, where?

05:44.760 --> 05:51.740
It can be in many, many places, but here, specifically, we talk about interplanetary file systems.

05:51.800 --> 05:55.820
I don't know if everybody is familiar with this.

05:55.820 --> 05:59.560
It's a cool place, you know, very decentralized platforms.

05:59.560 --> 06:07.280
It's like Torrent, you know, when you try to download or upload a file, a music there, you have seats.

06:07.280 --> 06:12.220
So, these seats, everything is shared among these seats.

06:12.220 --> 06:21.900
And when you have these, you hold these files, and you can share, you know, and hold these files, you receive coins.

06:21.900 --> 06:26.440
I mean, you are paid, you know, to have these files.

06:26.440 --> 06:30.000
This is really nice for those who have this.

06:30.000 --> 06:35.080
You have these files as Filecoin, I guess, the name, yes, right?

06:35.080 --> 06:43.680
And then, this image, when you upload there, is converted in another kind of file, this AVIF.

06:43.680 --> 06:49.640
I'm not so familiar with this kind of, you know, I'm not an artist to convert images.

06:49.640 --> 06:59.140
And then, the original file that's stored in this decentralized place is highly distributed among the seats.

06:59.140 --> 07:05.440
And this is the thing, you know, everything is in the seats, all these files.

07:05.700 --> 07:11.140
So , starting from here is the thing, you know, what we're talking about.

07:11.140 --> 07:15.340
Please, explain what we do with these files that are decentralized.

07:15.400 --> 07:24.320
Well, the point with Interplanetary File System is that it's used widely by Lockheed Martin, IBM, other high vendors.

07:24.320 --> 07:28.800
The point is that everything is distributed, anyone can run an APFS node.

07:28.800 --> 07:34.440
So, if you want to take something down, you have to ask every single node owner to take it down.

07:34.460 --> 07:42.620
But, as my partner here said, OpenSea and some other platforms reward you for holding the file or sharing the file with Filecoin.

07:42.620 --> 07:50.300
So, if you get a hold of a file, everybody deletes it, and you have it, there's a supply-demand problem here.

07:50.300 --> 07:55.080
You can make lots of money by being the last one, the last holder of that file.

07:55.080 --> 08:02.980
So, that opens the path to certain kind of abuses of people not actually honoring take-down requests.

08:08.380 --> 08:14.580
This sounds pretty good in theory, but we have to make it into code, especially into Ruby code.

08:14.580 --> 08:20.880
So, if anyone of you knows Ruby, know that it might be nice, but it's not as flexible as other languages.

08:20.880 --> 08:32.760
So, what we need right now, we need a malicious C2 server, a malware that can interpret and send commands from NFTs, and obviously, the malicious NFTs.

08:32.760 --> 08:34.140
I'm going to switch the mic.

08:35.180 --> 08:36.940
Okay, I'm back here.

08:37.740 --> 08:43.800
So, for this experiment, we have Leopoldo, we presented him in the previous slides.

08:43.800 --> 08:48.380
We have four NFTs, which every single one does anything different.

08:48.380 --> 08:54.160
And we're going to test different attack vectors encoded inside these NFTs.

08:54.280 --> 08:59.800
We have Initial Access Marker, Ramson Retriever, Treat Actor, and Golden Locker, my personal favorite.

09:00.040 --> 09:01.700
It's not for sale.

09:01.980 --> 09:07.500
Okay, on the left you can see the malware, coded in Ruby, called MFT, Malicious Fungible Tokens.

09:07.500 --> 09:12.860
And on the right side, you can see the C2 server, coded once again in Ruby and Sinatra.

09:13.880 --> 09:17.800
Let's start by exploring the most basic things in OpenSea.

09:17.800 --> 09:21.740
Let's start by exploiting the common fields, the low-hanging fruit.

09:22.000 --> 09:27.540
Treat Actor, what it actually does is has a description field, publicly viewable by anyone.

09:27.540 --> 09:32.040
It's visible to anyone, which is encoded in Base64 and Route13.

09:32.380 --> 09:41.240
When decoded, it says IP address, which is always hard-coded on all examples to localhost, so you cannot do any damage to anyone else.

09:41.240 --> 09:50.660
It has a code parameter that actually represents Unix commands and actions, which are actually proprietary modules of the malware.

09:50.940 --> 09:57.720
And this is not detected by CyberChef, even with Magic on Dev10, so that was pretty awesome for me.

09:58.140 --> 10:08.740
Then we have Golden Locker, which has a description just encoded in Base64, which is not also discovered by CyberChef, and has other actions.

10:08.740 --> 10:10.360
We will see them in detail now.

10:11.100 --> 10:14.880
Here's the malware, and we will have a demo at the end of this talk.

10:16.080 --> 10:32.000
When you search for an account, for an ENS domain name or an Ethereum account, it will list all NFTs, showing the newer ones first, because if you are pricing C2 servers, this one will have the latest information that you need, the most up-to-date information and commands.

10:32.380 --> 10:37.100
Then, if you can see the contract and the description, and the collection.

10:37.100 --> 10:39.400
And then, here's the thing.

10:39.420 --> 10:44.220
If you see the description, you will see the encoded payload.

10:44.260 --> 10:48.260
But if you see below, you will see the URL for the picture and the metadata.

10:48.440 --> 10:56.680
And then you will go to IPFS.io, and here you will say, Mauro, what happens if I send a takedown request to IPFS.io?

10:56.680 --> 11:01.360
Absolutely nothing, because IPFS.io is just an IPFS browser.

11:01.560 --> 11:06.780
All this information is stored on different IPFS nodes across the world.

11:06.780 --> 11:10.100
And you have to make a takedown request to every single one.

11:11.500 --> 11:22.360
Then, if anyone of you is familiar with Terraform, actually, Terraform has a Terraform plan, which will show you what changes will happen before you push the button.

11:22.360 --> 11:27.260
So you can avoid something like, you know, a CrowdStrike incident, and things like that.

11:27.380 --> 11:30.100
So, actually, I tried to implement that.

11:30.100 --> 11:33.300
It's a function I'm super in love with.

11:33.300 --> 11:37.260
So, the malware will tell you what's going to happen once you run that NFT.

11:37.260 --> 11:41.800
It will decode and tell you step-by-step what's going to happen before you push the button.

11:42.640 --> 11:45.800
And then, you will see it running in action, as you can see here.

11:45.860 --> 11:49.560
It will say, OK, I'm using this server as a relay.

11:49.660 --> 11:58.740
I will run this custom code, WhoAmI, which answers back with Mauro Eldritch's ID, which answers back with my ID, hostname, and so on.

11:58.740 --> 12:06.420
There are some fake functions that I have not coded in, obviously, for obvious reasons, that are wipe, encrypt, and open a reverse shell.

12:06.420 --> 12:07.920
That won't work at all.

12:08.800 --> 12:13.200
And this is what the attacker will see from the CTO server.

12:13.400 --> 12:18.800
We'll see all the answers, for example, new exfiltration from localhost, and everything that happens.

12:18.800 --> 12:21.660
But let's see how it works in the back.

12:21.740 --> 12:28.180
Before exploiting this, which is a super low-hanging fruit, we will try to do something more complex.

12:28.180 --> 12:36.040
Remember that my partner told that once you send a picture to an NFT, it will be stored in ABIF format and decentralized.

12:36.280 --> 12:42.180
Well, the original file, the raw file, will be decentralized as well, for no apparent reason.

12:42.500 --> 12:45.800
So, that's where we can inject more shenanigans.

12:46.240 --> 12:51.780
In this case, I just wanted to test that steganography will work, so I put Mauro Eldritch was here.

12:51.900 --> 12:56.480
The method is the most simple method on steganography, less single-bit or LSB.

12:56.480 --> 13:00.580
Which has a hard-coded location that everyone knows.

13:01.980 --> 13:07.000
And then, if you see here, you have, once again, the picture URL and the metadata URL.

13:07.000 --> 13:12.080
Let's try to download the picture and check if the message made it to production on OpenSea.

13:12.360 --> 13:21.520
And, for nobody's surprise, once downloaded and checked with setsteg, which is a third-party tool I do not own, you can see the message replicated.

13:21.520 --> 13:29.780
This means that we can decentralize messages, steganographic messages, across all the world using OpenSea.

13:29.780 --> 13:31.780
Why is this so important?

13:31.780 --> 13:38.580
Because the malware will only send traffic to OpenSea API.

13:38.640 --> 13:44.800
So, when doing forensics on an affected device, you will see that the traffic and the attack comes from OpenSea.

13:44.800 --> 13:45.960
From nowhere else.

13:45.960 --> 13:47.200
Just OpenSea.

13:47.200 --> 13:52.200
Wrong Wireshark, wrong TCPDAM, you will see only connections to OpenSea API.

13:53.160 --> 13:58.180
And then, I decided to create my, let's say, my master art craft.

13:58.180 --> 14:01.480
Initial Access Barrier, which has all the attack vectors.

14:01.580 --> 14:04.600
It has steganographic signet messages.

14:04.860 --> 14:09.800
It has a trait, which is a common field on all NFTs.

14:09.800 --> 14:15.080
But it also has something called EXIF field.

14:15.080 --> 14:23.660
EXIF metadata is data that is usually put by machines, by your processors, by your cameras, by your phones.

14:23.760 --> 14:30.340
The point is, the trick here is that EXIF metadata, it's hard to just put any arbitrary value in, you know?

14:30.340 --> 14:34.840
You can put numbers, you have certain fields that are more flexible than others.

14:34.840 --> 14:41.320
But there's a field, a specific field called Profile Copyright, that allows you to put basically anything you want without limit.

14:41.320 --> 14:43.600
And that's where it stores the payload as well.

14:44.000 --> 14:55.900
And once you check it, once you go to any IPFS browser, you will see that the trait is already distributed globally.

14:55.920 --> 15:02.660
So you can rely on the trait and not even start messing with metadata or messing with EXIF metadata as well.

15:02.660 --> 15:08.340
But then, I say, okay, let's try if we can check the other two vectors.

15:08.480 --> 15:19.860
Downloading the picture that you can see here, which is hosted on IPFS.io, you can see that by running EXIF tool on a specific field, you will see once again the payload.

15:20.140 --> 15:25.580
Running SetStag will render once again the payload.

15:25.660 --> 15:31.080
So this adds different layers of resilience to store the same or different payloads on a simple NFT.

15:31.080 --> 15:35.780
Remember that minting an NFT is something super, absolutely cheap.

15:35.980 --> 15:43.420
So you can basically write immortal C2 servers for five pounds, seven dollars, or whatever is in your currency.

15:43.620 --> 15:48.760
You can also check this with different third-party tools I do not own to see that the payload is reflected.

15:49.440 --> 15:50.920
And now it's time for the demos.

15:50.920 --> 15:52.660
We are very good in time.

15:52.660 --> 15:57.820
The demos don't have sound, but you will enjoy my angel voice narrating it.

16:01.390 --> 16:09.270
This, for example, is... sorry, let's try to improve the quality, because you deserve better.

16:11.190 --> 16:12.810
Give me a second.

16:12.810 --> 16:23.570
Basically what we are going to do here is run GoldenLocker, one of the low-hanging fruit exploitation.

16:23.590 --> 16:28.590
Above you can see the malware, and below you can see the C2 server.

16:28.590 --> 16:33.150
They are both running on the same machine in order to not damage anything.

16:33.150 --> 16:35.670
We will try to decode the instructions.

16:35.730 --> 16:43.010
The network is not cooperating, but we will try to decode the instructions that are hosted on the malware.

16:43.070 --> 16:44.290
Give me a second.

16:46.830 --> 16:49.310
Which belongs to GoldenLocker.

16:50.110 --> 16:52.970
It will then give us an action plan.

16:52.970 --> 16:54.610
Sorry about that.

16:54.610 --> 17:00.170
It will give us an action plan, then.

17:00.170 --> 17:01.510
And what will happen?

17:01.750 --> 17:08.350
It will try to run WhoAmI, id, hostname, and will try to uniquely identify the host and do some other shenanigans.

17:09.670 --> 17:11.610
Then we need to execute it.

17:11.810 --> 17:12.490
Sorry.

17:17.630 --> 17:19.510
Hackers with tech problems.

17:19.590 --> 17:20.370
Happens.

17:20.370 --> 17:22.370
This happens from time to time, you know.

17:27.520 --> 17:29.080
We will try to run it again.

17:34.740 --> 17:40.620
The idea is to then execute it and see how the commands are reflected on the other server.

17:40.620 --> 17:42.240
Here it is trying to work.

17:42.240 --> 17:43.780
Give it some seconds.

17:48.680 --> 17:52.940
The quality is not the best, but let's try to bear with it.

17:55.480 --> 17:59.500
And then it tries to find a viable payload.

17:59.500 --> 18:04.460
If you see here, you will see that it says, I have found a tainted exif registry.

18:04.460 --> 18:07.940
I have found a tainted steganographic message that I can use.

18:08.500 --> 18:14.680
And if it will try to find the description first, it will try to then jump into something more complex each time.

18:14.680 --> 18:18.760
In order to try to use the low-hanging fruit available first.

18:19.920 --> 18:20.580
Sorry, just...

18:27.180 --> 18:33.100
And then the idea, the final idea, is that, as I said before, you will see all the traffic being reflected to OpenSea.

18:33.100 --> 18:38.740
That makes it actually difficult for forensic teams to know where the tanks come from.

18:38.740 --> 18:41.360
But also, it will help them in another way.

18:41.720 --> 18:51.940
If any of you is a defender or forensic analyst or similar, you will really appreciate the value of having, basically, an immortal C2 server.

18:51.940 --> 18:58.960
Because you will have an artifact that you can dissect and check basically forever and use as an example forever.

18:58.960 --> 19:07.240
You won't have to rely on malware libraries and you won't have to rely on, you know, platforms that simulate attacks on malware.

19:08.360 --> 19:12.100
Well, since this is not cooperating, I will move on.

19:13.320 --> 19:14.600
I'm sorry about that.

19:14.600 --> 19:16.120
Sometimes that happens.

19:16.120 --> 19:18.080
Sometimes it's not easy.

19:18.700 --> 19:20.640
But we'll move on.

19:23.480 --> 19:30.100
And as in all crypto experiments, there's something that you cannot just be safe from, and that's scammers.

19:30.100 --> 19:36.720
As soon as we published it, the pictures of my golden retriever, I had people trying to buy it for 15th, 20th, and so on.

19:36.780 --> 19:39.460
And let me tell you, it's not worth it.

19:39.460 --> 19:42.720
He showers once a month, so he smells like a seal.

19:42.720 --> 19:43.900
It's not worth it.

19:44.720 --> 19:56.380
And then, going back to the serious track, as I was discovering this and reporting these issues with IPFS.IO, I started seeing some ads, promoted ads on Twitter.

19:56.560 --> 19:58.440
I refuse to call it X.

19:58.440 --> 20:06.280
If you look at the lower left corner of the post on the left, you will see that the source address is IPFS.IO.

20:06.280 --> 20:15.100
Somebody is hosting a drainer campaign, a phishing campaign, on IPFS.IO, rendering it basically immortal, unable to be taken down.

20:15.140 --> 20:20.820
So it has a rent-free web server to host the campaign forever.

20:21.260 --> 20:26.720
Those are the dangers of decentralization when it's weaponized.

20:29.000 --> 20:31.800
And then, I hope you enjoyed this talk.

20:31.800 --> 20:33.100
It's time to say goodbye.

20:33.260 --> 20:35.360
I know that you may have questions.

20:35.600 --> 20:39.860
This talk is not exactly about NFTs or blockchain in general, but rather how to abuse it.

20:39.860 --> 20:41.040
I hope you enjoyed it.

20:41.040 --> 20:42.500
Sorry for the demo not working.

20:42.500 --> 20:44.000
I apologize, heartfelt.

20:44.540 --> 20:47.060
And, well, thanks for coming, thanks for your time.

20:47.200 --> 20:48.620
I really enjoyed your company today.

20:48.620 --> 20:49.980
You can contact us here.

20:53.030 --> 20:54.230
Thank you, everyone.

20:54.230 --> 20:57.950
Any questions, comments, or something like this?

20:58.330 --> 20:59.750
The doll is not for sale.

20:59.750 --> 21:02.590
Did you release the tool?

21:02.590 --> 21:03.630
Yeah, the tool is released.

21:03.630 --> 21:09.890
You can actually create your own metamask address, jump to OpenSea, and start fiddling with it.

21:09.890 --> 21:11.750
Feel free to fork it, change it.

21:11.750 --> 21:12.750
Your call.

21:13.590 --> 21:14.910
Someone else?

21:14.910 --> 21:15.870
Questions?

21:16.190 --> 21:17.310
Comments?

21:17.830 --> 21:18.670
No?

21:18.670 --> 21:21.190
So, a quick advertisement.

21:21.250 --> 21:24.290
We are holding a new village here.

21:24.950 --> 21:29.270
It's more focused on people who speak Spanish and Portuguese.

21:29.270 --> 21:32.690
We have awesome talks, all in Spanish and Portuguese.

21:32.690 --> 21:35.150
If you want to visit us, it would be awesome.

21:35.150 --> 21:36.950
And thank you very much, guys.

21:37.090 --> 21:38.150
Thank you.

