[ETH Seoul 2024] Vulnerability management: Zero-Day, Today & Tomorrow by Tim Pechersky

ETH Seoul 2024 · 12 Apr 2024 · 26:36

Tim Pechersky, Solution Architect at OpenZeppelin, looks at how the Ethereum ecosystem can handle widespread smart contract vulnerabilities. Using the recent ERC-2771 and multicall issue as a case study, the talk walks through responsible disclosure, triage and monitoring, and coordinated mitigation. It then zooms out to security standards, community norms, bug bounties and circuit-breaker style safeguards, drawing on lessons from automotive and electronics engineering.

Speakers

Topics

From ETH Seoul 2024, hosted by Kryptoplanet.

Transcript

hi everyone I'm really happy to be here and uh very excited about actually people speaking a lot today about history and about um the Dow hack which happened in 2016 because that was a time when I was just getting into ethereum and I was watching all of that and I was wondering oh my God how do you even like deal with this kind of like uh immutable contracts and this kind of vulnerabilities you're getting so um that's actually the way how I got into the open Zeppelin because open Zeppelin mission is to protect open economy and help protocols and projects to stay on the safe side and I was I started exploring and I got into this

field really quickly um for those who may be less familiar with open Zeppelin so we're mostly famous for our uh open source public goods libraries which we uh we do as the public goods for ethereum uh space and we contribute to other ecosystems as well right now and from there logical extension is to do the audits to help the projects to make sure that the implementation of those libraries is secure and last not least is our um Defender platform which uh provides operational security and we recently uh introduced their ability to do uh code scanning from GitHub repositories to find the vulnerabilities

in automatic manner you can do the deployments you can do the monitoring there a lot of stuff transaction execution Etc so the famous Murphy Law right um it's arguable but uh it works it works in the space uh really well or speaking mathematically basically if there is a probability of something going wrong well it will go wrong on our infinite time span and um you know some reasons why it goes wrong you know we've seen MPC protocols being hacked like Amo of and kind of patterns being vulnerable and plenty of other things happens and

people are often say like not your keys not your coins but basically it's it's not really your keys it's just a number someone might know it right so this is always going to be a point of failure for any like private key based cryptography and we also aggregated for the last year some of the top blockchain high techniques and we see here a lot of things happening on different levels of development so the compilers the protocols smart contract infrastructure and just smart contract bags um so just to differentiate uh the difference between like just a bug in a

contract and vulnerability in the interest structure of these contracts is that you might have perfectly well working two contracts and then you combine them together and would you get a pattern which is vulnerable which we seen for example in UHC to 2771 uh combined with a multicol recently and uh as times goes on actually I I assume we'll have more infrastructural kind of like smart contract vulnerabilities happening uh justice industry gets more mature one interesting notion though is that across all of these categories there is a thing which we can identify

as widespread vulnerability which means that there is multiple parties affected and this is much more serious and it can happen pretty much anywhere for anyone who is dependent on a common dependency right um so in open zeppel and we are trying to help also on operational side to mitigate these problems and helping managing the vulnerabilities for protocols for our customers um and in nutshell it's set up the disclosures how do you do the proper disclosure you know how do you identify and access uh set up the monitoring for uh protocols and when you

know it really hits the fence like how do you mitigate that quickly coordinate everyone provide tools and uh well today as you can see this is quite messy diagram but basically mostly we can use Ping On like where we're speaking about solidity development or smart contract development in general it's mostly going to be like either you're going to pause your contracts or you're going to upgrade it which upgradability is kind of like very peristent way which we would like to go away from right as a community it's not really an e to like be too much permissioned but when you need to upgrade fast you cannot delegate that to Dow voting you have to have some

kind of security consoles and we see around that more likely you're going to have a security console around um and the Ping as well is really not the best case to do but this is what really happens and um in the diagram I want you to notion um this white high tras and how much arrows in that diagram actually comes together in that because we'll get bit that later as well that there is actually like theoretically magical button which says like fix my problem you know um magical button will always Thrive th too so let's see like the case so like widespread vulnerability how it can look like and how the mitigation look like so

