Security of Crosschain Transactions and Bridges

On the Security of Crosschain Transactions · 23 Nov 2022 · 1:36:46

Dr Ermyas Abebe gives an in-depth analysis of the security risks of the many types of bridges and crosschain protocols, then examines three bridge cases in detail: the Rainbow Bridge as a non-hack case, and the Ronin and Nomad hacks.

Speakers

Topics

From On the Security of Crosschain Transactions, hosted by Ethereum Engineering Group.

Transcript

hello and welcome everyone I'm Peter Robinson and today my co-worker Ernie sabibi or Dr Ernie sabibi is going to talk all about cross-change security so Ernest before you share your slides and kick off why don't you tell us a bit about yourself sure thanks Peter and thanks everyone for coming hello um Hermes I joined consensus uh about a year ago to work on crosstain Communications research before that I was with IBM research for about eight years or so the last four of which I was I used to lead the blockchain r d group

for the Australian lab my team and I were primarily focused on Enterprise blockchains so that's a little bit about me Okay cool so are you happy for us to ask tricky questions the whole way through or should we wait to the end what would you prefer yeah I think I think what I'll probably do is maybe pause in between um key sections to take questions uh but you know if there's anything burning please feel free to interrupt me along the way as well for sure all right well please share your slides okay all right can can you see my screen

yes awesome okay so thank you again uh you know for coming uh what I plan to do over the next hour or so is really talk about this broad topic of you know security of Crossing protocols here's a quick outline of my talk um what, I'll, do, is, you, know, start, off with a bit of background on what cross stream Protocols are why they matter what some of the key challenges in the space are at a very high level and then we'll talk a little bit more about security risks in the space and they're numerous right so we'll introduce a broad framework for how to think about this the different risks in the space specifically we'll introduce four layers

or categories of risk specifically Network risk architecture risk implementation and operation risk and we'll spend a fair bit of time looking at the different challenges and considerations in the space through this framework after that what I'll try to do is ground this a bit more through concrete case studies of hacks that have happened over recent over the past 12 months or so and specifically we look at you know that the hack that happened the attempted hack on Rainbow Bridge and the hack on Ronin and Nomad protocols and then finally I'll have a few concluding uh remarks so as you know one of the key realizations

we've come to collectively in this industry over the last couple of years or so is that the future is likely going to be multi-chain and what that means is that we'll likely have a number of different layer ones layer twos and beyond all with thriving ecosystems that are going to coexist and serve a range of different purposes and in this context is what we've seen cross stream protocols emerge as an important building block that essentially enables these different ecosystems and chains to seamlessly interact ideally in a manner that preserves some of the core tenants we we value in this space and so question protocols essentially

enable this seamless exchange of data and value across different chains and in doing so reduce the fragmentation that would otherwise arise from a multi-chain world right and they also enable scalability increase liquidity and overall improve market efficiency in this whole multi-chain world moreover I think there's a promise in which such protocols can enable and open up a whole new design space for how we think about natively cross chain applications and the whole new design space that could potentially unlock and this has clearly been realized by the broader space and this is somewhat evidenced partially by the value and

investment that we've kind of seen in the space if we look at the total value locked just in uh Bridges alone we'll see that late last year it reached almost 30 billion in total value mocked just on the ethereum side alone and that has somewhat declined with you know the the decline we have recently seen in the broader crypto industry but nevertheless the scale of what we're still what we still have in tvl around 6 billion still somewhat alludes to the significance of you know such infrastructure to enabling a multi-chain future moving forward and of course coinciding with this we've seen you know a number of different protocols emerge over a hundred or so the different uh projects in the space

that are all targeting different aspects of question communication protocols the flip side of this of course is all the security challenges we've been observing in in the space right so over the last 12 to 15 months alone we've seen around 2.5 billion stolen and in Bridge exploits you know for context that's around roughly two-thirds of all D5 more than two-thirds of of D5 exploits that we've observed in that space and on the right what you see is uh the the leaderboards the direct publishes of the of the range of hacks we've been observing in the defy space and you'll see that the bridge exploits

basically kind of dominate this list with almost 50 percent and the the actual value of that these hacks is astounding and somewhat significant on the left of the chart you see as from asari and the green spikes that you see dwarfing the the white ones are really the bridge exploits in terms of their scale and magnitude that we've observed of course an important point to note in the slide as well is the hacks that didn't happen right so we've noticed almost a billion in potential losses and vulnerabilities that have been disclosed by white hats and it's just a coincidence these were not really kind of caught by you know malicious actors otherwise the scale in which you know we

would have observed the losses in the space could have been much much bigger so it's it's clear that crosstream protocols you know have a significant role in the future of the web 3 space and it's very evident that there are significant security challenges that that are currently playing space and an obvious question to ask is why and here you know we'll start off with a cursory set of answers and then what we're going to do in the course of this talk is really kind of delve a bit more into some of these bullet points in in some depth as a start of course the question will be you know what would be the incentives to Target the space and the obvious one

is that there's significant value locked mostly in token bridges that back these these protocols um and we briefly alluded to that earlier when I mentioned that at its peak we had about 30 billion locked in ethereum alone right so there's significant value that really creates a Honeypot for hackers and in the technology itself what we can see is that there's a large attack surface and we'll explore this in a bit more depth the protocols generally introduce new trust assumptions which are a source of new and additional risk there's complexity in the environments the tools and Frameworks that need to be used given we're spanning different ecosystems and platforms some of which

are nascent and are not as well understood as say the evm for example we've also noticed that you know the practices employed by teams might not be as rigorous as we'd like right and there are a few examples of this that we'll go to in some level of depth so there are a range of reasons and challenges and really what we'd like to do in this talk is explore some of this in a bit more detail so the security risks I think as a starting point before we get there it might be useful to talk about what do we mean by crosstube protocols encrusting interaction at a high level you can think of all the the different types of Crossing

interactions that we have in these three abroad categories one is asset exchange and here what we're trying to do is enable two or more parties to swap assets across networks right I might have token a and network a you might have token B Network B and really what this uh such Proto such interaction involves is the exchange of my asset for years across these two networks for in a manner that is fair right the second is asset transfer and this essentially is the movement of the value that are represented by an asset from one network over to another and

essentially it could mean that I want to move eth from ethereum over to say Avalanche right and essentially we only want the value of that one if that I want to transfer existing and only one of these chains at any given time and we're trying to mimic the transfer of the value of that each across chains as opposed to you know actually moving the asset and lastly we have this broad category which is general purpose message passing across networks right and this enables a whole range of new applications beyond the two interaction patterns that we mentioned so you know to complement this I think it's worth thinking about uh The

Crossing protocols in this layered stack here essentially what we're trying to call out is that you know Crossing protocols really kind of serve different purposes and are not really a monolith it's worth thinking about these different layers and what they do and how they depend on each other at the bottom layer we have this idea of the mess of a messaging protocol and here this layer is really kind of responsible for the transfer of State information from one network to another how it's tested or validated and all the considerations around proofs associated with State that's communicated from one network to another a layer above that that you also see highlighted in blue which is here is coordination protocols is really any

