start	end	text
0	3080	Welcome everybody to our talk, Malicious Fungible Tokens.
3360	6260	My name is Mauro and my partner today is Ivel.
6260	8800	We welcome you. Thank you for choosing our talk.
9820	13260	Hey everyone, good evening. Hi, how are you doing?
13260	15480	Thanks for being here to our talk.
15620	18440	First, of course, English is not our first language.
18440	24020	We have a little bit of accent, so if you don't understand any word, please raise your hand.
24020	26820	You are saying so much bullshit in English.
26820	33140	That's okay, because we can improve our English, okay? Thank you.
33360	34840	So, let's start.
35380	39220	As I said, my name is Ivel. I'm from Brazil, Sao Paulo, Brazil.
39220	44080	I work at Cyber Threat Intelligence and, well, I like malware.
44080	48480	I like to research about malwares, hands-on wares, and things like this.
48480	52020	It's pretty cool, you know? I know how it works.
53280	56660	Well, my name is Mauro. I'm a Uruguayan-Argentinian hacker.
56660	58340	I'm here today to show this talk.
58660	62820	I spoke at different events around the world, and I'm the leader of the Bitsock Quetzal team,
62820	67400	which is the first Latin American Web3 threats research team.
69700	75540	This talk, we are going to use NFTs as immortal command and control servers.
75540	77480	We are not going to sell you any NFT.
77480	82380	We are not going to try to put you into crypto, so we are not going to make you invest into anything.
82380	87760	This talk is the continuation or the spiritual successor of Everything is a C2, If You're Brave Enough,
87760	93340	which was a talk at the previous Adversary Village, where we used Spotify, World of Warcraft, Wikipedia,
93340	96700	and whatever you can name, as a C2 server in the past.
97760	103640	So, this talk is 30 minutes only, but it's divided in two parts, okay?
103740	108400	First, I will give ingredients, and then, Mauro, you cook this, okay?
108400	116200	First, let me introduce you, Podo, or Leopoldo, is his dog, amazing dog, a Golden Retriever, okay?
116960	127080	So, let's talk, let's clarify what's NFT, C2 servers, and lovely Golden Retriever, the lovely dog.
127080	137740	So, NFTs, basically, they are all information when you upload, you know, NFT in a blockchain.
137740	145680	This is all information stored, and well, everything is there, data, metadata, and things like that.
145680	155600	But, you can store this image as well, and off-chain, I mean, in a decentralized platform for this,
155600	164220	and is immortal as well, you know, you can change like in blockchain, this is very important.
164220	173920	So, we have two types, you know, how we can store our image, on-chain and off-chain, on blockchain and not in blockchain.
174300	178100	Oops, sorry, okay, sorry.
178100	180920	So, what is a C2 command and control server?
180920	189660	It's a server that we can send and receive information of malware, so we can use this in everywhere, right?
189660	191360	But not in this case.
191360	201140	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?
201680	216160	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.
216160	225280	So, yeah, it works, of course, but not in this case. In this particular case, we need something more resilient, right?
226500	236600	So, as I said, blockchain, I don't know if everybody is familiar with blockchain, I guess, right?
236600	244040	So, everything is there, backup assets there, it's permanent, you can change, it's there, and that's it.
244040	249780	You just upload there, and you keep there. Can ban it, can flag anything.
249940	255720	But, usually, NFTs can be stored there, or no.
255720	267400	NFT is an image. In NFT image, you can put, like, name, description, trade, and everything, including metadata is there, right?
268440	284820	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.
284820	294240	What about Golden Retriever? They are really, really cool, and it's a dog. Too bad it's not a cat, but let's start with a dog, maybe the next time, right?
294340	298400	Maybe. Now, let's explain what is this.
299220	304140	Mostly, NFTs, there's a platform, the most known one is OpenSea.
304140	311560	That one, with the ugly monkey, that was hacked several times, but it's not about this talk.
311560	322280	This is a very big market, probably is white list for almost all Web3, you know, companies, all traffic go through this API.
322280	326060	Okay, but that is off-chain, too.
326180	339140	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.
339140	344760	Now, this is very important. When we use decentralized metadata, where?
344760	351740	It can be in many, many places, but here, specifically, we talk about interplanetary file systems.
351800	355820	I don't know if everybody is familiar with this.
355820	359560	It's a cool place, you know, very decentralized platforms.
359560	367280	It's like Torrent, you know, when you try to download or upload a file, a music there, you have seats.
367280	372220	So, these seats, everything is shared among these seats.
372220	381900	And when you have these, you hold these files, and you can share, you know, and hold these files, you receive coins.
381900	386440	I mean, you are paid, you know, to have these files.
386440	390000	This is really nice for those who have this.
390000	395080	You have these files as Filecoin, I guess, the name, yes, right?
395080	403680	And then, this image, when you upload there, is converted in another kind of file, this AVIF.
403680	409640	I'm not so familiar with this kind of, you know, I'm not an artist to convert images.
409640	419140	And then, the original file that's stored in this decentralized place is highly distributed among the seats.
419140	425440	And this is the thing, you know, everything is in the seats, all these files.
425700	431140	So, starting from here is the thing, you know, what we're talking about.
431140	435340	Please, explain what we do with these files that are decentralized.
435400	444320	Well, the point with Interplanetary File System is that it's used widely by Lockheed Martin, IBM, other high vendors.
444320	448800	The point is that everything is distributed, anyone can run an APFS node.
448800	454440	So, if you want to take something down, you have to ask every single node owner to take it down.
454460	462620	But, as my partner here said, OpenSea and some other platforms reward you for holding the file or sharing the file with Filecoin.
462620	470300	So, if you get a hold of a file, everybody deletes it, and you have it, there's a supply-demand problem here.
470300	475080	You can make lots of money by being the last one, the last holder of that file.
475080	482980	So, that opens the path to certain kind of abuses of people not actually honoring take-down requests.
488380	494580	This sounds pretty good in theory, but we have to make it into code, especially into Ruby code.
494580	500880	So, if anyone of you knows Ruby, know that it might be nice, but it's not as flexible as other languages.
500880	511120	So, what we need right now, we need a malicious C2 server, a malware that can interpret and send commands from NFTs,
511120	512760	and obviously, the malicious NFTs.
512760	514140	I'm going to switch the mic.
515180	516940	Okay, I'm back here.
517740	523800	So, for this experiment, we have Leopoldo, we presented him in the previous slides.
523800	528380	We have four NFTs, which every single one does anything different.
528380	534160	And we're going to test different attack vectors encoded inside these NFTs.
534280	539800	We have Initial Access Marker, Ramson Retriever, Treat Actor, and Golden Locker, my personal favorite.
540040	541700	It's not for sale.
541980	547500	Okay, on the left you can see the malware, coded in Ruby, called MFT, Malicious Fungible Tokens.
547500	552860	And on the right side, you can see the C2 server, coded once again in Ruby and Sinatra.
553880	557800	Let's start by exploring the most basic things in OpenSea.
557800	561740	Let's start by exploiting the common fields, the low-hanging fruit.
562000	567540	Treat Actor, what it actually does is has a description field, publicly viewable by anyone.
567540	572040	It's visible to anyone, which is encoded in Base64 and Route13.
572380	578100	When decoded, it says IP address, which is always hard-coded on all examples to localhost,
578100	581240	so you cannot do any damage to anyone else.
581240	588040	It has a code parameter that actually represents Unix commands and actions,
588040	590660	which are actually proprietary modules of the malware.
590940	597720	And this is not detected by CyberChef, even with Magic on Dev10, so that was pretty awesome for me.
598140	603480	Then we have Golden Locker, which has a description just encoded in Base64,
603480	608740	which is not also discovered by CyberChef, and has other actions.
608740	610360	We will see them in detail now.
611100	614880	Here's the malware, and we will have a demo at the end of this talk.
616080	621040	When you search for an account, for an ENS domain name or an Ethereum account,
621040	627020	it will list all NFTs, showing the newer ones first, because if you are pricing C2 servers,
627020	632000	this one will have the latest information that you need, the most up-to-date information and commands.
632380	637100	Then, if you can see the contract and the description, and the collection.
637100	644220	And then, here's the thing. If you see the description, you will see the encoded payload.
644260	648260	But if you see below, you will see the URL for the picture and the metadata.
648440	651220	And then you will go to IPFS.io, and here you will say,
651220	656680	Mauro, what happens if I send a takedown request to IPFS.io?
656680	661360	Absolutely nothing, because IPFS.io is just an IPFS browser.
661560	666780	All this information is stored on different IPFS nodes across the world.
666780	670100	And you have to make a takedown request to every single one.
671500	675720	Then, if anyone of you is familiar with Terraform,
675720	682360	actually, Terraform has a Terraform plan, which will show you what changes will happen before you push the button.
682360	687260	So you can avoid something like, you know, a CrowdStrike incident, and things like that.
687380	693300	So, actually, I tried to implement that. It's a function I'm super in love with.
693300	697260	So, the malware will tell you what's going to happen once you run that NFT.
697260	701800	It will decode and tell you step-by-step what's going to happen before you push the button.
702640	705800	And then, you will see it running in action, as you can see here.
705860	709560	It will say, OK, I'm using this server as a relay.
709660	714340	I will run this custom code, WhoAmI, which answers back with Mauro Eldritch's ID,
714340	718740	which answers back with my ID, hostname, and so on.
718740	723480	There are some fake functions that I have not coded in, obviously, for obvious reasons,
723480	727920	that are wipe, encrypt, and open a reverse shell. That won't work at all.
728800	733200	And this is what the attacker will see from the CTO server.
733400	738800	We'll see all the answers, for example, new exfiltration from localhost, and everything that happens.
738800	741660	But let's see how it works in the back.
741740	748180	Before exploiting this, which is a super low-hanging fruit, we will try to do something more complex.
748180	756040	Remember that my partner told that once you send a picture to an NFT, it will be stored in ABIF format and decentralized.
756280	762180	Well, the original file, the raw file, will be decentralized as well, for no apparent reason.
762500	765800	So, that's where we can inject more shenanigans.
766240	771780	In this case, I just wanted to test that steganography will work, so I put Mauro Eldritch was here.
771900	776480	The method is the most simple method on steganography, less single-bit or LSB.
776480	780580	Which has a hard-coded location that everyone knows.
781980	787000	And then, if you see here, you have, once again, the picture URL and the metadata URL.
787000	792080	Let's try to download the picture and check if the message made it to production on OpenSea.
792360	801520	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.
801520	809780	This means that we can decentralize messages, steganographic messages, across all the world using OpenSea.
809780	818580	Why is this so important? Because the malware will only send traffic to OpenSea API.
818640	824800	So, when doing forensics on an affected device, you will see that the traffic and the attack comes from OpenSea.
824800	827200	From nowhere else. Just OpenSea.
827200	832200	Wrong Wireshark, wrong TCPDAM, you will see only connections to OpenSea API.
833160	838180	And then, I decided to create my, let's say, my master art craft.
838180	841480	Initial Access Barrier, which has all the attack vectors.
841580	844600	It has steganographic signet messages.
844860	849800	It has a trait, which is a common field on all NFTs.
849800	855080	But it also has something called EXIF field.
855080	863660	EXIF metadata is data that is usually put by machines, by your processors, by your cameras, by your phones.
863760	870340	The point is, the trick here is that EXIF metadata, it's hard to just put any arbitrary value in, you know?
870340	874840	You can put numbers, you have certain fields that are more flexible than others.
874840	881320	But there's a field, a specific field called Profile Copyright, that allows you to put basically anything you want without limit.
881320	883600	And that's where it stores the payload as well.
884000	895900	And once you check it, once you go to any IPFS browser, you will see that the trait is already distributed globally.
895920	902660	So you can rely on the trait and not even start messing with metadata or messing with EXIF metadata as well.
902660	908340	But then, I say, okay, let's try if we can check the other two vectors.
908480	919860	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.
920140	925580	Running SetStag will render once again the payload.
925660	931080	So this adds different layers of resilience to store the same or different payloads on a simple NFT.
931080	935780	Remember that minting an NFT is something super, absolutely cheap.
935980	943420	So you can basically write immortal C2 servers for five pounds, seven dollars, or whatever is in your currency.
943620	948760	You can also check this with different third-party tools I do not own to see that the payload is reflected.
949440	952660	And now it's time for the demos. We are very good in time.
952660	957820	The demos don't have sound, but you will enjoy my angel voice narrating it.
961390	969270	This, for example, is... sorry, let's try to improve the quality, because you deserve better.
971190	972810	Give me a second.
972810	983570	Basically what we are going to do here is run GoldenLocker, one of the low-hanging fruit exploitation.
983590	988590	Above you can see the malware, and below you can see the C2 server.
988590	993150	They are both running on the same machine in order to not damage anything.
993150	1003010	We will try to decode the instructions. The network is not cooperating, but we will try to decode the instructions that are hosted on the malware.
1003070	1004290	Give me a second.
1006830	1009310	Which belongs to GoldenLocker.
1010110	1014610	It will then give us an action plan. Sorry about that.
1014610	1021510	It will give us an action plan, then. And what will happen?
1021750	1028350	It will try to run WhoAmI, id, hostname, and will try to uniquely identify the host and do some other shenanigans.
1029670	1032490	Then we need to execute it. Sorry.
1037630	1040370	Hackers with tech problems. Happens.
1040370	1042370	This happens from time to time, you know.
1047520	1049080	We will try to run it again.
1054740	1060620	The idea is to then execute it and see how the commands are reflected on the other server.
1060620	1063780	Here it is trying to work. Give it some seconds.
1068680	1072940	The quality is not the best, but let's try to bear with it.
1075480	1079500	And then it tries to find a viable payload.
1079500	1084460	If you see here, you will see that it says, I have found a tainted exif registry.
1084460	1087940	I have found a tainted steganographic message that I can use.
1088500	1094680	And if it will try to find the description first, it will try to then jump into something more complex each time.
1094680	1098760	In order to try to use the low-hanging fruit available first.
1099920	1100580	Sorry, just...
1107180	1113100	And then the idea, the final idea, is that, as I said before, you will see all the traffic being reflected to OpenSea.
1113100	1118740	That makes it actually difficult for forensic teams to know where the tanks come from.
1118740	1121360	But also, it will help them in another way.
1121720	1131940	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.
1131940	1138960	Because you will have an artifact that you can dissect and check basically forever and use as an example forever.
1138960	1147240	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.
1148360	1152100	Well, since this is not cooperating, I will move on.
1153320	1158080	I'm sorry about that. Sometimes that happens. Sometimes it's not easy.
1158700	1160640	But we'll move on.
1163480	1170100	And as in all crypto experiments, there's something that you cannot just be safe from, and that's scammers.
1170100	1176720	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.
1176780	1183900	And let me tell you, it's not worth it. He showers once a month, so he smells like a seal. It's not worth it.
1184720	1196380	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.
1196560	1198440	I refuse to call it X.
1198440	1206280	If you look at the lower left corner of the post on the left, you will see that the source address is IPFS.IO.
1206280	1215100	Somebody is hosting a drainer campaign, a phishing campaign, on IPFS.IO, rendering it basically immortal, unable to be taken down.
1215140	1220820	So it has a rent-free web server to host the campaign forever.
1221260	1226720	Those are the dangers of decentralization when it's weaponized.
1229000	1235360	And then, I hope you enjoyed this talk. It's time to say goodbye. I know that you may have questions.
1235600	1239860	This talk is not exactly about NFTs or blockchain in general, but rather how to abuse it.
1239860	1244000	I hope you enjoyed it. Sorry for the demo not working. I apologize, heartfelt.
1244540	1249980	And, well, thanks for coming, thanks for your time. I really enjoyed your company today. You can contact us here.
1253030	1257950	Thank you, everyone. Any questions, comments, or something like this?
1258330	1259750	The doll is not for sale.
1259750	1262590	Did you release the tool?
1262590	1269890	Yeah, the tool is released. You can actually create your own metamask address, jump to OpenSea, and start fiddling with it.
1269890	1272750	Feel free to fork it, change it. Your call.
1273590	1278670	Someone else? Questions? Comments? No?
1278670	1284290	So, a quick advertisement. We are holding a new village here.
1284950	1292690	It's more focused on people who speak Spanish and Portuguese. We have awesome talks, all in Spanish and Portuguese.
1292690	1296950	If you want to visit us, it would be awesome. And thank you very much, guys.
1297090	1298150	Thank you.
