[BUIDL Asia 2023] The Art of Rapid Response - Investigating DeFi Hacks in the First 24 Hours

BUIDL Asia 2023 · 2 Jul 2023 · 24:01

Margaux Eckle, a crimes investigator at Chainalysis, explains how teams investigate DeFi hacks in the first 24 hours. The talk shows why DeFi has become a prime target, with cases such as the Euler exploit, and why early action matters before stolen funds reach mixers and exchanges. It walks through damage control, structuring an investigation with communication channels and legal support, tracing funds and freezing them with exchanges and token issuers, and closes with case studies and a call for collaboration on prevention.

Speakers

Topics

From BUIDL Asia 2023, hosted by Kryptoplanet.

Transcript

hey guys thanks for having me here I'm really excited to be speaking in front of all of you this is my um first time at Biddle Asia so really psyched to be presenting here um and so yeah welcome to this presentation on investigating hacks in the first 24 hours before I get started um I thought I'd take a moment to introduce myself and the company that I work for so my name is Margot and I'm a cyber crimes investigator for chain analysis which is a blockchain forensics and analytics firm but for the purposes of this conversation I thought I briefly present what the team that I'm a part of does so the crypto incident Response Team within

chain analysis we're a team of specialized investigators that are kind of scattered worldwide and what we do is provide a 24 7 support to private customers who have lost funds as a result of a hack and our objective is to put in place an investigation where we're going to locate the stolen funds and then put in place measures to recover them for the victim and that's essentially what I wanted to talk to you about today which is these investigations how did they take place I think a worthwhile question to ask first is why is this topic relevant why am I here at a Dev conference talking

about investigating hacks so I thought I'd do a quick survey of the room so buy a show of hands who here has already heard of an exploit targeting a D5 protocol over the past year wow that is not as many as I had hoped but my stats do show otherwise so essentially the reason that I'm here is because we believe that she analysis that the defy Community has become a target of crypto hackers if you look at the crypto crime report that we published last year 3.8 billion dollars were lost as a result of crypto hacks and of that total amount of hacks 82.1

percent targeted D5 protocols and the reason this is becoming such an issue is because whilst you might think that one hack would Target one protocol that's not always the case it actually has implications that go Way Beyond to the Euler hack for example that happened earlier this year so Euler is a D5 protocol that was targeted by a smart contract vulnerability exploit and that led the attacker to kind of drain tokens from a lot of that pools so obviously there was a financial implication to that Euler lost 195 million dollars their native token plummeted in value their liquidity

completely decreased but it didn't stop there because according to our analysis 11 other protocols were financially impacted by this and some of which actually had to close down as a result of that hack so the good thing about Euler is that sure a couple of weeks later the attackers send the funds back you know great but what if they hadn't and more importantly what if that same attacker just decides to exploit another contract one that maybe one of you guys created another area where D5 has become a Target is the the tools database protocols that you're putting in place and developing they're becoming

increasingly used to launder stolen funds proceeds again if you look at the crypto crime report 57 of funds that are stolen by crypto hackers are then sent to D5 protocols for laundering purposes so was that conversation started quite bleakly I'll admit we do see quite a huge investigative opportunity with defy as you all know it's open source Defy is transparent and so by its nature it's become accessible and available to all if you know where to look you can find the information that you need right and so that means that we as a community

can actually investigate these hacks and assist victims of exploits altogether so just a quick note here I'm going to be saying we us together quite a bit during this presentation and I wanted to Define what I meant by this that's exactly my point with defy we're not talking about law enforcement and private investigators together in a room just like hoarding that information based on confidentiality purposes those investigations have been open to all and every actor has a stake in it whether you're talking about the D5 Community centralized exchanges law enforcement blockchain forensics company the goal here is to essentially collaborate to get victims their funds

back and that's what I want to talk to you about today and more specifically how the first 24 hours of a hack investigation happens the reason we're focusing on this time frame is because it's an absolutely crucial window imagine a situation where you have a burglar that kind of breaks into your home and steals a bunch of your stuff I think we can all agree here that your chances of recovering your stuff is going to be increased if you kind of pick up that burglar when they cross through your front door then if they manage to escape flee the country and then sell your stuff anonymously on eBay

it's quite similar with crypto investigations take an instance where a hacker steals tokens from a D5 protocol right they then decide that they want to obfuscate the trace of funds so five hours after the attack they send the funds to a mixer they withdraw those funds to private wallets that they control approximately 10 hours after the attack and then they're in a situation where they realize that they want to go off ram they want to get fiat currency in exchange for the cryptocurrency that they stole so in that sense they're going to have to go to a centralized exchange cash out part of part of their funds off Sheen and then send the rest to an alternative blockchain

now imagine two scenarios scenario one you start investigating 27 hours after the start of the attack so if we go back to the graph at 27 hours the funds have been withdrawn from the exchange or are off chain right so by the time that you actually catch up to what the attacker has done you haven't Frozen any funds and your investigation is ongoing in a second in a second scenario sorry if you actually start four hours after the start of the attack the funds are still in the initial hacker address the opportunity here is that when they start moving to the mixer you can follow them live that means that you'll identify those withdrawal addresses before the funds actually leave them

