Talk: Securing the Beacon Chain

Secureum Talks · 20:29

David Theodore, security researcher at the Ethereum Foundation, describes how the consensus layer security team protects the Beacon Chain ahead of the Merge. The talk explains why multi-client architecture and memory-safe languages change the threat model, why denial of service matters more than classic remote code execution, and how the team uses manual audits, differential fuzzing, automated Go harness generation, static analysis and network crawlers. A Q&A covers economic risks such as centralized stablecoin dependence.

Speakers

Topics

From Secureum Talks; community: Secureum.

Transcript

[Music] um hey guys david theodore um security researcher at the ethereum foundation been a security researcher for many many years um played with a lot of cool things but i think i'm in love with ethereum so i'm probably here to say um who am i dto.eth infosecule on twitter github reddit a lot of that stuff that's usually where you can find me if you need me

i'm focusing on the consensus layer i'm going to talk a little bit about the consistent layer team i'm going to talk a little bit about the work we do and how that kind of differs from the application and execution layer um and the stuff that's in scope and not uh i did do some malware at google as a security engineer i focused a ton on like applied crypto projects in the past a lot of distributed systems uh some of the same problem sets that we face today um some a lot different i did a lot of embedded re a lot of nade and native code reversing rf baseband stuff i have an electrical engineering educational background um yeah tor distributed systems blockchains these things are kind of always been on my roadmap and here i am getting to focus on them full time i'm really

excited to kind of see the blockchain ecosystem and especially ethereum evolve to where you can pay the bills with it and not just research it on the side so i love where we're going in this industry this is the who am i for the efcl security research team we're a team responsible for security research on all the beacon chain client implementations today i'm not going to talk a ton about like the spec design and the rationale security around proof of stake in that sense danny ryan will be on right after me and can can kind of touch on all that stuff it's a lot of stuff to kind of pack into a 16 minute presentation so i'm going to blow through these things questions at the end you can also just find me on twitter if you have anything

specific if it's a good public question just ask me publicly and i'll get back to you um focus on general merge security uh beyond just the implement the uh implementations we do some like crawler development stuff look at general beacon chain health much much more there's about 10 engineers on the team i'd say five are dedicated to the team a few are now that we're merging we've kind of merged in the el security team so a few guest people on the team we've got some cryptographic expertise someone defending their dissertation on properties of elliptic curves a lot of software security expertise uh other people also previously exploit developers in the defense industry so this is we've kind of got a i think a

check box near most of the critical talent we need and we're growing fast so if you're interested come talk to me as well our team has found and reported bugs in every cl client in some capacity and many of the execution layer clients we've picked on some clients a little bit more than others because of their critical dependencies uh client diversity which i'm sure we'll get talked about many times today was talked about a second ago and i'll talk about it a little bit um one thing i do want to say since this is a security audience i know there's probably a decent number of security researchers here kind of point out the differences here um what uh are the implications of the beacon chain right and so like how does this differ from a traditional target um we do have a multi-client architecture

so we don't have the uh the client diversity thing i think it's referred to as like software monoculture in other words uh in other words uh we don't have that issue to the same extent and we strive to potentially never have that issue in the future so we have um some other aspects here we have five clients um diversity is is getting better a lot of that has to do with institutional stakers there's some dependencies uh for things like insurance you might need like custodianship of keys to live off you need remote signers and some of the clients didn't support this previously so our major clients are all now supporting these things and so i i expect that we will see a better trend in the future um and and kind of hope for that um we do a lot of advocacy around this stuff and

i'm sure that you'll see that i won't talk too much about that right now um another thing that's interesting all of our clients are memory safe languages for the most part we do have some shared dependencies like bls that are native um we've gone through some formal verification for these types of things we consider them cryptocritical do manual code audits on that kind of stuff but like what does this mean for the traditional security research world um it means we're much like less likely to see memory corruption issues we're much less likely to see remote code execution like stack and heat buffer overflows are not very common at the same time the bar is a lot higher for us the traditional cve uh vulnerability scoring system the cvss is basically not good for us things like information disclosure and

remote code execution privilege escalation from an external attack surface are usually what's required to be considered critical in our case we really care about a denial of service so you can think of things like if there was um you know a denial of service and geth that means like the chain goes down right um at ethereum we kind of have prided ourselves on being resilient to ddos attacks in the past and as we introduce like certain new types of complexity with proof of stake we want to make sure that we don't lower that bar we do have a really high tvl 34 billion right now on the staking contract as like the price and the queue last night when i checked 500 plus billion if you include the market cap of ether and all the defy stuff i think it might be even 600 plus now

my team isn't necessarily focusing on that half of it uh in the meantime we're really just focusing on hammering out and testing these proof of state clients but we do have a responsibility to set the bar very high some of the things we're doing manual code audits i mentioned bls formal verification of bls things like lib p2p um are interesting because you can do like differential fuzzing so there's you know lib p2p isn't a shared dependency in the sense that it's the same code there's an implementation for the various languages but some of them are new um like nimbus has basically written their entire stack um like the go p2p libs are you know pretty hardened but there are some newer things like the gossip sub stuff is a lot newer so we really care about these things we do a lot of main review of

