Forensics in Web3: How and When
EthPrague 2024 · 2 Jun 2024 · 28:02
At EthPrague 2024, Luciano Ciattaglia covers forensics in web3 and when to apply it. The talk explains how to create a blockchain monitoring framework, how to perform post-mortem analysis of hacks, and how to fight a de-anonymization battle with the attackers behind them.
Speakers
Topics
From EthPrague 2024, hosted by ETHPrague.
Transcript
[Music] okay hey hello everyone my name is luciia please don't worry I am not going to steal a lot of time from you here it's only 20 minutes presentation today I am here to talk about forensic uh monitoring and Analysis in uh blockchains and when I am talking about blockchains here I am not trying to be generic I am actually talking about layer ones uh so to start first of all as I introduce myself I working in haken I am the director of services I am going to
skip the presentation of haken for you because you already saw my partner before that he already the presentations of the company to you so that's it I previously work at binance reio and Merc Li and yeah a couple of certifications and that's it uh I am going to skip the presentation of hen again it was already done before and this is the agenda for today and as you see it's pretty short actually uh the introduction to inent response this is pretty generic because it's the same in any organization regardless if it is Web Two web 3 or whatever it's almost pretty much the same everywhere detection analysis here I am going to talk about in protocols directly containment radication and recoveries they are the normal stage of
instant response in any organization and finally forens six in blockchain or at least what we can try to do regarding that first of all the introduction of inant response again this introduction is pretty much the S the same in any organization regardless if it is web two or web three it's always the same if we have a security Bridge it's to try to contain or to limit the damage that the security the incident is going to cause to our organization and to try to go back to normal as soon as possible again I can talk about any kind of organization that is not necessarily blockchain or web three and it's going to be exactly the same description so at least until here everything is the same in any organization nothing new for
anyone that has no le insecurity now detection and Analysis you're going to see a lot of text here and actually the most funny thing is that I try to highlight only some things not not everything is here so this is some of the highlights that we can have again not in a smart contract but in a protocol in a layer one layer two whenever something is going wrong or is going really wrong or it's already an attack happening or just a weird thing so first of all AB normal transactions count if you know the blocks I can talk about ethereum Bitcoin there are a lot of layer ones every day there are even
new new layer ones layer zeros and layer two all of them they have different block size So within a block size let's say 1 me for example in Bitcoin we can fit a lot of transactions there but not all of them are transactions or the same amount of transactions in every block so whenever we have actually a lot of transactions within a single block that can be something weird because it's like it's still tied it's still limit to one megabyte the block or whatever the consensus or the block the protocol is defining but if something is not normal actually the amount of transactions that there are in a single block actually that block can has something to do with something not well ethical let's call or actually an attack so that's one of the things blockchain uh the block
metadata block metadata someone knows what a block metadata is like the headers one header yeah one example Bitcoin is necessary for the mer to be able yeah exactly the The Merc root actually is one of the things that we have in the metadata specifically in the block header but if we change the mer route actually we are going to have consequences because the block probably is going not to be included in the in the protocol but there are other things that we can play around for example the the knowns and the time stamp we can play with all things and no one is going to penalize us as nodes so actually if we see a block that H contains something weird actually in the nons or in the time stamp that it shouldn't actually be
included in the in the blockchain itself that can be actually an indicator that something is going very wrong actually with that protocol again I am focusing here about protocols because we can check all the smart contracts but if the protocol itself get hacked all the smart contracts in there are going to have the same fate so here actually is why I'm trying to focus principally on what's be be below actually the smart contracts and what what can go really wrong there uh High transaction fees well this is pretty normal of course if I am stoling money I am I am going to want my money to be uh removed from where I am stoling it as fast as possible and in order to do that I am going I am willing to pay a lot of fees High fees so my transaction
to stall the phones are getting processed faster or first so trans High transactions fees can be that I am talking about again an attack because for example in Bitcoin in Bitcoin Hing a lot of people actually pay a lot of fees actually to include in the block of the Hing but again I am talking about something that is not normal in these cases decreasing meaning power and this is pretty funny actually because it it's implies to if you want to do a 51% attack in most of the protocols what you think is that you need to gain more mining power and always like buy more resources and gain more resources in order to take the entire protocol but another strategy there it can be to take down the competency uh if you find a
vulnerability in a protocol that actually can crush a node you can start uh crashing different nodes and gaining power meaning power uh but actually taking down other nodes until only few noes remains your yours is one of those and you can take up the entire protocol without even spending a money uh for for that so if we have a really decreased meaning power in a short period of time that's probably like almost 100% an indicator that of an attack in that protocol is happening strain transaction structure I am going to brief here uh I mentioned that in the block heers we can modify a lot of things and we're going to be
penalized well in the transaction actually we are not going to be penalized so we can play with the transactions the size of the transaction the there are a lot of things that we can manipulate in transactions the addresses uh the signatures uh the time stamp as well and even the same size if we have a transaction with a size bigger than the block itself that's probably going to create uh a crash unless the protocol is uh security secure and they validate actually these kind of things but if not it's going to create a crash so any transactions that are we and they are including in the protocol that can to be an indicator High transaction volume really uh similar actually to our normal transaction count when we have a lot of
transactions of course this can be because of the market thing or a lot of things but it can also be an indicator of an attack repeater uh post validator this actually affects ethereum well this is pretty of course if the same valid validator is selected in a row like two three four times in a row that's pretty not common right because it should be random the validator that is selected to mine the next block so if we have the same validator in a row that's probably something is going really wrong and the exchange and the defi activity again this can be a market thing but it can be also an indicator of an attack if there are a lot of movement it can be that someone is stealing money and try to take it from there and the components to take a look at noes CBM chain
transaction mle mining uh the mining power itself all of these components are part of the any lier one well the May am not actually but most of them are part of any layer one and anything that is wrong with these components it can be an indicator that something of these things are going are happening so again if we detect something irregular here without being paranoic probably that's something that is going really wrong with the layer one itself where we are operating or Layer Two or layer zero itself some tools that we can use actually to monitor this activity that I mentioned there are the anti Landing the AML tools they are pretty normal chain analysis probably some of you already
used it elliptic and there are some tun in haken that it's a pattern recognition engine uh we already mentioned this before uh this is focused more in smart Contra actually more than layer one but that's actually one of the tools and what it has extractor here it's like they include actually the for the for attack detector they have the different monitoring triggers that one can C customize depending on the the need and you can also do a lot of things depending on what's going on with your again smart contracts not layer one in here containment eradication and Recovery okay first of all once the money is stolen that that's it I mean yeah if we have a transaction the
Integrity of the blockchain if someone take the money from my wallet for example and I want to take it back I cannot contact bigcoin and tell them ah yeah I got a haug please take my money back they are not going to do that so of course that uh once the the the attack itself has been performed and the phones were sto most of the things that we can do here is try to recover as much as we can actually I had this experience in binance in binance we lost $600 million and it was on a weekend of course because attackers are going to make the entire security team wake up early on a weekend to work the entire weekend to try to recover the money we lost $600 million over in 2 hours more
or less and what we could do there uh the coins that they stole they weren't actually coins from binance itself they mined these b&bs coins they take them outside the B&B chain and it the total amount of money there was huge what we did and probably if you read the media at that time we hold the entire blockchain the B&B chain we hold it entirely we had like 50 notes and we hold all of them to try to recover the money we call recover 500 Millions actually at that time it was a lot of money but we still lost 100 million so most of the things that we can do here is not to try to recover all the money but actually to try to recover some of
it in our case actually we could recover a lot of money what we we still lost $100 million that is well it's not a it's it's a big amount when you think about it like separated for the total amount the things that we can do this is for smart contracts actually posable transactions this is again a functionality in smart contract we can have the stable coins like usdt usdc they have bonds or a blacklist of wallets so if if we know the the addresses already the wallets that are that contains the stolen FS we can try to freeze them uh if they are stealing in in stable coins uh Warr exchanges of course they they can pay attention to us or not but we can tell an exchange binance for
example that there was a hack here and if the attackers are trying to to take out the money from the blockchain through binance or through a centralized exchange uh we can actually they can actually help us to try to recover the money before they take it down they take it out uh stop validators in pu blockchains okay this is this should be mostly from Prof Authority but we also did it in B&B chain but that's of course if it is a possibility something that is going to to help stop the entire blockchain and the attackers cannot move the money any any further so try to record the the money from there uh network segmentations is actually if we detect that we have malicious nodes that they are taking down other notes we can
try to segregate them uh and exclude them from the blockchain and that's going to help actually if the noes are behaving uh weirdly actually and the nodes are the responses of the attacks the smart contract freezing pretty similar to the pable transactions again is to freeze the entire smart contract to process further transactions real time alerts well the alerts I mean it's like an alarm in your house it's like the best that an alert is going to tell you it's like hey you getting you are getting hacked and that you need to to react and do all the work yourself of course but at least it's something uh finally the forks and change your reorganizations this can be also a a signature of an attack but we can use it
on our advantage and if we see that an attack happen we're going to try to take it back by by making a fork of course that this attempts to the Integrity of the blockchain right and the decentralization but whenever it's possible it's possible I think in ethereum actually this happened once uh for the attack so uh it's something that it can be possible but it shouldn't be normal finally blockchain forensics the anonymity right now in protocols I am talking here about ethereum remains in three main uh assumptions that we do the first assumption that we have when we are using blockchain chain is that the addresses our addresses of our wallet
cannot be mapped directly to an identity to a person I mean so if I show you a random wallet address you don't know if that address is mine or who whoever that address is so that's the first assumption the SE the second assumption is that the transactions do not contain any personal information of course they can but usually they don't contain any personal information and finally that then um the blockchain itself doesn't know our IP that it can be hidden our IP as well uh through vpns or different things but actually no one knows our IP so no one can relate our IP to us or track us down again every time that we do a transaction so those are the assumptions
and here are the real things that actually we can do to try to anonymize a person uh in the protocol there are a lot of pain points that I am going to talk about but actually these are some things that we can try real name authentic ation this is a pretty silly mistake if you are attacking a huge blockchain and stealing $100 million or more I hope that the person at least knows that centralized exchange they use qyc and of course as they use qyc they know who who you are and you are not going to try to steal the money through a central X exchange because they know who you are so they can track you down actually and well you are going to end up pretty much in jail uh so real name authentication if if I am stalling the
phones for a for a native coin a native uh any native coin or any ler one and I am going to move that money to a centralized exchange The Exchange is going to know who I am because I had to do qic in a central X exchange public Expos exposure again this is really silly but imagine that in Twitter you publish that you receive donations with your Twitter user uh to certain address uh it's there in Twitter and you use uh later on you do a hack and you use this address to take the money out well of course that you are going to have if anyone actually find this tweet is going to relate your Twitter username with you so again this is all all the sil mistakes it can it can seem that they
don't really happen but actually they happen more than I will wish so actually all these silly mistakes they are pretty normal when an attacker is not very careful on what they are doing transpar and transability uh through the Explorers actually everything is transparent so we can track down actually an address and where they are moving the money so that's not going to tell us exactly what the person who the person is but it's going to help us to relate addresses and different things from the attackers and finally a transaction clustering again it it's regarding gathering information about the oh it's raining a lot outside I arrived to pra here it's my first time here and at the morning actually it was sunny now it's raining
afterward I am sure that it's going to be sunny the word here is crazy so the transaction clustering actually again it's like trying to gather information from different addresses for example if I have two addresses a code wallet and an exchange and I move my phones from there go and fourth uh a person actually can relate that this address from The Exchange and this code wallet is the same person it's me so that's actually a relation that you we can do and there are some attacks that we can also do that for example D attacks probably most of us here receive D attacks and never notice it is when you receive randomly a really tiny amount of a coin like I don't know cents of a coin it can be USD or any coin
actually this tiny amount of coins they a person is sending them to you to try to track your money so whenever you are moving your entire money in the wallet your entire assets uh this uh dust these scents are going to be moved as well and they can track down actually your all your movements because of this so that's a that's attack civil attacks timing analysis insertion attacks and uis Analysis all of these are attacks that an attacker can do for something illegal or actually it can be an attack to try to anonymize a user because they are actually behaving maliciously uh and these are the pain points what why it's not easy actually to the anonymize a user in right now in protocols first of all the central the
defies well of course the defies there is no qyc there so if some someone is removing money from there we are not going to track it down easily at least peel chain this is if so I told you that in binance they stole $600 million you you may think that they move all those bmbs together well they of course they didn't so they actually split these bmbs in uh 0.5 BMB each and they started moving it through hundred of addresses so it was a really pain actually to track down all these uh addresses and the moment of all these addresses to try to recover the money without involving actually innocence people that they actually receive BMB and actually they
weren't part of the attack so that's actually another thing that can help CH hoping well I mean if we are in B&B and we move the assets to etherum or any other blockchain that's going to create a paino through Bridges or through anything else is going to be really hard actually to continue tracking down the money more actually if they are moving it a CK protocol or Monero ckash for example there they have a lot of anonymity so it's not easy to identify the user further once they move the PHS there uh mixing Services I suppose that most of us here know what the mixing Services is a lot of people end end of jail actually because of creating them privacy coins again as I mentioned mon on SEC is really hard actually to track down this and try to know who is behind
the addresses in these Protocols of CAS smart contracts of chain transactions offchain transactions pretty obvious I mean if I go and do something off chains with without moving the money uh but they receive money like Fiat money from someone else actually and then I move I do the movements everything that happens off chain we going to know what's going on there so anything that happens off chain we we don't have any visual when we're trying to track down the attackers multiply multiple wallets uh Again part of the p uh chain and crossborder transactions all those are pain points so actually that helps a lot if an attacker know what's they are doing to try to hide their real identity I mentioned to you 600 million and we
lost actually we recover $500 million uh in binance we offer to anyone that could identify the hacker 10% uh of the of the total money of the hack it was more than $50 million so we offer that to everyone anyone that could give us any information regarding who the attacker were uh we will we will give him to pay them $50 million and no one give any information and we announc it like several times so I imagine actually that not even the money is an easy motivator to try to track down a person if the attacker not knows what they are doing actually uh so that's it I am luciia thank
you any questions there okay when wait a sec hi uh I wanted to ask you how do we fret the needle when it comes to the Bad actors in the space and uh the ability to for us as a crypto users to remain anonymous to some point because the anonymity is one of the things I like and I like to buy my crypto do whatever I want with it without doing anything like elicit but I want to still remain anonymous and I know they are the better actors so how do we do it in the space so we can still remain anonimous and get
rid of as much as possible of the better actors of course first of all actually try to use a protocol that the anonymity is a Focus key of the protocol I am talking about Monero cach Bitcoin is s Anonymous let's say it's not fully Anonymous so whenever you are using Bitcoin or actually ethereum you need to know that it's sell anonymity what you have but actually a node whenever you are trying to include a transaction they they know your IP address and I am not going to suggest it to be fully paranoic and use a VPN or something actually every time that you are going to connect the no so then not can you track because it's like the paranoia could go Sky High if you want actually to remain anonymous but uh what I recommend to it's to Simply actually use a protocol that
anonymity is Focus key of the protocol itself again mono ckash there are even more the C the ones that are using CK of course all of them uh so that's the easier thing and it's important that that's remains in time because if you're anonymous here now right now no one knows that this address is yours but from now in five years you are going to publish that address somewhere well actually you are broken your own an anonymity yourself remember that anything that you put in the blockchain is going to remain there forever and this is something scary sometimes because you can create a transaction put a text there or something that for example now 2024 is totally legal but in 20 years probably it's not
because well the legal things are changing all the time and it's going to remain there for 20 years or so on so you never know actually what's going to happen so my recommendation is yeah that use uh protocols that they care about the anonymity and remember that anything that you do in the blockchain is going to remain there forever so if you are going to be anonymous we an forever then never lose it so that's it any other question as for blacklisted wallets yes um what's the difficulty to just create a new wallet and suddenly you like quite listed ah no I mean uh when they have a blacklist wallet actually the idea is
like you have you stole 1 million usdt and you move them to a certain wallet while they are doing in they are in that wallet then they freeze the money they are in that wallet so whenever you create another wallet you cannot move it down because it's already on The Blacklist so you cannot move the money there the idea the idea there is to try to freeze the assets within one wallet so yeah you can create other wallets but once you are what white blacklisted the wallet that is going to be blacklisted is the one that has the asset at that exact moment so you cannot move the asset further so that's it you lost it once you are blacklisted who controls this list or database uh usdt the organization behind usdt usdc the
organization I think is uh the organization because yeah Circle uh different depending on the asset that you are using the coin that you are using so it's kind of voluntarily there is no uh Cross organization uh cross industry depending again on the coin that you are using usct and usdc yeah they are kind of centralized but there are others that are more decentralized and you need to reach a consensus to make a black list but whenever that consensus reaches uh you lose so much time that the money was already moved so it's totally inefficient sometimes whenever you need to do do a blacklist it should be I mean you need to do it instantly Pro possible because you need to FAS the assets there so yeah it's uh the
blockchain tra you know security the cability and scalability you are putting too much in security by losing the too yes thank you um for the dust attack to work why do I need to send like small funds can I try can I can't I track the funds in your wallet like already yeah the does attack you mean yeah yeah actually I thought the same the first time that I see attack why why I need to send money if actually I can TR just track the money well that's uh you see that when you are actually doing the real forensic job because it's like as I mentioned uh imagine that the phones you you you
found you move them to one wallet to the other to the other and you need to start doing a graph across the all the wallets in included in that attack when they start uh slipping the amounts of money or they start moving the the amounts of money differently not the entire amount of money but differently and you try to still track down the transaction over time it's become blurry I mean you have a lot of addresses and you know you are not sure whenever the real stolen assets are there or there are legit assets mix it together to the stolen assets so it's everything goes blurry after like three or four transactions uh when you are trying to track the the data by doing a d attack you are sure that the money
that you sent to the stolen address was move and where was move and you know certainly that all those addresses that your dust was move was part of the attacker so that's actually it's to simplify the work of for and six you can still do it actually without the D attack it's just to simplify it so that's it okay but for ethereum like the dust is not I cannot see like V you're going to split it yeah there are mechanisms actually for the dust uh when you are moving your phones you can see the dust it's like the sense that you move whenever you move a transaction but you see those sents when you're moving the entire amount of money that you have there it just you just move like to
ethereum yeah you're going to lose track as well of the Dust over time so it's the same there are also some while is they have mechanisms actually until do attack that when you are moving even your entire assets uh they are not going to move the sense so yeah it's a it can help depending on the attacker if they are careful or not actually but if they are not careful it it helps a lot to you to track down the real money and the real move of money across the different addresses again is to simplify that the job thank you that's it okay again thank you [Applause] [Music]