and what that allows you to do is that when they move to The Exchange they can be intercepted there you can freeze the funds essentially and so the main difference here is that in an investigation that starts four hours after the attack you have approximately a hundred percent of your funds Frozen and ready for recovery and your investigation is done whereas before you had a situation where no funds were recovered and the investigation was still ongoing that's not just say that if you start your investigation within 24 hours your funds will be recovered and the investigation will be done in a day it's just that the earlier you start the more time you have to assess the situation and Implement a situation that

a situation and a structure that will optimize those chances of recovery regardless of how your investigation goes in the future and that's what I'm going to go through essentially the key components that you in collaboration with other stakeholders in the space Nietzsche put in place to optimize your chances of recovering stolen funds in the event of an exploit we're going to start with damage control and assessment that component essentially aims to mitigate and understand and exploit the first thing that you want to do is Safeguard so essentially impede any further funds from being

stolen right there are multiple ways of doing that some of them are listed on the screen some examples will include sending remaining funds to a safe address or halting the activity of the vulnerable protocol alerting the community as well because that means that anyone that is able to help you in an investigation is actually notified of the fact that you were exploited another area will be to understand how the exploit happens and scope out your attack essentially the questions that you're going to ask yourselves there or what's the root cause what vulnerability did they exploit what Chains would the like

the threat actors active on where are the stolen funds what are their addresses what are the tokens that were taken everything that helps you assess the situation and understand how it happened and in our experience a victim doing that alone is way less efficient than when they collaborate with investigators the defy space if you look at previous exploits that happened this year the first thing that's done is alerting the community on Twitter and then there's a surge of support there's a surge of involvement to help that victim assess the situation and determine next steps and that's exactly the point of it understanding the situation allows you to define the strategy that you want to

adopt so I'm not going to pretend that these are the only three strategies that you can take when an exploit happens there are many others these are just some of the common ones that we're seeing during our investigations so you can decide based on information at hand to put a bounty on the head of the attacker or you can decide to attempt to negotiate with them to recover your funds or you can just decide to go after them and don't get me wrong these options are not like independent from one another I've seen hacks where the affected D5 protocol just decides to try each and every one of them and then based on the result just go to a Next Step the second component that you're going

to want to look at is structuring the investigation there are two main ways to do that the first is establishing channels of communication with any kind of relevant party that's going to help you in that investigation the reason for that is that hack investigations are a really fast-paced environment right so what you want to do is be in a situation where when the information travels it travels fast enough to be acted upon so that you don't miss any kind of opportunity for freezing recovery exchange of information another area that needs to be set up is a legal structure to your investigation unfortunately currently unless an attacker decides to

send the stolen funds back the only recourse you have to recover them is through a legal process whether we're incorporated or not we're all private entities and we therefore don't have the power to just recover funds without someone allowing us to do so and so due to that reason you have to set up a legal structure to your investigation whether you decide to go with law enforcement or work with a law firm and a civil court if you look back at some of the exploits that happened over the past year that legal structure is one of the first steps that they take within hours of the hack those D5 Protocols are going to

reach out to a local law enforcement agency and get them to back the investigation it makes it more efficient a third component is going to be tracing and locating your stolen funds because if you don't know where they are you can't really recover them in any way right as we said at the beginning a lot of threat actors use a variety of obfuscation methods to kind of hide that flow of funds and the way that they do that is by using a variety of D5 protocols and services some of the most common ones we've seen have been swapping one cryptocurrency for another bridging tokens across blockchains depositing funds into a mixer or a privacy protocol or just

generally using any kind of complex smart contracts to kind of hide where those funds are from and where they're going but as mentioned as the beginning as well since we're using well since they're using D5 more and more it's highly traceable remember the mixer that we talked about that wasn't the end point once the funds were deposited at that mixer the investigation continued we're able to trace the funds through that privacy mechanism identify the withdrawal addresses and based on that determine where we're going to go from there and that's why we have three options available to us generally either you have to kind of wait and see

so that's a situation that happens when the funds are sitting unspent in a private wallet that's controlled by the attacker because you don't have any control over those funds you can't recover them you just have to wait until they move a second option would be to take the investigation off chain so once again if we think about the example at the beginning the thread actor deposits funds into an exchange and then converts them into fiat currency there's no point in having an on-chain investigations because the funds are not on chain anymore and the third option which is what we're going to address today is essentially freezing funds so throughout the course of our investigations we've developed relationships with specific third

parties that have that freezing and blacklisting functionality these generally include centralized exchanges gambling Services as well as tokens with a blacklist functionality there is quite a controversy around freezing especially within the defy space but I would like to stress that freezing is not a decision that is taken lightly it's not you have a friend at binance and you just call him up asking for them to freeze the funds because you have a hunch that you know it comes from illicit activity no that is the worst scenario ever it opens you up to Legal Financial and reputational issues no when you request a freezer fund there's