stuff like that um anytime we re introduce like new code that hasn't really been tested things like the sync committee functionality and altair that's like a whole bunch of new code that um you know we're like hey we probably should do manual reviews on this sometimes we pay for third-party audits for certain things like this but you know we try to kind of prioritize where we look for things buzzing obviously we do some fuzzing we have dedicated fuzzing infrastructure we hand out some contracts sigma prime has written some some beacon fuzz infrastructure stuff that's really cool we have this stuff uh running on massive uh cloud computing we've been donated some huge clusters from block daemon like 50 gigs of ram and 256 thread machines so

these things are fuzzing as we speak um it's really thankful we're super thankful for that um you know sometimes cloud stuff can can be expensive and sometimes we just get an extra a little gym dropped in our some of the things that we're doing especially majority clients looking at critical attack surface like rpc handlers what's interesting about having a multi-client architecture is that you don't just have to kind of like be resilient against bugs you have to be resilient against ambiguity in the spec so things like the fork transition they're very critical so we do differential fuzzing on things as well so um you know testing all five implementations at the same time with the same test case looking at where the states may diverge

things like this which is very interesting um we have uh some really cool ast based auto fuzz harness generation that will open sauce later probably in a month or two it's still finding bugs at the moment so we'll kind of hold off on there but i can speak a little bit about it it's pretty cool it's my like little baby project right now my brainchild uh basically built on the go parser library so you can think geth mev boost uh prism are kind of like our go clients it can look at the ast and and every single uh exported function it can kind of like extract what the function interface looks like so what what kind of arguments does it take and it can rely on the new go 1.18 basically supports this

release supports um fuzzing right in the testing library so it can make you can say i need a you know an n64 a string a a a slice of bytes whatever it may be and it can like intelligently know how to type these things the other cool thing is that uh you can grep down into this you know all the reachable code in in a source tree and you can say like hey i don't need to brute force you know a 20 character string i can just see every single place where a string is referenced further down this and i can actually bootstrap my test corporate that way i think in the future you can expect that the next iterations of the project would be like uh actually instrument the code run the code save test cases on all of the instrumented functions and kind of

bootstrap your corpora instantly and automatically with valid beacon blocks with valid uh transaction messages rpc requests and then you can do mutational based buzzing off that static analysis stuff we do some um vulnerability primitive scanning um i'm sure some of you have heard of codeql sim grep which is like very similar semantic repping error prone for java these things are looking for like common mistakes like uh is is it possible to get a negative value into the index of an array and just cause a panic um things like this that we can kind of integrate uh into the ci and and kind of watch um you know as soon as a bug is introduced like immediately get a report a lot of this stuff is not necessarily

like it can cause a lot of false positives but at the same time it's it's kind of like a thing to kind of help us follow our nose and know where to look um one of the other things that i didn't mention before about the difference between this and like previous uh security research targets i've had this is all open source so anytime you have a parser and almost every one of these languages is supported in some functionality um we have the ability to do things like this you can think of like even primitives where you have like a certain type of function like in the native world you could have you know uh memsat or or a mem copy and i want to find every place where the like length parameter of that call comes from the stack or something and so this kind of allows us

to write rules that sometimes we can be client agnostic and have a rule that kind of spans all of them um but sometimes we have to you know code ql doesn't like support um russ for instance so we have to you know find another thing like i believe sim grep does another thing we do we fund crawlers um nodewatch.io is one of them there's a few other we we track the crawler statistics we really care about things like diversity and a lot of people you know look at diversity and they're like oh prism prism prism to too much client diversity the dependency's too high but everybody's using linux right half these people are using aws so so looking at these crawlers and trying to you know determine

geoip dependencies um is everything running in a data center in berlin you know um is this a like an education a dot edu uh sub sub 16 subnet like things like this and and kind of say hey uh do we recognize this person is this an institutional staker that we know um and can call up on the phone and say hey we we have some recommendations for you um we analyze participation rates we analyze things like attestation timing anomalies uh i'm sure everybody knows proto he did some really cool stuff called beacon pixel where he basically like colors pixels based off of attestation latency so we can see things uh over time like entire data center is going down um maybe a deep sea

underwater cable was cut a few months ago maybe was maybe it wasn't we're not sure but we need to kind of be aware of these types of things um so yeah pretty cool stuff there um general network health wow four minutes i'm gonna start blowing through this guys uh network level simulation and testing this is pretty cool um one of the issues we have with distributed systems is that it's very difficult to fuzz them uh deep in their states so if we want to do something like fuzz the rpc interface um you know that's exposed to the network we have to like gut it out of the system and fuss it we have to like neuter the caches and things like you know remove places where there might actually be bugs hiding that we don't want to do that so how do we go about

getting these distributed very social programs um into environments where we can fuss them and so we we leveraged some third-party tools antithesis and kurtosis some of these platforms are really cool like antithesis has the ability to have a deterministic hypervisor at the network layer and i don't mean like the network like like osi model layer i mean like all of your vms can run on a local network without external dependencies so an entire beacon chain execution clients you know they go through the the whole deposit they make the they practice the merge and we can have determinism there so we can fuzz these things we can pause threads we can find race conditions this way um we can run fuzzers and have determinism and they can take snapshots and like rewind