say we have a common dependency which Bob Alice and Carlos use now Carlos detects some like say zero day vulnerability in the ecosystem um the responsible disclosure would like would would look to for caros is actually to go for echosystem or security provider for the ecosystem and disclose that to them because at this moment Carlos is not really the person in charge to do the patching himself he he's a user of the ecosystem um and then ecosystem provider should you know coordinate the mitigation strategy across all of the parties coordinate the media disclosures um and this is what we did recently as

well um and then there is like a game theoretic model around that that basically Carlos most likely because they're using the same dependencies is most likely competitor to Alis and Bob and he is also incentivized you know to get some media Victory to go and post early Etc uh the reason he might not do this like completely like like a badass because we're a community and nobody's going to just talk to anymore if he does like really bad thing but he could do something like uh like maybe maybe in a middle like say he does the responsible disclosure and then he goes to the media post and makes a Twitter post at this moment um well

actually I'm sorry but the arrow this Arrow had to be here so after he made the disclosure he goes and makes a media post what happens in this moment is that security provider is not more or ecosystem is is unable to provide have a time to provide the proper mitigation strategy for Alice and Bob and Alice and Bob are not happy at all about that but for Carlos it's a media Victory now everybody is sharing his Twitter post and uh even worse if he is making non mitigation because in that moment he is actually uh posting like all of the onchain data for hackers how to reproduce the attack which is the worst you can do

really um and this is why when we're thinking about this we actually have to come to the Community Values I think the Community Values are really important because as ecosystem if you run your project you are actually you know you might have like Grant allocations and you can actually sign up people to some kind of community code of conduct um for um these kind of cases and uh you have quite a lot of things you can actually like build an ecosystem specific expert set to bring this values all together and have some specific um experts to come into the

work when the whole ecosystem is affected particularly for your uh projects uh working in your field um and then yeah just give like a help support as much as you can these projects is also important um it all comes down together to something we can actually start thinking about as ecosystem emergency protocols which are hopefully at some point automated but right now it's actually a quite manual process of people just communicating and talking to each other about things uh going wrong and needing to fix quick and how so here is a use case so you know this uh um hack happened recently so in

the natural this is what happened basically you had an attacker who could call a trusted forwarder contract which would call a multi context multi call contract and the multi call would extract The Trusted forwarder data and would execute it from uh it would call it a cicon so this infrastructure so the contracts are perfectly secure but you combine them together you get a vulnerability now in our case you know first thing was you know to acknowledge and assess and assure uh at this point we already had to have some public disclosure about that things is happening because it was already on media by that

time um the second point was that we had to actually uh provide some triaging and monitoring for the projects to see if they're affected that was a moment where our code inspector at Defender platform uh went on and we added there the vulnerable pattern and you could scan your GitHub repository and a lot of projects did that and um it really helped a lot and uh then then their accidents started to happen and uh at this point we had to do the proper disclosure of how to do the mitigation strategy publicly uh even though before that we

tried to approach in telegram on private basis all of the projects that we could identify um yeah so this is in a natural how like one of these cases happened internally for us and what we did there um and it wasn't really perfect it could be better right so let's look into the future how do we actually make the ecosystem more secure let's zoom out and think about okay smart contract security how do we make it better uh I really like this um comparison with industry more mature industry like uh Automotive or uh air uh

flight and airplanes you know it would nice to have this kind of checklists however really to get this kind of checklist what do you really need how do you get there to have this checklist really effective as it is for the pilots um well you need to have a standards like look I I'm I'm a guy who actually worked a lot in in traditional industry before the blockchain so I did a lot in electronics and Hardware Designs and I'm quite familiar with how the standards are there how important they are in order to get things really reliable so when you're driving your car you're not thinking about that but these are the standards like rough approximation of what's like high level