additional orchestration you might want to do on top of such messaging right and this could be to ensure atomicity in in the inner in the in the interaction that happens across chains and one of the protocols that we've been working on in this team gpac is one such protocol on the left hand side you'll see at the bottom token Bridges and really what these enable is that the the transfer of value from one network to another on top of which we typically build liquidity networks that enable different entities to exchange assets right so as you'll notice from my description roughly in terms of how the interaction patterns or modalities on the left somewhat relate

to the the layered architecture view of costume protocols right might look something like this where the base layer we have this messaging protocol enabling a range of possible applications to be built on top of that token bridges that enable asset transfers and liquidity networks that essentially enable asset Exchange and it's worth of course acknowledging that there will be different variations to this it doesn't necessarily mean that all the copy D networks are kind of built into stack as an example so before talking a bit more about you know some of the security challenges it's good to probably start off by stating at

its Essence what what are some of the properties we're trying to achieve right as we noted you know what we're trying to do with cross stream protocols is really coordinate State change across networks and implicit is in this is you know at least two core properties that we're trying to to achieve one is that state we communicate from one network to another is valid and final according to the consensus rules in other protocol rules that are employed by The Source Network right so think of this as a safety property and the second is that all cross-chain state information that's communicated is done so in a timely manner and you can

think of this more broadly as aliveness a censorship resistance and so on concern right so these are Loosely stated on top of these of course we could have a number of additional properties that we care about for instance you can imagine that there might be cross-chain applications that introduce invariants in how things are supposed to be across chain or invariant in terms of the Integrity of state that needs to hold across change and that could be an additional property you layer on top of this but at its core these are the two properties we care about so you know with that in mind it's worth thinking about the different risks and categories of risk that kind of emerge uh when thinking about you know this the

space more abroad and here we call out you know four different categories of risk or layers of risk if you will um the most fundamental layer is the network risk you know as you know as you might have noticed in my in the in how I stated the core properties before essentially by by having Crossing protocols that are you know trying to coordinate data change exchange across networks we're making fundamental assumptions about the soundness and safety and liveness of the networks themselves right so that essentially can be a one source of risk as we'll see in a bit more detail uh later on top of that of course we have risks that relate to the architecture or the

design of the protocol itself different protocols will make different security it will have different security properties we'll have different trust assumptions and make different trade-offs and that can itself be a source of risks that need to be considered and mitigated following for that of course is implementation risk and a simple way to think about this is code risk though it could be broader right and here it's essentially in any risks that stem from you know the creation of of artifacts and code relating to to the protocol itself and lastly we have operational risk which is really risks that stem from how these Protocols are operated and managed

in typically such protocols involve a number of different viewing pieces you know by different managed by different actors so there's a whole large surface in which you know risk emerges into space as well and we'll see some of this through concrete examples so what I'll do over the next few minutes is really kind of delve into each of these in a bit more detail citing examples where irrelevant um before I go into Network risk I'll quickly pause to see if there are any questions thus far okay so Network risk you know as we briefly mentioned you know question protocols

enable the coordination of State across across networks and the Assumption here is that the underlying networks essentially kind of guarantee safety and finality of states right so they they couldn't essentially kind of guarantee that state that state that is correct and valid in one network someone continues to hold after its finalized as an example right and the consideration here is that if state is reverted in that Network after a period of time any corresponding changes that we might have applied on a sub on another Network on a destination Network as a result of that state that's reverted now ends up in a more in a consistent State Range this is

beyond the control boundaries of costume protocols themselves and you can imagine that such a reversion could happen for a range of reasons there could be protocol bugs and forks that cause reorgs or a 51 attack right and this is a fundamental limit to the the security guarantees The Crossing protocols can offer at least for independent networks right it's worth noting that indep in independent networks what we have is two separate sources of Truth whereas in something like a robot for instance where the source of Truth is really the underlying now one such reversions are less severe right you could imagine that

the roll-up itself kind of goes back in state because the other one has reverted as an example so this is certainly an important consideration and one that you know vitalik himself uh called out as potentially a fundamental limit to the space and Which shapes his outlook on on where he thinks you know a multi-chain future will evolve to what are some of the considerations that stem from this um obviously as as question Protocols are being constructed thinking through the likelihood that this could occur in smaller networks with weaker guarantees being much higher than say this happening on on ethereum as an example and also thinking about how mitigation

step what types of mitigations can be made to reduce the potential contagion of a small Network failing basically impacting subsequent networks that otherwise wouldn't have been impacted right so question protocols themselves can be vectors of such contagion so thinking through how Protocols are designed to at least mitigate that impact is going to be important and it's worth acknowledging that this is more systematic risk as opposed to idiosyncratic risk where essentially one network of you know failing in this manner basically impacts all bridges to and from that Network as an example a second category which will spend a

fair bit of time on is protocol architecture risk right and to delve into this in a bit more details worth again revisiting that layered stack that we we spoke about where at the bottom we have a messaging protocol that essentially enables State transfer uh and deals with all of the mechanisms around how that happens how state is kind of validated and taken to be true across networks as an example and what I'll do is you know at least talk about the messaging protocol and the token Bridge layer in a bit more detail starting more with you know the messaging protocol which I think is a foundational piece

foreign to Think Through the different architectures that emerge here at a very Broad and high level it's of course worth starting with this simplest scenario we could think of right and here the a good example of that is the early hash time law contracts right the original chair Nolan protocol in various iterations of that what such protocols allow you know two parties to do was essentially swap atomically swap one asset for another I might have token a on network on network a and you might have token B on network B we might agree on the terms of an exchange of chain which includes say you know how much time we went allow for

this exchange to play out and what the exchange rate will be as an example and then what I what we do is essentially kind of have contracts and both chains where we both lock our funds conditional on revealing the secret of some secret right and only one party would know what that secret is and as they reveal that secret on one chain to claim the assets of the counterparty the corresponding secret can be used by the party to essentially claim their corresponding assets on on uh on the other on the other network right these are somewhat well-studied protocols they're obvious Limited patients to it obviously they are primarily just for asset exchange

purposes they uh unfairly a disadvantaged one party which is known as the free option problem that we won't go into and the user experience in general in such protocols is not ideal so you know to do anything more meaningful we all of a sudden now have to actually transfer State information from one network to another where a destination Network now has to reason about the validity of that of state that it's received from another Network right and if you think of the most secure construction you can you can imagine one such one such model would be a state

validating Bridge right in this model what you have is a destination Network let's say Network B that receives state from Network a validates the state transitions corresponding to that state and independently verifies that any state that it receives is valid according to the uh to the rules of that protocol today the way we we the the scenario in which we have such protocols is really in the context of Roll-Ups right and you can imagine this in CK Roll-Ups are optimistic Roll-Ups that fall in this category and this is the most secure construction you can you can think of because each network is independently kind of verifying all it needs to about

the state and state transition associated with the underlying Network a bit less so is what we can categorize as consensus verifying Bridges and here what each network is doing is not really kind of validating State and State transition but rather at a high level verifying that consensus has been achieved in any block that it receives so in this scenario uh networks essentially kind of relay blocks amongst each other through the help of potential intermediaries and each Network can independently verify whether the blocket received or a block header that it's received has valid consensus according to the consensus rules of of the source

