Top Hacks since EthCC ’22: what did we learn?
ETHCC 6 · July 2023 · 29:16
Matthias Egli and Julien Bouteloup review blockchain hacks from 2022–2023. Drawing on Rekt and ChainSecurity analysis, they examine attack tactics, vulnerabilities and possible defenses.
Speakers
Topics
From ETHCC 6, hosted by Ethereum France.
Transcript
[Music] foreign [Music] so let's get started welcome everyone um I'm here together with Julian to talk about the top hacks which happened in the last 12 months what did we learn about them and um where where's the road going and just as a quick intro like a about myself but I'll let Julian introduce himself too uh I'm founding partner CTO at chain security and I've
been in the space for like five years in this really blockchain security space in the it security space for like 10 years and coding for quite a lot longer um Julian so a little guys fixing the mic my name is Julian butalu I've been in a space for uh quite some times I've been a coder for even longer than this and um the one that founded a wrecked and used we cover uh some interesting and spicy stories in the space of blockchain
so keep us very busy and I'm also running a state capital group we have a bunch of different companies stackdown Blackpool we have a hedge fund also been quite pretty active in the investment side I'm also involved in curve Finance so yeah so for those who aren't aware like Greg news creates these amazing videos but is mostly known of course for what Julian said the takes on the big hacks on rect.news and quickly chain security we are a smart contract auditor we work with many
of the big D5 players and other protocols to secure them but we also do a lot of research developing tools but but our heart is really into figuring out new kind of vulnerabilities and there is quite some track record over the time of having done that again and again and is also why I'm very interested like to be here and then to talk about some of the new ones kick this off um like we had many years of security in the ID security space very very many in the blockchain space not so many but still some like and we learned a lot of things in the past right so the question
is did we learn from those mistakes so I have this here guess right so there isn't uh there are some learnings we made but even though the re-entrancy attack a very famous perhaps the first very famous blockchain attack is one of the oldest 2016 the famous dial hack right and so on um it still happens again and again but sometimes with new flavors um like almost 40 percent of all re-entrancy attacks which really hit protocols which um with significant loss has happened just in the last 12 months
still it's other forms of attacks are coming up and we'll go over them but just to give you an idea this is the rec leaderboard yeah I mean it's a leaderboard you don't want to be on as Auditors anyway you don't want to be on is project of course you don't want to be on it too and this is the additions of last year right it looked really different and now we can scroll down before we could not really scroll down now we can slow down more and more projects are here really high losses uh smaller losses too all across the space so we we still have that major problem of hacks every other week um
and I wanna make this a little bit perhaps also a little bit interactive I have Julian here I'll give usually a quick overview of the vulnerability which was there and then we'll discuss a little bit also of the impact outside of the Purity auditor mind right the technical hack and so on so to make that interesting I took quotes from wrecked news and it's about guessing the vulnerability this one I liked a lot is there anyone here who'd say like I know this I know the hack like you can shout it I repeat yes Nomad Bridge
so this is our first one um so what happened here quickly as a recap many of you might know what happened um we had a protocol it was audited but it it was a bridge right so uh it did an upgrade and this upgrade very likely wasn't audited and then it was pushed out now there was a combination of things which caused the issue in the end before the upgrade there were State updates which the upgraded code couldn't even do anymore but because they were on
chain already they would cause in the end in this case that every uh trans every relay proof from another chain would be considered valid and and why could everyone join in we had that attacker perhaps I'm guessing here not the most sophisticated attacker but he definitely found this vulnerability for example he burned 350k in Ease on a reverting transaction uh trying this thing and it wasn't like one where you could say like of course he had to compete with front running or whatever right it wasn't one of these types but in the end he was successful
he stole like 100 wrapped Bitcoin but now everyone could see the attack could very easily copy it and many many did right so that's where everyone joined in whiteheads blackheads gray hats and they completely drained the bridge over there and and thoughts a lot of thoughts okay like generic Mev front running Bots yeah we talk about Bots later too but did they return the funds usually or do you know well depends on the organization that is running those spots right and sometimes they have no organization running those parts those
spots running by themselves okay truly truly uh autonomous organizations huh yeah [Music] um so what did we learn from this hack um I can give some of the technical learnings right um so something which gets preached again and again but uh is something which works really nice like you can do mainnet Fork tests and especially simple negative tests like this any any transaction was suddenly valid right a simple test could have caught that obviously you should get your upgrades audited like here in auditory speaking
yes you should get yourself audited but also new like if you do an upgrade you need to validate deployments and on the response side of things um this attack I think it lasted for hours like it wasn't something one transaction everything gone yeah correct yeah that was uh it's usually um the same type of response where uh because of people being in a few different regions of the world they have to connect on the same group chat and it takes a bit of time and sometimes the developer that is involved or understand the vulnerability is not uh reachable so it takes time and that's why it can go for a couple of hours
there's no shutdown mechanism of emergency protection one point is really interesting is a validate deployment sometimes you can have the most sophisticated audit and the code is really bulletproof but there's a mistake in the deployment and people believe that they actually deploy the code that was audited but they it's a wrong location on the repository and they actually push the wrong code and the link to and sometimes they actually link the card to the audit but it's the wrong card if they add published and deployed the right code they will have not suffered
from this hack which is quite fascinating yeah same for me like as Auditors we use to just look at code and don't think too much about deployments but this has to change I think we go to the next one I'm a little bit looking at the time already so um another quote yeah which Drive audited code costed seven day e3s on a major D5 platform compound correct so here what happened compound updated their Oracle to be based on uni swap V3
instead of uni swap V2 and that code had been audited but when they did the upgrade they realized that on chain there was a legacy uh like compound E's implementation which didn't have some function the underlying function that would revert in the code which was audited that wasn't obvious because you do tell the right interface it looked like everything would work and compound quickly figured out how to fix this and and then needed seven days because of the governance method they have um again the auditor's take here like
stop don't stop with negative testing do positive maina testing right this would have helped a lot in this case uh again validate your deployments the second time here um and a little bit of take more uh perhaps controversial but just duplicating the same audit again and again has dimishing returns what are your takes on the compound case no I think compound is quite uh interesting case because it's a very strong team um they've been there for a very long time probably won the first major project in a in a blockchain space but
still they did a pretty uh bad um I would say mistake if you look at the vulnerability in this one is quite something that normally shouldn't have happened for us quite sophisticated protocol but still happened so deploying a code in production is stuff and even if you have a very solid code you really need to double check your deployment process and also try to understand the scope of the deployment and I think in this one was really not well understood by the team or the history of the project basically and I was wondering for response to write something down with like
have something in the protocol to act immediately but I left it out right so like compound hard the seven deadly land you would like say they could actually have been harmed during that time but on the other hand it's a huge benefit um to to not have certain circuit breakers there's a big discussion currently on the e-security channel on circuit breakers so um and and again funds were frozen right and usually circuit breakers do exactly that right they just freeze and then you you recover afterwards so in that sense the impact luckily was just a freeze um yeah it's it's just a freeze for the project but you because you have many
different projects that have and R plug into uh that protocol uh you also have a huge uh collateral damages across the entire ecosystem some people are building on those type of projects for hoico and then they also freeze but some people take leverage or type of derivatives and then they get liquidated so it's not sometimes not only at one place the the risk of the damage is also because it's D5 Lego it's also across across the car system and then it cause many more hacks to happen because of one major hack so one when you see one hike in the ecosystem you can almost be sure
that you will see either replication of dosack or something that will enable additional Arc because of this particular hack which is again very interesting especially for raked um because we talked about deployment validation here twice I'll very quickly pitch something which we just told the Easter like the the security community and the D5 security Summit just before so we are having a small new tool which does deployment validation right and then basically you have a git repo you check it out and then you you run that and it says you like is that really the code you have it debugs the state so you can actually do this thing it is it's
not rocket science it's not like a formal verification whatever like something really complex but it really solves this problem and makes it much easier to go in and say hey now I understand what the deployment has been so we hope that quite a lot of these hacks we have seen can actually be prevented with with that approach um there's a short summary there is a longer talk I gave yesterday on this so um feel free to look that up in the defy security Summit um and and for those who are interested like just go to github.com chain security slash deployment validation just sign up and um we are very soon making this fully
open source like they were this isn't the product itself it's just something to help um next one back to the hacks have you tried turning this on off and on again I love that quote from Rick news too a little bit harder anyone yes very good uh Solana was what was mentioned ah sorry stupid me no almost another one it's not Solana yes Finance matching or binance chain so
what happened here we had an attacker who like pretty elaborate pretty clever thing like he realized that you could create fake proofs um using a vulnerability in the library which was used in the pre-compiled on binance Smart chain and that Library came from Cosmos was used in the pre-compiles it wasn't used by Cosmos so it was like a little bit older and so on right and um with that he could like just mint him infinite tokens he used a landing platform on binance marching called
Venus to convert them and try to exit as quickly as possible and why did he try to exit as quickly as possible because binance smart chain has a special security feature right and was able to stop the change shortly after the attack this way um the the current value at risk was like exceeding 500 million so a lot of that was still stuck now in binance smart chain um again the auditor's take here like it's very hard to do these crypto libraries correctly that's repeated again again
reuse the the things which have been battle tested make sure to audit your crypto Primitives too but then the new thing here like the social layer is the last line of defense and ethereum gnosis right we did this too that was 2016. and uh the social layer fixed a buck so to speak but here it fixed it too so how they got a lot of heat for that right I'd say rightfully so what is that the same as what happened to ethereum was should they have acted differently should they have Let It Go well I think back then in Ethan we're pretty uh early in the early days of uh the this uh blockchain uh uh roller
coaster so decision of rolling back back then was not that obvious but a little bit more uh legitimate in this case we about eight eight years later uh it's it's a mistake on the on some cryptographic deployment so uh uh I'm not sure yeah and also this one is a fork of ethereum so uh it's a little bit more complicated to justify such a move what do you think yeah it's um it's a good question of like basically you did see the centralization parts and many other projects have the same problem right that that you could
halt them I mean my point is this one like if you look at binance you said in early days they were saying okay we'll deploy a new chain because ethereum didn't follow uh the uh they didn't left the the money back then but they did exactly the same six years later so it's funny yeah um okay so we are running out of time as always um so uh it feels like reading only about the same attack over and over again and who has an idea and actually many ideas it's the read-only re-entrances the underlying one and we'll have a lot of
hacks of those one that was d4s there was uh Market XYZ there's meters or Midas Capital um and um those were the ones which um had uh hacks uh which happened to them because of their curve Integrations there were others which had hacks because of their balancer V2 Integrations it's 35 and sentiment protocol um but and here is a silver lining a lot of other projects had been vulnerable right and um weren't exploited and probably a lot more weren't exploited too which I don't know about right we often don't know
about this so um quick take here like it's very important to educate Auditors about new attacks and and this has been done like a year ago right long before the attacks happened the education started and a lot of projects had been secured by then and backboard T programs work right sometimes um I'll skip over this please watch The Talk uh give enough Defcon by Yannis one of our Engineers on read-only reentrancy I'm not going into that because we have no more time and we want to get to like some questions um I'll just have a very short thing here
this was last year's ECC I asked the person he's fine with that we can't hear him that said um so what he says here is like look I know where I am I am on the left curve and lots of my friends they're in the middle they are on the right but the problem with them is like they think too much they don't execute right so I'm here to tell you like if I can do it so can you if I can extract value from ethereum so can you which attack so I talked about it before Mev Bots
Mev bots gets exploited very interesting two big attacks unprotected callbacks is the first one and the second one is they managed to break uh flashbots private bundles a very big attack um yeah we learned something more here I am almost out of time but yeah we'll make it quick for questions yeah yeah go great yeah do you like so we jump to questions right away just go quickly it's yeah we can finish and then go questions here five minutes it's fine sure um so like if you keep your source code
secret it's not a protection there are tools nowadays like this one which finds in unpublished code what the vulnerabilities are very direct right so don't think you're protected just because you keep your stuff secret I wanted to get to Euler hack I'll skip over Euler hack a very interesting one with that main takeaway No One Is Safe they did a lot of things right right and in the end it did hit them but silver lining you get your money back sometimes um and did I I just read I wrote recovery of fonts um
things in the room which are missing which we didn't talk about here biggest hacks by far I can centralize exchanges right FTX and so on um semi decentralized project or let's say quasi-centralized actually second biggest cause of hacks like just last week like multi-chain right and we have a new emerging threat and user private key leakage like basically wallets losing the private keys so we didn't talk about this I'll have a few take-home messages I'll leave them up here but now we can go to questions if anyone if anyone has a question you can raise his hand or her
hands and when I will come to you to with the mic question guys yeah got a question there yes if I can explain the Euler hack that was a question um so what happened to Euler um so um again it wasn't an upgrade which caused Euler to in the end get hacked it was it was an upgrade which was audited um the the underlying thing here what
happened was um ye they added a function to Native pool this one seemed like like it can do no harm but when you donate it to a pool it didn't check that you donated and that after your donation from the pool you donated from your position was still healthy so you could make a position unhealthy and the attacker then could liquidate that position do that again and again earn the liquidation rewards in this way drain the protocol like this is which is a very useful attack it was nice yeah but it's um technically speaking and these are the biggest types of
attacks like our like Oracle manipulation the biggest one in smart contracts right after like ftx's and so on but um and then like some like these these looping manipulations where you drain value out of protocols we have seen these and these ones are usually the ones where they make the top 10 leaderboard Oracle manipulations looping and the second one is actually interesting is like web 2 attacks on web3 particles for example Badger Dao and all different things where you manipulate either the the website hosting the smartphone site and not hosting the smart contract but giving access to a Smart contract because you can either pretend that you're approving
uh some tokens on behalf of uh someone another contract and then you can later steal the money basically the hiker has access to your talking but you don't even know it about it it's uh all types I think it's a top three attacks in the space and the last one you talked about it's coming up right it's coming up more and more that like that was really sophisticated the hacker router in a location in the state and they could go on I think there was um duck Domain Austin service provider and they managed to go to that so even yourself as a project that you're hosting uh your landing page for you having access to
the smart contract you cannot really be protected against that so you need to make sure the code that is deployed on your front end is uh you have some hash any modification of the front end you shut down the front end you shut down access the smart contract in multiple different way of attacks yeah yeah uh thank you for the presentation uh you mentioned the circuit breaker EIP I would like to have your thoughts on that which ones Julian's or mine yeah the circuit breaker EIP that was recently open you mentioned it earlier okay I'll give a quick idea what this is about so there is an EIP out on it on the mostly
discussed on its security telegram Channel um the idea here is that protocols include um like so-called circuit breakers basically functions where they can um check if something bad is happening for example like more than a million has been withdrawn in one block or so right and then they just stop automatically some are more like an enabling manual immediately pausing this kind of stuff but here we are mostly talking about the circuit breakers biggest biggest challenge those ones face from my perspective is um like the composibility gets harder you do do add code you add layers and there's layers expand everything which
integrates with you also needs to think about these parts the very good part I'm honest is it it definitely reduces the impact if they are bug free right so this is always the case but um just just like 200 million lost in one transaction that is that hurts a lot right um and and having these circuit breakers it might it might help but it's definitely something which I love in the ethereum community like we should try it right and then see and um the week we can experiment with these things and the time is over we don't have time for the question sorry okay it was good
[Applause] [Music] thank you foreign [Music]