a process it's based first and foremost on legal backing so imagine you trace funds to a centralized exchange the investigator will go to The Exchange provide evidence request a temporary freeze which will then be backed by law enforcement and supporting documentation and the second aspect is that you have to provide evidence essentially evidence to show not only that the account is controlled by the threat actor but that most of the funds are actually coming from the exploit that you're looking into this avoids freezing funds of an innocent third party or of a service who receives funds from a variety of different places but even then

legal backing and evidence is not enough so take a situation where you've managed to trace the stolen funds to a centralized exchange you've prepared everything you needed and then you contact them through their support platform more often than not by the time the exchange gets back to you the funds are gone your opportunity just vanishes and that's where those channels of communication that we were talking about at the beginning are absolutely essential you need that information to travel fast so that those exchanges can act on it as quickly as possible and actually exploit that freezing opportunity so now that we've gone through the theory of the components that you need to put in place to optimize your chances

of recovery I'm gonna go through three case studies that I hope will illustrate how collaboration impacts an investigation foreign the first was a D5 protocol that we worked with earlier this year who was targeted by a liquidity pool exploit and lost funds on an alternative token the first thing that they did was establish damage control measures the community was alerted on Twitter the activity of the vulnerable smart contract was suspended they assessed the number of impacted users they patched and solved the vulnerability and they engaged with us to determine what had happened and where the stolen funds were

when we started working on the case we actually found something quite interesting which was the initial exploiter of the attack wasn't the actual address holding the funds what had happened is the attacking transaction had been front run by an Mev bot what we did considering that our objective is to recover the stolen funds was look into that Mev bot we realized that they were present on four different blockchains that they had been involved in two previous exploits where they had front run the attack and that they had exposure to known services so essentially there was a way to gather more information on them we shared that information with the client and between that and the

assessment of the attack they decided that the best strategy for them was to negotiate with the Mev bot and considering that initially that bot had no intention of actually targeting that specific protocol they were very open to conversations and the end result was that the victim got most of the funds returned in exchange for a bounty for the attacker so here collaboration allowed us to identify and patch a vulnerability understand the exploit negotiate with the threat actor and all in all recover the majority of the funds in the second case study a D5 protocol was the victim of a social engineering

attack on an alternative blockchain the first thing that they did when that happened was activate a blacklist functionality that allowed them to freeze most of the funds that had been stolen on that specific blockchain working with us we were then able to trace the remaining funds to the ethereum blockchain to two wallets controlled by the threat actor and at the time the funds remain unspent in those wallets for several days so we established a monitoring watch list so as to be able to kind of track the funds as soon as they started moving again which is what they did a couple of days later what happened is that part of the ethereum was swapped to usdc which is a token with a blacklist functionality and

the remainder was sent to a gambling service at that point there were already direct channels of communication with these two entities so we reached out to them and the funds were frozen here again collaboration allowed us to limit the extent of the damage it allowed the victim to trace the funds through services and then freeze the remainder of the funds so once again here we're talking about a recovery percentage that is way more than just 50 percent the third case study that I wanted to address is yet another D5 protocol that was the target of a social engineering attack on an alternative blockchain and the tokens that were stolen were stable

coins with a blacklist functionality so here again for damage control purposes we reached out with the victim to the company that had set up that stable coin and they were able to freeze the funds however due to a miscommunication and lack of cooperation between us the investigative company the victim and the company in charge of that token the funds were unfrozen and moved forward so at that stage as the funds were being moved we were tracing them live so we were able to um yeah Trace them as the attacker was moving them the funds were sent to two centralized

exchanges as well as two D5 Bridges again thanks to the fact that we were tracing them live the funds sent to exchange number one were frozen and then the remainder were traced through investigative and open source techniques as of today we've traced them on ethereum through a variety of different D5 protocols including Bridges and mixes and they're currently sitting unspent in two private wallets controlled by the threat actor so here you can see that that lack of communication didn't allow for efficient damage control measures whereas part of the funds could have been frozen immediately they weren't

however future collaboration after that allowed for freezing and tracing of the funds the investigation is still ongoing and we're hopeful that we'll be able to be successful in the future so I'm hoping that through this Theory and those various case studies I've been able to show how collaboration between victims defy and investigators is essential for good and efficient investigations but what I'm hoping to finish on is essentially thinking about how we can bring that collaboration beyond the investigative space and more into the prevention realm so essentially build a

space that is so secure that when an attacker actually Scopes it out their reaction is ugh no that sucks I'm gonna go somewhere else and on top of the opportunity that it represents to secure that space in a preventive way it's also something that can be achieved in a completely decentralized manner because essentially the preventive measures that you're going to think about are going to be building technical capabilities to prevent attacks or raise awareness provide training audit smart contracts all those things that can be implemented independently by each stakeholder in that space

and we think that the efficiency of those measures will be increased through collaboration through data sharing through Trend analysis and blockchain analytics and basically engaging defy and actors involved in the crypto security space so this is essentially what I want to finish on I believe that the closer the engagement the safer the space and our objective should be to reach a point where when we collaborate these threat actors just run away so thank you for your time um it was great presenting in front of all of you and if you have any questions issues or ideas for future collaboration don't hesitate to reach out

[Music] thank you