protocol that it received State from these introduce a number of challenges as we'll talk about a bit more or so A variation of uh consensus verifying bridges that are starting to emerge is what we call ZK bridges for now but essentially the idea here is that instead of having each Network verifying the consensus of another Network that that is somewhat done by off-chain pieces or off-chain components in zero knowledge and then validity proofs are are sent to the networks themselves to verify and this reduces some complexities introduces and other others that will as we'll see in in a bit so as

we delve into different architectures here essentially the slide is trying to capture you know what we can categorize as trustless mechanisms that you know weren't used somewhat Loosely um and we'll talk in a bit more detail the last two in this or the bottom two in this uh in this slide The Other Extreme you can imagine is of course trusted intermediary protocols right and it's worth starting with you know the extreme example of what might that might look like where essentially between two networks you have one designated centralized party that is responsible for attesting to State it's trusted on both sides of the network to

basically be the the Sayer of what's true according according on information that is being relayed across these two chains this is obvious limitations that I don't need to explain to this this audience particularly in the event of recent uh in recent events with uh FDX collapse as an example yeah so one thing to to highlight you know with external biodata Bridges as I'm showing them on the left where you have a single party this is sort of the model we use with exchanges today right so if you think about uh you know purchasing one asset sailing one of your assets from one network and purchasing another one and kind of you know the withdrawing if you will this is sort of the model we're

using today right so so this is obvious limitations if we decentralize that a little bit more what we have is you know what you see on the right here with external validator set Bridges and the idea is so much similar to the previous one except here we have a set of parties that attest to the validity of some State and the set of parties and the mechanism they use amongst themselves to have some honest majority is is what's trusted uh as the arbitrary another variation is what we call optimistic ridges and we'll delve into this in a bit more detail is an approach that essentially is similar to

optimistic Roll-Ups relies on optimistic mechanisms with fraud Windows to sense to kind of resolve any uh disputes about the validity of State the difference between say external validator Bridges and optimistic Bridges is that optimistic Bridges make an honest minority, assumption, as, opposed, to the honest majority Assumption of the validator set Bridges okay so I'll spend a bit more time going into uh at least four of these patterns that we've seen um because they're interesting interesting points of discussions and sources of risk to discuss and consider so the first one is you know consensus

verifying bridges that we lightly touched on right and in effect as we briefly mentioned the way such such protocols work is we have two networks that need to interact and communicate with each other we essentially have intermediaries that will take block headers from one network so it's called a source Network and relay it over to another Network which we can call a destination Network and what destination network does is really run a Lifeline protocol of the source Network it does some checks on a block header to see whether some notion of consensus has been achieved in the source Network as it relates to that

block you can imagine this to be for instance that it might check that sufficient proof of work has gone into a block it might check that you know a sync committee has attested to a block and so on right or some validator set a majority validator set to two-thirds validator said for example has a tested to a block and what's ideal about these about this approach is obviously it doesn't introduce new trust assumptions in intermediaries obviously we'll need components in between that relay block headers from one to the other but really those in those entities at best can censor transactions and not really affect whether we uh consider a state or a

block header as valid or not because a destination network is independently verified that but it's worth acknowledging that of course the destination network is not really performing a state validation it's not really checking to see that the transactions in a block are valid and as a result of this it inherits the same limitations like client Protocols of the network might have right and there are different attack scenarios to think about here like an eclipse attack where you might have you know uh a number of validators that you know collude to deceive a destination chain about the state effects as an example the Big Challenge about these approaches

of course is that you know they're costly they're complex to build and costly to maintain and operate as you can imagine what we need to kind of do is constantly relay blockheaders across chains and have this complex operation of verifying consensus implemented in smart contracts on both ends right this can be prohibitively expensive um which, is, a, big, part, of, why, we, don't see these Bridges we've been somewhat widespread as a pattern or this approach being widespread as a pattern and it's also worth of course noticing that you know it incurs continuous cost as, opposed, to cost, that's, dependent, on demand uh associated with cross chain

messaging um another consideration is because of the complexity of implementation of such Bridges it increases the likelihood of implementation risk which we'll touch on in a bit and a good example of that is some of the vulnerabilities that were you know found on the Rainbow Bridge or uh things associated with it that would have directly impacted the Rainbow Bridge itself um as I noted earlier A variation of this is the ZK Bridges which I think is a promising area of research installed in its nascent stages and the idea here is that it basically has the same

properties that we talked about in consensus verifying Bridges but instead of having the destination the the the different chains implementing logic to verify consensus in smart contracts which can be prohibitively expensive instead what we do is have opt-in components that generate validity proofs that consensus has been achieved on about for for some Source chain according to its consensus rules and then send over that proof to a destination chain to independently verify on its own and this you know has a number of advantages but inherits most of the limitations that I I mentioned about my client bridges in terms of cost

of operation even though we'd expect this to be less over time and optimized and to a large degree there's still significant costs associated with with such Bridges today but it's an interesting area of research and potentially could be um you know the the foundation of how we built bridges in the future so the next two patterns are external validator set bridge and optimistic Bridge which I'll talk about these two patterns broadly describe a majority of the bridges that we see uh in costume protocols that we see in this space and as we mentioned earlier you know with external validator set Bridges

essentially we have a set of parties that are trusted to test on the validity of State the assumption is you know that we have an honest majority from these set of parties and the reason why such bridges are such such approaches are quite popular is that they're relatively easy to build and reason about and cheap to operate right there are numerous variations in the details of how these things the these types of bridges work but at a high level you know you can have either proof of authority Bridges or proof of stake Bridges and the proof of authority really what you're trusting is that the uh the set of parties that are

permissioned to operate the the bridges validators essentially have their reputation at stake and there's there there's a possibility of legal recourse to these parties that would essentially serve as a deterrent from them acting against the against the protocol or acting maliciously there are a number of assumptions here right that might not hold true then and you're thinking through what that might look like in terms of the degree of decentralization the set of parties the mechanism they employ whether this notion of a proof of authority and you know the reputation being a significant deterrent are all of the questions that we need to ask

um especially in light of recent events the other approach is proof of stake and this is a bit more easier to reason about and essentially what it does is it has it essentially bakes into the protocol sticking in the game right so each per each entity in the in the validator set has some amount of value at stake that gets slashed if they misbehave there's a number of different Dynamics to consider here where say as an example of the value that they're staking is a bridge specific token with small liquidity not a lot of market demand and so on the price could widely fluctuate as an example when Bridge token I I looked up just yesterday had

kind of had gone down by about 95 percent in value and you can imagine how that would influence the economic assumptions and guarantees of uh the validator set of such Bridges there are numerous limitations that are of course somewhat apparent about this approach they introduced new significant significant new trust assumptions and the security implications that has the degree of decentralization uh is is often difficult to reason about and not very transparent uh in terms of how protocols communicate about you know what that validator looks like validator set looks like um and there are numerous limitations on the mechanisms that these protocols

employ and of course these validator sets you know can censor transactions they might have interests that don't necessarily align with users of these protocol and so this creates opportunities around front running and a number of other things and there's a bounded known cost for bribing you know these set of actors there often might be permissioned they might be known and um there's a you know bounded cost towards attacking this vertical a second approach of course is optimistic Bridges which we briefly touched on and the variation here is um that we're essentially kind of using an optimistic approach with fraud Windows what this means is that there's

