[BUIDL Asia 2024 Builder Stage] ZK tech is more dangerous than you think by Brian Pak

BUIDL Asia 2024 · March 2024 · 22:33

Brian Pak, CEO and co-founder of ChainLight, argues that zero-knowledge technology carries more security risk than its popularity suggests. Drawing on audit and hacking-competition experience, the talk explains why complex circuits, immature tooling and limited peer review lead to bugs, why ZK rollups still use execution delays instead of instant finality, and why the value locked in ZK systems makes careful auditing and responsible disclosure essential.

Speakers

Topics

From BUIDL Asia 2024, hosted by Kryptoplanet.

Transcript

um hello everyone I'm Brian pack uh CEO and co-founder of chainlight um chainlight is a blockchain security firm specializing in smart contract audits um and security focused research in general um we do a lot of uh like anything that's related to cyber security in web 3 um yeah so today we're going to talk about um the ZK zero knowledge proof zero knowledge systems U why that's more dangerous than we may think um just to give you a background um probably because uh you've never heard of us uh we come from a web 2 uh cyber security background and are mostly known for uh winning a lot of hacking competitions um some of them include uh

deathcon uh it's like one of the most famous hacking competition conference um that happens every year in Las Vegas uh we've won seven times um for the CTF uh and we also have done a lot of CTF in web 3 um as there are more increasing number of them happening we've won Paradigm CTF um we participate every year and we yeah and then uh thanks um uh as you can tell I'm kind of nervous because I haven't really given talk in Web Two web 3 I've been giving a lot of talks about browser exploits before but web three uh it's kind of chill relaxed area makes me more nervous

than before um yeah and then we are pretty well known uh in terms of as of like a security audit Farm because um we are famous for having zero compromise with our clients uh such as blur blast and ZK sync um we not only work with some of the uh most decentralized uh platforms and defi projects we also work with some of the uh centralized exchanges because we do both web two and web 3 um INF infrastructure as well so uh so blast blur uh ZK sync upit are from web 3 customers uh we also work with Google and Microsoft and Samsung for the web two side uh We've helped them you know analyzing their uh

security mitigations before they launch it onto every single Windows uh deployment in the world uh making sure that security mitigation is actually secure and there's no way to break it um and funny story is that we actually found a a way to break gener generically break one of their security mitigations so they have to push back that project for like a year and a half until they fixed it um so I don't know if it made it made the world better place or worse place for not pushing that early on but uh We've do a lot of interesting research internally as well as externally all right um so how many of you heard of ZK like probably everyone if you're not raising your hands right

now you're lying right um but like not everyone is familiar with the ZK uh technology or underlying math behind it including myself right it's a it's a lot to learn um it's been there forever but it's only been very recently where people actually start to use it in more practice practical sense right um and blockchain and web 3 have accelerated that process like really fast and starting last year um the leading Narrative of the blockchain space um has been you know scaling the settlement layer like ethereum um increasing efficiencies uh in l2s so as a result like ZK rollup and its technology have

been the top contestant for increasing transaction throughput lowering cost and achieving uh true decentralization right so everyone is very curious about it everyone um is trying to adopt this technology uh new and shiny uh very useful looking uh technology however um today we there are like 21 chains that implemented ZK Solutions um that doesn't sound a lot but basically major projects have been have been there uh implemented that and then about $4 billion dollar are basically locked in these change so that's a lot of funds and that's a lot of money uh that's locked in um that's basically relying on this ZK technology

U so it is incredible that um ethereum and every builder in this uh space have achieved this level of Technology um and their improvements within you know just a couple of years um we've had this concept for really long time but we've been building a lot of um sdks codes circuits um to make this possible and make it more practical uh that we can actually use it for practical use but obviously I'm not here to uh here today to you know kind of preach and bore you out with the ZK Tech talk because there are so many of them you can just look up internet or crypto um and then I'm not going to repeat the greatness of ZK technology or uh theories that you can see in crypto

Twitter uh today uh I'm here to basically unveil um and Spotlight some of the uh other side of ZK a darker side of ZK yeah not all of it though um just kind of give you a brief overview of what things we have to be careful of uh ZK Tech is you know more dangerous you may think uh and we believe um that 2024 will be the year values locked in ZK Solutions and getting hacked um so that sounds scary but let's kind of dive into uh the details um ZK Tech is so new and complex um in terms of actual implementations um practical use of it um that it's challenging to even have

absolute confidence uh in the underlying Tech and math like we know things check out on paper but like even that like even math behind it have we actually verified enough with the enough smart people in it um there aren't I believe I know all of you are really smart people here but I think there are only handful of people at the moment that studied this long enough and deep deep enough to actually understand and verify and find mistakes and you know mathematical issues or vulnerabilities in these uh technology um and then there are a lot of developers developing these Technologies without like fully understanding them um obviously that is just set for failure or mistakes we're