standards uh set looks like for car manufacturing an automative ecosystem uh which here is like one is just block is like let's say chip design um you have like audits as well a lot of stuff uh and a lot of this stuff you can see is actually provided by nonprofit organizations across the whole globe working in a different countries or on a different Industries and sectors um which you know we are also having right now basically protocols defining their standard it's actually doing the same um but you know it's really important to understand that picture and understand that scale you have to do that at um because here is really like what's behind the one of

those standards this is a rough design like not rough but quite precise design of how you would do the chip uh attestation for uh being reliable for automotive industry which could be compared to like doing the attestation for smart contracts and uh uh working securely and each of these blocks is a separate test group with a huge amount of tests inside um so it's huge it's a lot what do we have um at this point in ethereum well I would say we have like something like this it's much more simple however it's based on the same values as any industry is based

basically we have a community principles of how to do uh prop what what is the proper way to disclose what is the proper way to do security and uh in my opinion this is a fundamental Pilar of security and smart contracts um it defines why the immuni is so important why it's so successful because you're able to run the bug bounties programs because it's more um incentivized for the hackers to actually wear the white hat and the same relates to funds recovery where you can think about uh lows and regulations and a traditional like law enforcement as way of the rating system and you could put some of that on chain eventually it will

happen probably um and then ecosystems and the code of conduct like what's what's good and what's bad if you agree upon that it's much more easier to you know if even if things go wrong like one of the cases say um the Dow hack it is a community which voted on how do you uh treat this and then the smart contract security of course not the last is the second fundamental Pilar which we are trying to standardize and uh make more reliable over the time and here in the future you know we we can plan for these Magic Buttons to disable vulnerabilities in non permission way uh account obstruction uh is a great deal here

because it's not just allows us to do the social recovery it actually allows us to create more user Centric asset ownership medals uh where you can have more intrinsic uh security for the users actually if they are operating from a smart wallets by default and uh yeah and then actually building secure apps and like some kind of audited uh infrastructure Registries is something that I'm totally sure will come up in the future uh and I can see some of the works happening in the FI so just to briefly explain some of those Concepts so security layers um you know son since we have like now the blob and we have more uh

ability to process the data on chain do the more processing on chain we actually are able to build more more complicated security models on chain uh we can build more logic um and if you think of one of the kind of like wrapper approaches is actually if you're running upgradable proxy you are basically having some kind of logic state which is defined in your slots somewhere on an address which are rubing to your management logic which is doing the State Management now no one really blocks you from doing more layers uh around that um and uh you can use different ways of layers you can basically you can use

tokenized standards actually as mapping the token IDs to the message do signature why not um and this this approach it would allow us to actually have more uh like less permission AES about uh bringing any security problems down because imagine that each of those layers could be orthogonally managed from different entities so you could have some intrusion prevention system which is being managed by uh entities that are um formed as a dow or on on a decentralized principles and if one caes a say denial of service another another party can

actually step in and uh disable him from doing that um yeah so if you're interested in this please approach me later and I'll I can show you some uh GitHub repost as well on that um more secure apps um this is what happens you know traditionally today when you're are doing like some um ethereum D app interaction you will have um asset the app and you approve the asset to be used by the D app everybody knows that but there is something missing right there is a reason why I left so much Blank Space right um so the the thing which is

really missing here is the trusted entities because you're going to look like you know is this D app really secure you're going to check like did vitalic mention about that D app you know is who is using that D app basically you know was it audited and actually good D app maybe also will do the qic or qy on the user who is using the D apps so they will refer to some kind of trusted entities you know whether it be ether scan or AIT registry or something and uh today it's not on chain but well we could we could put it on chain and there are some initial thoughts on that and there actually I before doing the audits on chain which I think is first great step towards that