often one or more trusted testers that attest to the validity of state and entities that relay any attestations from an updater about a statement in network a as an example and send it over to network B and that state is not immediately trusted instead you know we wait for some period of time the fraud window at which point any watch or entity or any entity that essentially is is responsible for keeping this whole protocol honest can dispute the validity of that state or report fraud right and the the security assumption the the security property this affords is that we can essentially rely on the existence

of phase one honest party which is a weaker assumption to make than say that an honest majority will will always ask act honestly an ideal construction of such protocols which is typically how most protocol teams communicate is to assume that you know the permit the washer set is permissionless Right which basically means that you can have on any number of Watchers that are observing this protocol that you might as an attacker might not know about a prior right but there are obvious challenges and limitations to enabling this that primarily comes from the fact that it's difficult to prove fraud on a destination chain unlike Roll-Ups and

there are different reasons for this and as we go into uh you know the case studies some of this will be apparent and other challenges incentivization of Watchers these are entities that are responsible for essentially detecting that a fraud has happened but they have to incur a bunch you know a significant amount of work up front to ensure the Integrity of state and to ensure that in a tester isn't misbehaving for the off chat that they might at some point get a reward for reporting fraud right um another consideration is that you know there are different griefing vectors primarily because we can't uh reason about whether a fraud report is is true or not and there are numerous

edge cases that you know such protocols need to consider around liveness failures of a destination chain if we're assuming things happen within a certain time window like fraud windows for instance failures and lightness in in one network and significantly uh influence how we think about the space um to finish off this section I'll go step higher layer higher and talk about token Bridges because I think doing so is important as these are you know Perpetual source of risk to to this broader space and token Bridges as you recall are this mechanism through which we enable transfer of value across Networks

a typical mechanism that's used to do this is where assets are locked on one chain and synthetic representations of those assets are minted on a destination chain what that basically means is that we now have an invariant right which is that the total amount of locked assets uh in a in a source network has to match any outstanding synthetic assets that exist across different chains that are backed by that Source asset and essentially those synthetic acids are a claim against the bridge right so what if this invariant so breaks over time either because a hack happens on one end or the other then this invariant

breaks and these tokens these synthetic tokens potentially become worthless um and, this, is, worth, considering, because any entity could hold those synthetic tokens you might never have used a bridge but might own one of these synthetic tokens which are not actively disclosed at times right that they are say one Bridges representation of of some asset but rather they're kind of called rap teeth you know in this network and you don't really know that it's backed by a specific Bridge right and that you're exposed to the risks of that bridge so if you're holding such a such a such a token even though you've never used the bridge and such a hack happens and the same variant that I mentioned breaks then essentially you're

exposed to having your assets being losing their value so it's a significant source of risk an additional consideration of course is that the fact that we lock these assets on the source Network creates this Honeypot that is the primary primary incentive for attackers to Target uh question protocols in general before we go to protocol implementation risk I'll pause here to take any questions because I think that was a fair bit yes it was and I'm not sure if anyone else is going to ask a question but I

will um so with those token Bridges and the synthetic assets the honey pot on the source chain um of all those locked assets is there an alternative you know is there a way of getting around this problem so you know because I can imagine if you had htlcs you know you wouldn't have the problem because then you're not linking a synthetic asset but then or are you not storing all the that value on the source chain as locked assets but um you know so is there an alternative yeah that's a good question um I think there are a couple of things

to consider there one is if you think of assets that have a known issuer right you can imagine usdc as an example right so usdc is you know as you know a stable coin backed by USD that were issued by Circle and basically pegged to the US dollar in such a case even though today quite a few protocols synthetically meant usdc on on networks you can imagine that over time going away where Circle itself natively issues these assets on these different networks so essentially you don't need to be you don't need to bridge those assets out from where

they're natively issued in order to have synthetic representations of them in destination that works right so that's that's what's narrative the second of course as you mentioned is uh where you might have these liquidity networks and asset exchange that might be able to address a number of these different use cases where you might not you know need to to bridge the asset out I I think that will you know address a number of use cases but I think because of some of the difficulty and how you can compose cross-chain uh interactions you know you might still want to you know take eth from ethereum have it as wrapped Ethan Solana and do a bunch of

things that are a lot more complex that make sense within that ecosystem that is a bit more difficult to do if you're you know if you just end up with ethon one network as an example right so so that's that's uh you know the set of considerations there does that make sense yeah it does yeah that sounds good so thank you no worries I have a question um are there any generic like interchange protocols um that are being implemented that you know of that are being implemented across different types of chains so basically coming up with a standard rest uh like a rest API or some type of um communication protocol that's very

generic so that way information can be trusted and sent across Networks yeah that's a good question um so I think there are probably two parts to that one is yeah you might recall in that layer diagram I showed like that bottom layer of the messaging protocol is sort of meant to capture this broad case where you're trying to essentially relay State across networks right um and so protocols that Target that layer are trying to do some of that right where they're basically trying to be this general purpose messaging layer that's relaying State and some of them do it at a much General level where they're essentially kind of relaying

just block headers and from there you can prove complex properties others are essentially a relaying specific messages that relate to the protocol itself on top of which a lot can be built the second part of your question is around standardization um and, there, are, efforts, in, the, eea, that uh Peter and others were driving around eventually in the space you know converging to standards that make interoperability possible and we're not quite there yet and um I, think, it's, probably, because, we're still early in this in this phase where we're kind of probably in this Divergent exploration phase before we kind of converge into standards around uh you

know patterns that make sense and apis and a layered stack you know with clear interaction patterns that that emerge and make sense does that answer your question yes it does thank you no excuse me can I jump in and ask a question sure sure um so would it be possible for you to rank these bridges in terms of Security First and cost second and how do they evolve over time so like you could consider between by like for example one Bridge could be considered as like a cosmos uh or there would be Roll-Ups or something like side chains and like if you could just rank them through examples it's

easier to like draw picture of uh what is contrast worthy in general yeah um you know that's an important consideration I think um and Layer Two LT beats team has been doing a fair bit of work trying to you know uh surface some of the considerations and how we think about the security and the risk of of some of these Bridges uh we've been doing some work with our partners around you know better understanding um and you know having a clearer view of the risks of different protocols and eventually getting to a state where we can hopefully kind of rate these different protocols based on uh security

and so on you'll notice that in my discussions I kind of left it very high level right where I'm talking about the different architecture patterns but the details there make a world of difference right so you can think of some of the architecture patterns in these two categories I I presented were trustless and you know protocols with trusted intermediaries and within those the way I laid them out at least on The Trestle side was roughly how you could think of um you, know, which, pattern, is, is, uh, more secure right but when you distill this down and kind of go into the individual protocols the details will make a world

of difference um but that's work teams like LTE beats you know soccer Nephi and a few other of our partners uh are doing and that you know that we're kind of collaborating with them on yeah thank you uh though my uh my question was like for example uh in case of roll ups uh it's the roll-up team which basically does one implementation of bridge and which is okay like they could be like uh one source of truth but when you take for example polygon uh it has like three or four different Bridges and maybe they could be like way around like maybe they are bridge to binance and maybe they are bridge to Cosmos and there's like a plethora of different