human beings we're not perfect so it's bound to happen um and most Protocols are developed in house rather than you know in Academia settings or undergr you know much less peer review um so when you think about the traditional crypto systems like um AES RSA uh we've been using this uh for so many years and battle tested uh in so many different ways and we have various implementations we've settled on you know okay this is like a golden standard and everyone should use this uh library and not um sometimes that helps in terms of like you know not reproducing errors or mistakes that we you know uh experienced before but here we're just so busy building new things

um that we don't really have enough time or resource to peer review um as a result uh even the inventors of cryptography sometimes you know messed up this the security because we don't have enough time to verify um as we move forward and you know some of the common mistakes that happen over the past couple years is the you know fias heuristic or transformation um implementing that incorrectly which is like a part of ZK protocol extremely specific to each proof system and uh very critical uh for uh ZK to work um here I think Trail bits actually found a IAL vulnerability in the implementations

of like the the idea and the actual math behind it was correct but implementing um is so prone to mistakes that a lot of people have messed it up and that actually resulted in uh security issues that endangered millions of dollars um but if you remember we have 4 billion so far and it's only going to go up and which means any type of these bugs and vulnerabilities are going to you know uh endanger some major uh dollars right all right um to achieve the maximum efficiency developers often use you know lower level ZK circuits so when we say ZK there are kind of two groups of people

who are using it or I guess three groups one building the ZK like technology itself and two other groups that are using them um and then between those two um there are there's one that's using the actual lowlevel uh circuits and then there's um more of of ZK VM fols uh which are you know harder to actually Implement correctly um so the for I assume everyone here is U maybe a builder and familiar with the tech but for the non-tech audience here I often use the analogy that lowlevel ZK circuits are like uh programming in Punch Cards or assemblies uh when you think about the native code um so it's

really like you can fine-tune it very well and make it very efficient but it's also very hard and takes longer to implement something correctly uh ZK VM is more like a programming and python U where some of the libraries or some of the uh programming semantics are given for you um so you can do high level uh programming so programming in lowlevel ZK circuits um gives you some efficiency and freedom but then it also is very harder uh to implement correctly um this this is mostly due to the necessity at these U you know early stages of Technology right as all ZK VMS come with to much overhead so we're kind

of first time building this so we're going to make something that works but then it may not the F it may not be the fastest or the uh the best implementation so people kind of turn back and say okay we can do better if you use circuits um can we do that but however like these most ZK bugs uh stem from developers misunderstanding circuits um and or poorly designed circuit generation utilities um so the examples would be all critical bugs um our team has found in ZK sync uh over the past uh few months so we've won some of the bounties we've won some of the audit competitions but um these bugs do come up right and ZK sync is kind of

known as like the leading you know ZK uh folks that have been researching this area so long but they still make mistake so like are they the bad one no like there are going to be even worse ones out there and we're just going to have to make mistakes and fix them as we go um so the the part that we're still like kind of very enthusiastic about is that ZK Tech um isn't quite uh you know it's full potential yet meaning that there's so much possibilities out there that we can leverage that um so this is something that I haven't really heard others uh emphasize but like one of the biggest reasons to prioritize security

is because of that reason um because there's so much potential that's left that we can squeeze out of this technology uh we need to make sure this technology is secure and we know what we're dealing with um so one of the major benefits of ZK rollups you you may already know uh over optimistic rollups for instance is instant finality um so as soon as the proof of the block is verified the results are final which is really nice uh property to have but um you know this means the withdrawals from the chain or instant uh even more interestingly ZK rollups have the potential to interact with one another at a much deeper level um however no current ZK rollups actually have instant

uh finality uh this is because the confidence in the proof system proof security is somewhat low so we can't just rely on okay the proof worked so we're just going to move on because uh instead current protocols basically have implemented the execution delay where the there's like roughly a day window to detect these kind of exploits or maliciousness or abnorm abnormality and revert changes before they're actually finalized So currently the security of ZK rollups um comes with a a major compromise right only by improving the security of these underlying techn techology uh can we let ZK reach its full

potential um and then if you look at you know some of the hacks right uh in 2023 1.8 billion was uh lost to hackers and uh 1 billion out of it about 55% of that um is you know has flown into hands of North Korea um and you probably heard last last night's news which is North Koreans were hired to develop something and then they just stred um thankfully I think they uh decided to give it back but that was another $60 Million worth of funds right so this is going to get just continue to happen um so according to like for instance chain analysis North Korea hacked more crypto platforms than ever in 2023 so that's last year uh

and we expect this number to just grow exponentially uh as crypto on boards the masses um and hack in 2024 2025 will be more bloody than you know the one from 2023 um and it's going to involve ZK uh you know ZK technologist and some of the protocols that rely on ZK um so right now a lot of North Korean hackers or uh you know the exploiters rely on the fact that people usually make mistakes in bridges um so it's a lot easier to hack Bridges but as we secure those uh you know some of the holes down they're going to look for the next Target on where people are going to make mistakes and unless we secure this technology to

the point where we're very certain um the ZK is going to be the next Target so uh let's find out how to build a bulletproof project I don't like to use the word blit prooof or 100% because there's no 100% insecurity but how how can you achieve something like that or similar to that um so even if you didn't catch some of the previous slides uh I really want you to bring these uh takeaways home today okay um so there are three things um the first thing being uh you know try using Z KVM um you know I know it's slower um and more inefficient than using circuits themselves but it does give you more uh you know coverage and P you know