and go back to find interesting states um stuff is really cool uh doing previously a lot of research on things like tor this was always a very difficult problem reproducibility you get a fuzzer going and reproducibility was like a pain previously you'd have to like save off that your last 50 or 150 fuzz test case seeds and hope you can reproduce it but things like race conditions you know it's it's not very deterministic so how do we find those so that's a lot of really cool stuff we do i think we are getting down to the two-minute line which is great because i got to this other effort slide if anybody has specific questions about things on here i can answer them but i will just blow through them pretty quickly another thing you can do is down at the bottom blog.ethereum.org there's a little bit of mention of all this

stuff we have the uh if you search secured um there's like a few blog posts that we've put out so far but yeah we do some third-party auditing we pay for like formal verification of the blfc libraries um i mentioned the client infrastructure diversity research we're potentially going to fund some more research that's more at the uh like dependency level so you can think of like client diversity where you know uh you're you're teku or bessu might have the like the log forge or log4j whatever you wanna what i know it's can be kind of debated what people like to call it um but yeah you could potentially like remove the library entirely we could put a different bls library in there and how do we like automate uh generating like a very robust and diverse uh

not monoculture based uh beacon chain client system we do a lot of merge thread analysis you know ask questions like do we need to rent a bunch of hash power in case the miners revolt up next to the merge obviously there's always fun uh when you're the biggest the biggest best chain in the room everybody likes to pick on you um yeah i'm not a maxi but you know i believe in what we're doing here um operational security there's a lot of like vitalik says by this token send me one each i'll send you two uh we have stuff like that so we pay some third parties to look at like instagram and and twitter and you know things like that uh i know that you guys have seen like all the bots that come if you just say metamask in a tweet you have all the friends in the world

you'll never be alone analyze your firewall logs and just say metamask on twitter it's instant friends um we do have a client security group basically this is like all of the l1 devs we get them together in a room if we see things like mistakes uh interpretations of the spec we make sure to cross-check other clients um you know when there might be like some small update like the uh the gossip sub limit is you know expanding we go actually do like main review checks of those um we also you know if if we do hear about a critical vulnerability coming on the pipeline we can bug uh bug our relationships with these guys directly and they've always been really great to work with future spec designs on the roadmap not so much previously our team's looking at spec in the future and

it looks like i am out of time right on the line does anybody have any questions [Applause] i don't think you guys are going to let me off that easy any questions for david thank you david so we do have uh four minutes for questions at the end and we're going to try as much as possible to leave it open because this is a discussion and the five minutes is really the only time we get for the audience here as well as on twitter to be asking questions to all

all the people attending yes sir would you mind would you mind just just so that people can hear would you mind coming to the center stage what's the coolest bug you have ever found uh we found a few like packets of death on majority clients they could bring the beacon chain down at one point in time we do have some some parts of our team that look outside of just the consensus layer ecosystem so ioav has found and released a blog post about um the ovm bugs that he found so you know fraud proofs that could make it possible to do a double spend on optimism things like that i imagine post merge the scope will kind of open up a

lot for our team so you can think of things like maker that are systemic um in the application layer l2s obviously are like a big deal if an l2 goes down like that could be a that could just destroy ethereum with all the tvl that they have but yeah i think uh one thing that we do see is it's really difficult to get an rce um in in these clients which is good because like lifting keys off of a off of a validator would be horrible um it would be difficult you know there is a different withdrawal key um than the the validator key but you could still grieve the validator like ransomware like hey i'll get you slashed unless you pay me kind of thing um so we we are robust against that but right now i think that uh the the big meat of what we found and what

keeps us up at night is all these denial of service vulnerabilities right any other questions i'll keep asking questions no one else does even if they're dumb um so i guess one question i had is and i missed half the talks maybe already talked about it but uh how far do you see like economic vulnerabilities like fall into the scope of like the security team versus like maybe other teams at ethereum that are thinking higher level like as an example what's the impact of uh like stable centralized stablecoin issuers on what

happens in a hard fork like stuff like that so that's absolutely something we care about um i'll put it this way there's not a protocol developer at the ef or adjacent to the ef working on ethereum that doesn't have an adversarial mindset so um one of the really cool things about this compared to uh like traditional security research is that cryptoeconomics and incentive design is like a pillar of the whole thing right the the code can be perfect and you can see things like this most recent bean exploit um if you don't design the the incentives right somebody could get a flash loan and basically like take over and change your your code um you know stable coin pegs fail things like that um i do think that

um on our road map is the critical dependency of centralized stablecoins so you know if there was a fork we're basically all gonna have to go with whatever uscc does right um you know maker would even have some vaults that might be insolvent so i think that um advocacy around this is important but for us specifically at least until the merge my team is like predominantly just like heads down in the implementation code for the the consensus layer clients and now you know we've kind of merged some with the guest team um definitely looking at geth geth is in scope it is such a critical dependency so yeah thank you great question by the way all right

thank you thanks david [Music]

Related talks