Bridges which makes it more complex to like gain like a normal understanding of what assets goes where and how it's like loan cloned and cloned again no yeah that's a bit more yeah I I agree um I I think kind of trying to more uh you know better reason about these different bridges that all service the same network I think is important it's different it's a bit difficult in in a polygon's case as opposed to say you know with a roll-up native Bridge right where you can you know clearly reason about you know the bridge itself a native Bridge being a lot more secure that's slightly different in the case of

polygon um but, you, know, keep, in, mind, that, really just speaks to the architecture risk that we just covered but then there's implementation risk and operational risk um which will you know we'll get to it in a second thanks no worries so protocol implementation risk um so you know here essentially it's somewhat straightforward the risk here is that question Protocols are complex infrastructure right with numerous components different moving Parts some of these components operated and you know managed by different

entities uh the components you know are not just on-chain and off chain but you know Target different environments and you know use different tools and Frameworks right so the likelihood of bugs occurring and as a result of you know basically uh implementation risk is somewhat significant and you could have protocols I think it's worth underscoring that you can have protocols that have you know sound robust architectures and security properties but still have significant implementation risk and this goes to the question we you know we just uh discussed a second ago and implementation risk of course is exacerbated in environments where you

have you know nascent tools and runtimes new networks and protocols that might not be as tried and tested or that people might not be as familiar with you know as say the evm as an example um you know there are some mitigations here um and you know this list is far from complete and there's work we're doing to really expand and be comprehensive on this in a risk framework that we're building with a few of our partners that I'll talk about at the end of this talk um but you know some of the things you can consider here are you know formal verification of of key contract of contracts as an example right and our trusted smart contracts team might might

have a thing or two to to add to that um there, are, other, practices, of, course like you know High coverage and testing whether that's you know unit and fuzzing and fuzzing and property-based testing integration tests and we'll see examples in our case study of one protocol that probably could have done a bit more of this where you know the bug could have been caught if they say for example had tested against production data you know had the same tests but tested against production data um frequent audits help but it's worth knowing that audit drifts happen where you know what's deployed versus what's audited might not exactly match you know there might be a Delta that can be a source of significant risk and of course

audits don't capture everything um the, caliber, and, experience, of, a development team matters um unfortunately the examples I'm going to use to make some of the case around implementation risk is where the team is really well known really great and capable more than capable by by all accounts but you know obviously considering the call burning experience of a team is is a key as a key point and Bug bounties certainly help in enabling you know honest actors to report such vulnerabilities before they're discovered by malicious actors examples of these uh you know over the past 12 months or so to call out or of

course you know these four ones and there are many um what I'm calling out here is anything above 100 million um and you know the poly Network for instance you know Peter has done a talk on this in uh on in the same Forum that you know you can refer to the Wormhole hack um and BNB Bridge are examples in which you know attacker was able to spoof you know the validator signatures right so basically both these bridges are external validators that Bridges and the vulnerabilities that were discovered in the bridge essentially enabled an attacker to to spoof uh you know validator signatures and The Nomad Bridge is a logic bug that uh you know essentially enabled an attacker to

validate arbitrary messages uh they could by bypassing the validation process all together uh and was able to steal funds now these are things we know about but I wanted to call out the things we might you know you might not ever heard of and these are vulnerabilities that were disclosed through bug palpees and I'm specifically kind of selecting these three examples because if we just looked at the architecture uh using the lens you know we we spoke about a few minutes ago these three Bridges would really like rank as you know more secure you know and trustless right so arbitrum as you all know is

um you know an optimistic roll-up the rigid employs its native Bridge is a state validating bridge but recently vulnerability was discovered that would have enabled uh an attacker to essentially hijack the bridge contract itself what that would have been able to attack her to do is basically take any incoming deposits into the arbitrant bridge and and stealing those funds a gauge of how much could have been lost in such a scenario is what you know one way to look at that is the average deposits per day which is around 5000 each or to look at you know the largest recorded deposit uh observed in on this bridge which is around 250 million

dollars or 168. uh a thousand people right the white hat that reported this got a a very decent Bounty but this could have played out very differently and it's worth considering right even though the bridge is secure by Design at least just looking at the architecture implementation risk is an important consideration Rainbow Bridge is a consensus validating bridge and earlier we mentioned how such you know bridges are the trustless and secure and so on but you know three different vulnerabilities were discovered over the last over this year and at least one of them could have resulted in a 240 million dollar hack uh

on this bridge and lastly on Cosmos IBC you know critical vulnerability was discovered that could have impacted all Cosmos IBC chains and the impact of that I think is uh is is somewhat self-evident the takeaway from from this is that you know protocol implementation risk is perhaps the most significant source of risk that we're observing to date you know quite a lot of this is evident from evidence evidenced from you know the hacks that we're seeing but fortunately there, are, a number, of, different vulnerabilities that are also being reported by white hats that are mitigating some of the impacts this could cause in the broader space critical operational risk

um so this is somewhat self-explanatory as I mentioned earlier requesting protocols have numerous components off-chain pieces and on chain pieces operated by different actors admins that have special privileges to change parameters of these Bridges and a number of other considerations and the practices and processes and mechanisms that are employed to ensure you know that all of these pieces operate as expected and are secure is a critical consideration uh in in the operational risk right so how keys are managed the how you know external validators are kept secure as an example right and we'll see examples in our case

study of failures in in this uh and this type of risk so um you know the existence of such privileged parties like Bridge admins and external validators you know consistently poses risks upgradability of contracts is another consideration as it can introduce you know how that's done and what it introduces could create new sources of risk that need to be uh to carefully thought of some of the mitigations are you know to have robust decentralized and transparent mechanisms and processes um for ensuring that you know such Bridge operations are carried out in a secure way that there's Clarity in how

they're done and you know how they're managed um monitoring capabilities to ensure that things that we don't expect like being very anti-talkular about in token Bridges right the total Supply logged on one end should match all outstanding on another end these types of monitoring capabilities become critical right to ensure operational safety but at a minimum monitoring to ensure anomalous activities like very obviously anomalous activities are important an example of where that failed that we'll look at in a bit more detail is the Ronin hack where the hack itself where the token Bridge was drained to funds was not

detected for six days and the only time it was detected was when a user asked for their funds and and the bridge wasn't working um you, know, having, established, practices and playbooks on how to do Incident Management and responses critical and we'll see an example of where that could have been done better and you know Standard Security best practices that we employ everyone else I think and ensuring that that is is maintained and off-chain systems and key management practices and so on are are critical pieces in ensuring operational safety uh safety so what I want to do next is look at case studies where we look at Three Bridges before I do I'll pause for any

questions at what point does um uh programming language um or the type of implementation done by the team play into the security vulnerabilities that are um uh that have been found across some of these texts yeah good question so that was in the protocol implementation risk section that I discussed right so implementation risk you know the way to think about it is really as code risk I mean it's a simplified way of thinking about it um and you know things that relate to uh

you know as a smart contract bugs issues and dependencies that you know different components have and maybe vulnerabilities and those dependencies are not necessarily in the in the code that you know the the relating to the protocol itself all of those considerations fall in this in this category of uh uh protocol implementation risk does that answer your question it does and did um do you see that being the biggest factor in terms of oh or how does it uh how does it weigh in terms of other types of vulnerabilities yeah at the moment it's the biggest