pitfalls that you fall uh that will be you know protected so only use low-level uh circuits if the developers are ZK or math experts I don't think that leaves uh that many people but um when in doubt please use dkbm um you know if they're not and you still need to some you know you need some low-level constraints um utilize some high level circuit languages or Noir or shum because um those are like kind of Middle Ground where you're not dealing with the circuit themselves but more of a middle level like higher level circuit language so that way it's Le less error prone um the second lesson or best practice uh

that you should follow is um have your projects basically audited uh by ZK specialized security firms um for for us we we had a a product called Relic protocol that's based on the ZK technology even though we claim ourselves that we are pretty good at ZK and auditing uh these smart contracts or circuits we also uh got audited by other specialized um people and we found some of the minor ex minor issues right so having more eyes to looking at these projects is very important so you have to invest in experts um there's no turning back obviously after getting drained or hacked so um there are some recommended audit firms um like ourselves or zelic um ZK security that

are specialized in ZK audits um yep and then the third one is basically list your projects like participate in bug Bounty platform so they're could be audit firms but having bug boundy platforms and have a lot of people who may specialized in certain parts of ZK can actually audit some parts of your circuits and there'll be other people are looking at other stuff so bul Bounty or competitive audit platforms are um kind of the that bridge that Gap uh Bri Bridging the Gap between projects and security researchers so by listing your projects in these platforms uh you can get security researchers analyze and audit the uh code uh for instance uh recently ZK sync

hosted uh $1.1 million worth of a competitive audit contest in COD Arena and polygon is providing a million dollar funding uh for uh Bounty for finding critical severity of bug on polygon zkm so if you're dealing with the ZK stuff U make sure you participate in bug Bounty and make sure you draw attentions from the best hackers good ones and then the yeah so those are some of the uh kind of practices they can follow obviously um familiarize yourselves to ZK if you're using that technology using some of the technology without actually being good at it is always dangerous well no

matter that Target is ZK or not all right so uh yeah go ahead thank you hey everybody uh I know Brian tried to like explain how badass he is but he's like probably one of the best attackers in web cfig so he's definitely should be talking okay you should be talking to about exploits uh question for you besides glazing you hard right now is uh you're you're experienc in web 2 with like bug bounties cves talking to vendors uh and it seems like you're at an interesting point with ZK where it's really early yeah two two part question one does this really matter with shared sequencers and

centralized sequencers because like to exploit the bugs like they are the ones that are like actually triggering the paring issues think so what's your take on the future of sequencing as it relates to ZK security and two what do you think needs to change what lessons can we learn from like the web 2 cve Microsoft Gobles like that whole like Evolution that can maybe bypass I don't see ZK Sy like they don't have like a security researchers like publishing like the bugs that you guys find in their critical ZK circuits because it's like devastating do you think and like what can we do beyond what you already have articulated to like improve the state of

like disclosing sharing LS yeah really good questions um for answering the first part um obviously you know sequencers are going to be critical part of this and like some of the bugs that we found yeah involve those um so I I think of more of this way so even from web 2 uh experience um there are going to be just a lot of parts like especially if you're building complex systems they're going to be uh major key critical parts that you just have to secure all of them because if you miss one of them even if the rest of them are secure then you're going to get exploited U because the attacker just needs to find one mistake that you made out of all these complex systems um so yes um I think we should also invest in

looking at not just like ZK circuits themselves but how they interact with sequencers and other components of the blockchain ecosystem and the second part um has a lot harder I feel like um because it took so many years and even in web 2 and it's still evolving um to come to this point where now uh vendors kind of understand okay this is the reality right we're going to have bugs but and people were very shy about it like we don't want to say we're vulnerable that because that may give you bad press bad image but I think we came to the conclusion where everyone's going to be vulnerable at some point no one's perfect um so rather than hi hiding the fact that there's

vulnerability or rather than hiding the fact that this was critical we come out and say okay um we found these issues but we found it before things were things went bad um and this is how we're going to so finding the issue is a first step right and acknowledging is First Step but then like how are we going to do like how are we going to fix this uh fixing the issue themselves is the next step but then uh where the web 2 is going right now is coming out like uh companies like Google or Microsoft what they're doing is like can how can we basically kill the chain of bugs right like how do we just kill this whole category of bugs um either by putting a security mitigations or using sa memory safe languages um there are other ways

to do it but I think um web 3 is very interesting because we kind of started with the whole mentality of security is very important and security is the king so we're very out front about okay we're going to get audited uh audit reports are going to be public so that was like the first like the part that kind of was the big differentiator for us as a uh security Auditors because for commercial vendors like uh Google Microsoft we find bugs they only see the bugs and we the report is only for the customer themselves whereas we do audits in web 3 everyone gets to see it so if you miss something and uh go bad then you know we get blamed or you know yeah a lot of a lot of consequences of pressure but I think that also puts you

know us in a good position because we uh we can't compromise in security right so