um so that next time when your grand goes to ethereum she's able to automatically scan from the chain what is trusted and what is not which is great right and um user Centric Solutions in age of account abstraction is how I title this but basically this concept is about thinking that okay um account obstruction is not about RC 4337 just it's about General consensus about that hey like smart wallets are the way to go to store and operate your assets once you have this way of thinking you are able actually to think that wait a second like smart wallet can be thought as

operational system which protects user because in case where uh you know you're working with traditional wellestablished operational system in computer architecture you don't think about that but let's say quickly let's imagine you have a Wi-Fi module which opens the door the door protects an asset so the software which has an access to this wi-fi module to open the door can be mapped to saying it's owning the asset behind the door right so in this manner if you're installing the app no app is able today really to access your Wi-Fi model that easy because there is operational system which manages the uh API access to the lowlevel resource it will go through the

uh OS and if we think that we have a smart wallets today we are actually able to start thinking and this designing systems where you would have more user Centric security around particularly owning the assets by the user and then installing the apps and granting them permissions as OS would do with the API uh and this brings a lot of really a lot of benefits because users can not just own assets more securely they actually can be in charge of upgrading um and in this manner like I really live the previous talks about the interfaces because really if we think about nasset

it's not an interface erc20 is not defining how do you store an asset it defines an interface how do you manage that asset however you the storage the way you're organizing the storage can be absolutely different so you could interface your C20 uh tokens through the um storage with which are based only to the user decisions and then you could have upgradeability which is managed by the user first phone because he's owning the storage and you're and just giving you a permission to access it through the erc20 interface on his uh premises and one of the things I really

think it's going to happen uh in um in in the blockchain space is that like automated flow control is going to become much more important since we are getting like really close loop economies where like you know funds are just flowing around the chain um it becomes very very similar to what you would expect from electronic circuits where once you ship it you cannot really modify it uh but in order to do like you know automative sa automative industry is a great example no one is going to let you know to qualify the chips if you don't have like basic uh feedback loops to uh regulate and read the the the chip state to understand that uh the flow is correct and then you would apply the

automatic flow control to disable and the fix issues on fly um do the recoverable fuses um is one of the examples for that uh where you could say uh block the transactions which are uh hitting over some kind of thresholds of per block or per day or per hour uh uh expected flow uh through that um particular contract or method or uh um liquidity container which you could imagine um and really this is more like if you're interested in this topic I the the theory behind that is a dynamic

system Theory and control theory uh which is more like in traditional engineering I guess uh and then standards there is a joke like it was like uh um there sits uh uh 10 Engineers sit in a room and they say hey there is a 10 standards um let's make one United standards standard one year passes there sit 10 engineers in a room and they say hey there is 11 standards let's make one United so I want to end up on that not let's let's not try to make one United standards but let's try to make

the standards uh for the end user security and sovereignty as uh well as we can um just to make the system really secure and working well so expanding this idea further um have still five minutes so you could think of this kind of like trust flow where each arrow is sorry is a flow of trust from some contract one could say Store the store the asset which is basically just a slotted some address and a bites set or unset

there which is by user uh given to given access by to the driver and the driver can Implement your standards which can in its turn Abate the wallet and the user wallet will dictate who is able to access that storage and that asset driver and then you could have as I was mentioning before uh secure uh Registries or apps Registries where you could actually cury uh let's say hey I want to use a defi protocol and I trust you know this audited companies and uh this kind of rating system and uh get me pleas it like you know good route to exchange my

e to the uh whatever token I need and the same way could apply to the app implementation app storage um the cool thing about that basically each part of these could be encapsulated its own like layers of security and then in between of those you could basically install a circuit breakers and whenever let's say you have a security provider who says like hey the app is not secure anymore it produces vulnerability uh it could just go to the app registry and you know just lower its rating bum gizer is safe um and in the same manner uh the user would be able to say hey I don't trust this register anymore it's too much centralized um and he could switch out

um yeah so this is kind of a concept um so thank you for uh your attention I really appreciate being here and uh if you have any uh questions if you want to collaborate please reach out to the email and um thank you [Applause]