source of risk so the two big sources of risk in costume protocols today are implementation and operational risk and most of the failures that we've observed over the last year or two are really kind of attributable mostly in part to implementation and operational risk and a few slides ago you know when I was going through um the, four, different, hacks, like, you know poly Network BNB Wormhole Nomad and then also talking about you know the uh vulnerabilities that were discovered in arbitrum um rainbow, and, others, those, were, all examples of implementation risk um in these case studies that we're going to go through next I'll try to

make that a bit more Concrete where we you know through talking through specific hacks or attempted hacks we can kind of get a better sense of how that framework you know kind of someone translates into these concrete cases sure thank you no worries yeah so one of the issues you noted was that um I, think, it, was, the, um Ronin, one, they didn't even notice for a week because they weren't monitoring their systems um or one of them in importance I'm sure they had some monitoring but they didn't want to drink a bridge to make sure that you know

um the liquid the value on each side matched do you think that's a common problem um that there's not enough active monitoring of bridges to make sure things aren't happening and you know thus being able to stop them halfway through if something yeah that's a good question um you, know, what, my, hope, would, be, that these hacks we've seen over the last year or so have been a learning experience for different teams right and whatever monitoring practices teams might have had a couple of years ago is probably the very different today hopefully by learning from the failures of others

um we can see evidence that teams are monitoring based on say as an example the Rainbow Bridge attempted hack where you know the the team was quickly across you know the the attacker trying to do something and they they didn't have to do anything to prevent it but you know they're actively communicating what the attacker tried to do how it failed and so on and so they had monitoring capabilities beyond that it's it's um it's hard to say whether all teams are doing it uh uh you know consistently because this is you know their operational practices that might not be actively disclosed and so on even though now we've started to see teams more vocally speaking about you know the kind of monitoring they do uh an early

detection systems that they might have in place to kind of detect uh potential anomalous Behavior I imagine this will mature over time um yeah does that answer your question uh yes it does so thank you excuse me yeah um that's, a, very, cool, product, which, is called phota F4 RTA which kind of um spans across the entire blockchain activity and kind of kind of flags different kind of risks in general so I think it's a good one to look at what's it called foreign um okay, I'll, just, read, it, out, for, you, so

I think uh they pretty much flag the risks in different colors so maybe yellow is like a medium red is a high risk environment and maybe they enable Smart contract risk um any any developer kind of risks so maybe implementation risk could be one of them uh this is one I came came across a year ago and it was a pretty good product um good to look at I think they now I'm opening this side and they have flagged a couple of hacks um in, retrospect, which, occurred, after that right right yeah that's definitely something worth looking at um I guess Peter's question was more about you know active transactions

happening across both networks and detecting anomalous behavior in real time I think if this tool somewhat helps teams do so some of that I think would be quite valuable um another challenge I think um you know specifically with something like multi-chain for instance where you know if what you want to do is observe this invariant around token bridges that we spoke about earlier where you know the total amount locked matches all outstanding synthetic assets across networks how a team manages you know where those locked funds are stored versus how they might be distributed and so on makes that some of that monitoring a bit more difficult there's a recent

threat you know thread between the L2 beats team and multi-chain trying to discuss of tracing multi-chain funds for instance so uh you know having transparency in how some of that works might make a monitoring uh possible not just for the teams themselves but external entities that have a stake in you know the the proper operation of bridge so um in the interest of time I'll move on uh to our case studies and there's a fair bit to cover here so I think I might move quite fast basically in case studies I want to you know look at three uh three incidents um the first one of the Rainbow Bridge

is really an example in which the architecture and the design of a protocol served its intended purpose in detecting an attempted hack right so this is a good example of where the design of a protocol is demonstrated to function really well the Ronin Bridge hack is an example in which you know the architectural assumptions and the security assumptions of a protocol fail but also other operational you know failures that occurred that resulted in this hack and the team has learned a fair bit uh from from that incident uh you know in their road to recovery

and lastly The Nomad protocol which we'll delve into in a bit more detail is primarily an implementation risk but it has an element of an operational risk as well and I'll delve into some code and give you a better sense of that that in a bit more detail okay so a Rainbow Bridge um basically had two hack attempts or this year one in May and another one in August to understand this I think it's worth talking about the Rainbow Bridge itself and what it is the river bridge is a bridge between ethereum and near and the Aurora networks it launched uh you know last year it has significant value that is

Trent that transacts across that Ridge with over 220 billion since its launch that number is probably a lot higher now this this uh this number is a couple of months old and most of the activity it kind of involves you know uh the token Bridge a token bridge where assets are locked on the ethereum side and minted on near uh and the bridge Itself by Design kind of employs a combination of a consensus verification bridge and an optimistic mechanism um and I'll talk a little bit about how that works the ethereum to near side performs a consensus verification Bridge or as the near near to ethereum site is is an

optimistic mechanism um here's a an illustration of what that looks like um so on this side you know we have the ethereum blockchain and here at the near blockchain and the way this protocol essentially works is for uh for blocks that come from ethereum to near there's an ethereum like clientele near that basically kind of ensures that you know verifies fash ensures there's sufficient proof of work and does a consensus verification if you will or a like client header verification of any block that comes from from ethereum over to near right so they've the team has implemented that Lifeline capability as

a contract on meter the reverse site however would prove to be very expensive to do right so near validator signatures are et25519 signatures implementing the verification of all those signatures of blocks of blog on blockheaders that come from near would prove very difficult so instead what the team does uh or what this protocol does is it has an optimistic verification mechanism where blocks block headers are relayed from near to from from near over to ethereum and over a 16-hour window fraud can be reported right so it's a slower path and if fraud is reported

anyone can essentially dispute a very specific signature saying this signature is not valid or not from a validator it is known and the protocol itself can the contract itself can verify that signature right so it's a cost saving measure that still kind of does consensus verification but in an optimistic way okay and so the hack that was attempted on both occasions looked something like this where in in this protocol these actors that you know are in between that are shuttling blocks back and forth are called relayers and anybody can stake some amount of money

to become a relayer it's not a permissioned uh activity or not a permissioned role and anyone can essentially serve as a watchdog where they notice any fraud that might happen that might be happening and can essentially contest a particular block during that fraud window and with an attacker would attackers tried to do in both occasions was to first become a relayer by depositing some amount of money in this case 5e constructing an invalid near block and then sending it over to ethereum and in both cases Watchdogs immediately or these Watchers immediately kind of

detected that this block was was fraudulent and contested it right away right and within four minutes even though the allowed front with fraud window is uh 16 hours what is interesting is that in both cases the Watchers which you'd expect to be rewarded for for this were front run by Meb Bots right that basically detected that a washer a washer is report reporting some some uh fraud and would get compensated as a result so Mev Bots basically kind of constructed their own transactions that front-run the Watchers the end result is that you know an Mev bot is compensated but the Watcher that did all the work of

ensuring um you know state was ensure all the verification it needed to do to ensure that you know state is valid and uh detecting the fraud did not get any compensation those learnings from this Beyond you of course you know this is an example in which the design of a protocol worked well is um you, know, the, Mev, situation, and, the incentivization of Watchdogs now the team argues that the front running is not an issue because you know in a scenario in which you have fraud happening on a on a network you want to incentivize the market to report this as fast as possible and if Mev Bots are the

way to do that then that should be uh you know something that is utilized as opposed to something that's considered a defect in their protocol the issue I think that will probably surface over time is how you incentivize Watchers which are entities that need to do a whole lot of work up front and potentially never get compensated for it um there, are, a number, of, mitigation, things that could be considered but you know um these are active and things to consider for optimistic protocols in general the second one is around Browning Bridge um so this is one of the biggest hacks that you know that has happened in the device space so it's worth discussing

and it's a failure both in the security assumptions of a protocol but also the operational uh scenarios at a high level you know the Ronin bridge is really a bridge between uh ethereum and Ronin which is a side chain for the axi Infinity game which is a play to earn game um the bridge basically kind of custodies uh or locks Ethan usdc and mints on ethereum and mince it on on Ronin the bridge generally has is an external validator Bridge with nine validators and five of which are required to attest to any block before it's relayed between ethereum and and

running and the company behind actually Infinity Sky Mavis apparently owned four of the nine validators and had a special arrangement with a fifth validator that basically allowed it to to decide allowed it to sign transactions on on the behalf of another validator so needless to say this is this becomes a scenario in which you know the assumption that you have nine independent validators five of which agreeing to something is sufficient to secure the bridge doesn't really hold because you have in effect one party uh owning five of nine signatures

so the way this played out is that an attacker you know did a spear phishing attack on an employee to gain uh access to their I.T systems to Skype mavis's I.T systems and directly compromised into control of four of the validators uh of the sky Mavis validators and used a special Arrangement that Sky Mavis had with axi Dao to essentially kind of have a back door onto this Fifth validator and once they're able to do that they had you know the relevant set of signatures the relevant the threshold and the majority to basically sign any messages that enabled them to essentially steal 624 million on 23rd of March which was

you know a significant significant event what's interesting is you know as we noted earlier the hack was not detected for about a week um and you know that that highlights some interesting properties I'll do a quick aside before we kind of go back into the details of the hack itself to talk about you know some of the work that went into um laundering These funds by the attacker first thing is you know the attacker the attackers basically tried to take these funds through exchanges presumably through fraudulent kyc on these exchanges exchanges obviously kind of moved to blocking those funds and the attackers then moved on to kind

of using tornado cash to launder the money but ofac you know the office of foreign controls basically started to sanction these specific addresses uh associated with this hack the reason is because the entity behind this hack was apparently you know the Lazarus Group which is a nation-state funded uh group from the North Koreans by that's funded by the North Korean state um so here you know a game of whack-a-mole started to emerge where you know oh fact would sanction specific addresses but the hackers would essentially kind of move funds to different addresses and then to tornado cash

um after a few attempts of this basically what tornado what the ofak did was to sanction tornado cash altogether because sanctioning independent addresses wasn't particularly working so what's interesting about this is it provides a bit of context to how you know this tornado cash sanctions played out it was this is wasn't the only incidence but the fact that you could have an organized sophisticated nation-state actor uh you know mounting attack on such protocols and then the regulatory action that kind of follows offers a bit more context on how to think about you know the seriousness of security and such protocols and their impact into the broader space um in the interest of time I'll kind of

skip you know through uh through most of this but basically the learnings for the team was you know to obviously have a lot more processes and practices in you know how they secure their validators increasing decentralization hopefully by independent entities and how that's managed um they, went, through, rigorous, audits which uncovered other vulnerabilities and that's you know worth noting as well right that um you, know, there, were, other, things, that probably weren't that could have been sources of of risk and subsequent uh hacks in the space so the lessons from our perspective you know from a architecture perspective if we're going to have you know external

validator sets and you know talk about the set of validators and how large it is and how difficult it might be to compromise that you know of some Quorum of a validators really understanding the true level of decentralization and having transparency around that I think becomes critical employing good and clear robust operational security practices and how off-chain components are are secured I think is critical and of course monitoring right so as as we've touched on a fair bit um I'll, move, on, to, the, Nomad, Bridge, hack but this is going to be a bit more of a deeper dive into the details of the implementation of nomad at some point so

I want to pause to see if there are any questions and I know we've been going on for some time so I'll try and move fast okay so I think it's all all good and Miss keep it up okay okay so the Nomad Bridge hack is an example I think where you know there are of an implementation risk in an operational risk so what is Nomads you know Nomad is an optimistic protocol for arbitrary messaging across a number of chains it has you know bi-directional communication between ethereum

um Moonbeam and Moss appalachianosis chain in the Comedia um the project differentiated itself through you know being primarily security focused right and you know on the right what you see is you know the fact that you know they kind of highlight the team highlighted that a fair bit including quotes you know that basically say that we're secure and and the reason I I'm mentioning this is not the kind of you know highlight of failure in this but that if we're just looking at architecture the optimistic approach that Nomad had I think these statements might not might make a fair bit of sense but when we consider you know the other categories of risk we

discussed you know implementation of operational risk that's somewhat pervasive across all networks and you know getting a degree of confidence about such infrastructure in the presence of you know these multi-faceted risks I think becomes challenging and worth appreciating so the bridge launched you know earlier this year um and you know to understand you know what exactly you know the Nomad is specifically relating it to the per to the layered stack that we talked talked about earlier it's really this base layer with an optimistic mechanism but it also has a token bridge on top of that in which that enables you know the transfer of assets from one of those to

from one network to any of those other connected networks we mentioned a couple of slides ago at its peak you know the bridge had about 200 million dollars in uh locked in on the ethereum side and on first of August you know this severe decline that you basically see is the funds from the token breach being drained so let's you know to understand and appreciate the subtlety of the bug that caused you know this issue I think it's worth looking at you know the high level architecture of of nomad first and then kind of delving into into the code at a high level you know the

architecture kind of con consists of off-chain components and on-ching components we have this notion of an updater which will sound familiar you know uh which is the entity that's responsible for a testing to messages and the validity of messages we have three layers that are responsible for shuttling messages from one chain to another and Watchers that are the entities that are responsible for reporting fraud and on the right side we have this notion of a home replica on any origin chain where a message is originate from a replica which is a contract on a destination chain that is responsible for essentially managing incoming messages and of course this token Bridge

which has that lock mint semantics that we we spoke about a quick um view of you know what that might look like right so from an architecture perspective here I have an origin chain here I have a destination chain basically that home contract I spoke about which is you know which exists on on that origin chain that is sending messages and a replica that is you know a contract on the destination chain and those off-chain actors that we spoke about when a user tries to deposit funds to a token Bridge essentially what happens is some dispatch messages sent to this home contract which essentially builds and

maintains a Merkle tree of messages that are outgoing from this chain American route is updated every time new messages are you know come into this home contract that are destined for a destination chain and after a period of time this entity which is an updater which listens to events of you know the Mercury being updated signs one of these Merkel routes and attests to it from there a relayer basically takes the tested numerical route sends it over to a replica which essentially kind of maintains this new route and starts a timer if you will Watchers can report fraud at this point to basically say that you know that that

route this new route that was received doesn't sound right maybe the updators trying to equivocate or something is wrong right and so they can essentially report fraud um once that window expires a user that wants to essentially get a corresponding assetmented calls the replica contract proving that they deposited on the source Chain by using whatever the numerical root is that is now considered valid and from there essentially new assets are minted and sent over to the user needless to say you know I'm showing a simplified example of two networks but as you can imagine your information from

one home contract goes into multiple different chains some of which uh We've mentioned we've listed out earlier so what are the interesting pieces of code well uh you know on the home side you have this idea of a dispatch right when messages are sent and this is this this snippet is Just for information purposes to give you a to kind of ground the mental image we spoke about earlier but on the dispatch function essentially what we have is a message is added to the Merkle root and added to the queue and eventually you know I tested to buy an updater and sent over foreign side is where the interesting pieces

start to come in um and here essentially we have an update function which is what a relayer will call when they're you know communicating this new route over to this replica they're basically saying an update or has attested to this mute root and you know sending it over to the replica to now kind of start you know the timer if you will uh for that new route and once that elapses you know anyone can call this function which is proven process and as the name implies it does it tries to do two things one is it proves any message you give it against the the latest route that it has and second it does whatever action is

associated with that message if the action is to you know mint a new token because this needs to be sent to a token Bridge which knows to process that message and into corresponding that essentially happens uh through this proven process and this is the interesting piece of code we'll delve into in a bit more so um here you'll see proven process which calls a number of different things one is you know the proof as we said it kind of has two pieces The Proven process there's the proof function and the process function and both of these somewhat rely on this acceptable route right which basically tries to see is this a valid root or not right

um so let's let's look at that in a bit more detail you know what the proof does basically is to see if this proof is valid associate this message with Note the associated root and the process side what we do is check to see that the given message is valid against a root and of course uh process the associated message an acceptable route here is something that basically checks to see that the route that we have you know has is now considered uh you know past its fraud window and it's a valid route that we know about so in terms of the sequence of flow that

you can imagine just using those same functions we've been talking about you can imagine an update here where a new route is submitted that the R2 and a new fraud window is started after a period of time someone could call proof on some new message using that Roots right through this proof function and then lastly you can call process right so this basically breaks up that proven process into two separate functions this is just for clarity but for our purposes uh it doesn't matter as much so the process function basically tries to do this except acceptable route which both of these functions depend on right and this is responsible for determining

whether the route that we're validating against is valid or not it's before we go into the specific hack it's worth looking at scripts you know that are associated with this implementation and here we have a deployment script that essentially deploys these different contracts the home contract and the replica contract in this script you know makes sense basically what it's trying to do is it says when you deploy the replica contract and the home replica it might not make as much sense to have the replica prove roots that have been proven in the past before and so instead what it does is it takes whatever is exists in the home root contract and

says okay let's bootstrap the replica contract with this route as a valid route as a starting point which makes sense it reduces you know the overheads associated with the replica contract and bootstrapping it every time we upgrade the problem Starts Here Right Where in the first instance where you're deploying the home and replica contract the root of the home contract the Merkle root of the home contract is essentially empty and what that means is as we're initializing the replica this confirm Act and the committed root that we're using is essentially zero because the committed root is whatever root exists

we assume exists in the home contract but given it's a fresh deployment of the home contract this committed rate is essentially zero so we now have a state in which this could this replica contract has been bootstrapped with confirm at zero being a valid uh a valid uh writ what are the impacts of this well looking at the replica contract again the process and acceptable route essentially what happens is when we call process to process some message and in this case let's assume it's an invalid message we have this check here that's our sanity check right is this an acceptable route

basically what that does is calls acceptable route with messages you know trying to essentially retrieve whether you know this message has an Associated route with it because we've proven it in the past and what happens is you know when we're trying to do retrieve a map with an invalid message that we haven't seen before you know basically solidity will kind of take the default null value and now we're going to do an acceptable zero logically you'd expect this wouldn't you know be a valid route but for the reason that we noted earlier where zero has now been included as a valid root that has already been confirmed and can be processed we end up in a scenario in which any invalid message can

essentially be reprocessed it's not hard to imagine how this could be exploited you know an attacker basically constructed arbitrary messages that you know um that kind of basically said that it minted it it's burned the corresponding set of assets on a destination change the essentially the synthetic acids and so was entitled to claiming the locked assets on the source Network and through that process basically stole funds uh in on ethereum which are where where the assets were locked um very, briefly, you, know, how, this, played out you know the code was was audited by uh Quan stamp

and you know there are a few findings the team tried to address the findings associated with you know that audit report and in doing so made a few extensive changes that weren't re-reviewed, or, re-audited, by, by constant right so as far as concept is concerned it wasn't really in scope you know these changes that were done to address uh the findings and From nomad's perspective you know these post remediation uh changes were a part of the audit where part of what they expected would be audited nevertheless like the changes were a bit more notable and extensive and so you know kind of introduced the scenario in which this logic bug someone

you know came into existence as a result of addressing um the audit findings why didn't tests catch these well they're obviously a number of tests in in the code but the issue was that none of them kind of test against what a replica contract has been initialized with right it doesn't test against a fork of of the mainnet data or for the production data which means that the unit tests and integration tests that existed basically couldn't catch this um I'll, skip, how, you, know, details, about how they hack unfolded um it's just this aspect of it I think is quite interesting in the sense that unlike other hacks we didn't just have

the attackers you know kind of taking the funds but a whole slew of factors over 100 entities you know parties that basically exploited this vulnerability just because of how easy it was to you know copy the the existing transactions that exploited it with a few modifications and kind of do the same thing the outside of that was that if you white hat hackers uh did participate in order to kind of recover the funds um so you know the learnings I think you know in terms of incident response I think uh there wasn't a pause function associated with the process function and this was called

out in the Audits and that could have been done better and the incident response overall could have been uh much better so which leads us to the lessons and takeaways integration testing and testing overall and coverage is critical monitoring again as we said is is a key Point um having clearly defined incident response plan and the ability to pause a bridge I think is is is really important and audits you know this is somewhat obvious to say but audits are you know are limited in scope uh they don't necessarily find everything they don't necessarily evaluate all aspects of this complex infrastructure and so a lot can be missed and there is Snapshot in time

right so these drifts in audits which we touched on earlier can be a source of unassessed risk okay so I will conclude with a few remarks you know basically that you know having secure a decentralized and robust costume Protocols are critical for enabling this multi-chain future we spoke of and designing and building and operating such protocols is is difficult and there are numerous risks that are multifaceted um there are limits to what these protocols can guarantee and this relates to the network risk that we spoke about and even though today what we're observing is a lot of implementation and

operational risks and failures that stem from that over time some of that will mature and the architecture Network risks will probably start to become a lot more prominent concerns we need to think about and this is an exciting space to build and research and if you're interested I I'd encourage you to look into it a bit more uh acknowledgments to Peter for all his feedback and insight and to the range of teams that are doing amazing work and and research and Analysis in this space any questions yeah I think congratulations as we have

some claps that I think that that's certainly in order and um yeah I don't know maybe we're all questioned out because we've all already asked questions no worries um I know this took a fair bit of the times I thank you all for for attending I appreciate it yeah and what I suggest is if people um think of questions like or of people who are watching this on YouTube have questions just post them into the chat um or the comments rather on the video I think that's the way to go all right um yeah so thank you very much um yes and see you all next week for next week's talk bye-bye thank you bye

Related talks