Episode 290 - Exploring, Teaching and Auditing ZK with David Wong
31 Aug 2023 · 1:06:54
Anna Rose and Guillermo Angeris interview David Wong, author of Real-World Cryptography and cofounder of the zero-knowledge auditing firm zkSecurity, on the Zero Knowledge podcast. Wong discusses his path from security consulting into cryptography, his earlier work on Facebook's crypto project and the Mina protocol, and the auditing techniques zkSecurity uses to find common bugs in zero-knowledge code.
Speakers
Topics
Transcript
foreign [Music] welcome to zero knowledge I'm your host Anna Rose in this podcast we will be exploring the latest in zero knowledge research and the decentralized web as well as new paradigms that promise to change the way we interact and transact online [Music] Guillermo and I chat with David Wong author of The Real World cryptography book and a co-founder of zksecurity.xyz a ZK auditing firm we chat about his background in maths and what got him interested in cryptography we then chat about his early work as a
security consultant his time at Facebook and then at of one Labs where he contributed to the Mina protocol we cover how zksecurity.xyz came to be and what they aim to do and then dive into the topic of security in the ZK space covering auditing techniques hot takes about where the space might be going and what threads of research are getting David excited now before kickoff I want to remind you to check out the ZK jobs board this month with the ZK Summit around the corner happening on September 20th in London many of our sponsors have put their jobs up on the ZK jobs board so if you're looking for a new opportunity or job in the field be sure to check it out and I hope to see you at the ZK Summit if you haven't already secured your ticket be sure to do so
we'll be adding the links to the show notes now Tanya will share a little bit about this week's sponsor [Music] Elio is a new layer 1 blockchain that achieves the programmability of ethereum the privacy of zcash and the scalability of a roll-up if you're interested in building private applications then check out Elio's programming language called Leo Leo enables non-cryptographers to harness the power of zkps to deploy decentralized exchanges hidden information games regulated stable coins identity products and more Elio's incentivized tesna is now live participate as a developer apply for a grant or go for a bug Bounty check out alio.org forward slash blog for more info that's elio.org forward slash blog you can also find the link in our show
notes so thanks again Elio and now here's our episode [Music] so today Guillermo and I are here with David Wong welcome David to the show yeah thanks for for having me hey Guillermo what's up so yeah David I reached out to you to come on the show I think I mean I started to think about having you on as a guest after I had seen this blog post that you made on zksecurity.xyz all about the Nova vulnerability and even though there had been like a larger paper published about it I just found it's like such a great resource to all like not only understand the vulnerability but also just understand Nova so yeah I just saw you
doing this and I thought it would be really great to catch up with you but I also know that you I mean I've we've interacted when you've had other hats like when you were working at Mina and like all these other times so yeah I'm really excited to to find out a little bit about the work you've been doing and yeah just generally your journey here cool and I'm super excited because I listened to like maybe not all your episodes but like most of your episodes and yeah it's amazing that we have these podcasts in the in the field I will feel bad a little bit about crashing this party because uh I I don't think I was actually invited to this recording until I uh talked to David and David like oh yeah I'm gonna be in the on the podcast and I'm like wow Anna just rugged me so
I was like it's cool um can I join this one I'm happy to have you here Guillermo I think this is this is great that's what she says now but I know she's like oh crap like damn it I really didn't want him on this one but it's fine hardly hardly actually yeah I heard that you had been discussing deep maths and then I sounded like to me Guillermo I think you're the perfect co-host for this one that's a compliment there's a compliment I don't think so yeah all right David let's kick off with a little intro to you I think I've been tracking what you've been doing since you worked at Mina and I knew about like real world crypto the book but maybe give us a little backstory kind of where's your starting point on this journey to CK security like all the way to this kind
of moment I I guess I started my career doing like Consulting work for like a crypto like shop at a consult consultancy firm called NCC group was it cryptography or or was it cryptocurrency photography services and so cryptocurrency is working but I don't think there was that much money at the time so so we're not really looking at cryptocurrency stuff okay what year was this uh 2015 I guess okay yeah yeah yeah and I I guess at some point it was even a debate on like crypto is crypto cryptography and not cryptocurrency yes and if you go on the subreddit of uh our crypto on Reddit first first is like crypto is not uh cryptocurrency and
that's my post by the way oh really oh my God I tried to post once like a very like an episode we did but it was a very cryptography focused episode and I tried to post it there and I think I got it removed yeah because there's so much spam that that it's kind of hard to to like figure out what's good and what's but yeah so I used to be in that camp of like yeah what was the point of cryptocurrency and and crypto stands for cryptography and and then I I give up some people are still fighting that fight you know but I don't think it makes any sense and I think maybe four years in like I start we started like my group started getting more and more cryptocurrency
Audits and so I think that's when cryptocurrency started booming and I think I did a year of cryptocurrency audits and then I was like okay this is this is the most interesting field it's actually hard to get a job in cryptography or at least it used to be hard and maybe you would get a job at like like a boring job at a bank or something like that and you would spend your life in meetings or I I don't know what people did but it was really hard to get a good job right and um and cryptocurrencies come and like cryptography is cool yeah all of a sudden and so I guess at this point I jumped to uh the Libra projects which was still stealthy at the time ah um did you join meta then were you or were you
an external Facebook at the time Facebook at the time oh wow yeah I was never admira okay so Facebook specifically the Novi team which was called caliber at the time like it probably doesn't make sense for anyone who didn't follow that whole like calibra nibra and Novi and DM and like I don't know how many name changes happen but that was interesting so I so I started doing more like more like security kind of things I was the security lead at the project uh for two years cool just a quick question there did you overlap with bobbin or with Costas yeah I was working with Costas uh since the I think he started after me but I like I think not too too long after after me and Bobby was there under a different name
and yeah actually the first time so at that time I didn't really know about zero noise proofs but I think I was hearing about plumoth uh the cello projects yeah we like they were using zero Notch proof to like yeah yeah um Fast Track like bft like apoc changes in BST Kobe was the lead on that and actually why I worked with him on the trusted setup that was the first time Kobe and I worked together I think okay yeah cool so so actually I tried to to get get us to do that at Libra NDM and I think basically every cryptocurrency should have like this kind of a verified like clients it's like most interesting application I think for ZK for cryptocurrencies um yeah so bobbin was there working Starks I had no idea what Starks were
and he actually explained to me what starts where and at that time I remember ex like understanding everything like it was a super nice explanation and then I forgot everything and then ask him to do it again and of course it doesn't have time but it was like this amazing explanation wow so you were at Facebook before they changed their name and then you made a leap out of it I guess what what pushed you out of it so I I guess I don't know if people are gonna like that but like the writing was on the wall like uh you know things were being pushed over every month we were going to sheep and I think at the time it was sort of clear that regulations were like going to kill the project um well not super clear but I made I
made a leap of faith I'm like okay I don't think this is gonna work work out and I'm still sad about it I know people hate Facebook and everything but I don't think it was necessarily like a bad project and yeah we made a lot of actually used to be like a very a much more idealistic project but because of regulators we had to like kind of kill a lot of the the heart of the projects which was kind of sad uh and I don't think many people know that like these kind of like like a lot of people are very passionate about that project and the regulator and all these discussions kind of uh made it more of a corporate uh thing and less of a cool thing at the time it almost sounds like it just got safer and safer and safer and like those
edgy interesting parts were getting cut off because I heard such as I mean from Costas and from uh bobbin I also heard just like they speak very highly of their time there and the team that was there the team that had been assembled was like kind of incredible and actually you can see that like those folks have gone off and to create really amazing things but at one point they were all together working on the same thing yeah it's actually kind of sad that we all split in different directions and I think different people try to recreate so like Aptos and mistan Labs were trying to like recreate the groups but like like I was already like admina and happy there and like people wanted to create mistan Labs on one side and it was kind of a it was too bad that we couldn't like decide all together to
leave them like it was a pretty good time it's kind of interesting right because a lot of the kind of standard libraries that people use nowadays some of the best libraries that we have were actually made for uh Libra DM right yeah um so one example being jellyfish is a really fast key Value Store KV store yeah it's used in penumbra I believe yeah at the very least I don't know who else uses it cool okay now let's talk a bit about your time at Mina you made the leap what year was that so okay I can't tell you that because everything's a blur because every time sometime during covet okay I just remember I did two years um at Novi and that's all I remember and I don't know what year it was but yeah
and what's okay what's interesting is that actually did I think I discovered zero noise proof of or or this kind of Advance your night proofs through Coda protocol which was the name of mina at the time yeah but they changed the name because Costas company sued them so sorry because it was too close to core though okay there are three products and so so when I was at NCC group A co-worker of mine that's known penumbra Ava told me to like go to this like Meetup um which was like not the launch party of Coda but they were like I think they were stealthy before or something like that and they they came up and was like or they open source the code or
something like that and so I went to that meet up while I was still a consultant doing security Audits and stuff like that and I remember being like mind blown that they could like do recursive zero Notch proofs and at the time they had like a browser like demo or like your browser could verify like a blockchain it was like so insane to me that yeah um I remember being mind blown and so when I wanted to leave uh the DM project at the time basically I looked around and I was like holy this is what this is where I want to work cool and so yeah basically I reached out to them they made me an offer I was like yes on the spot wow um and I think that was the first time I said yes like as fast as I could and yeah I I guess I just spent uh two
years there because I left like a few months ago to create DK security and when you were at Mina you created a number of libraries that I think are still in use like kimchi I I work in kimchi I'm not going to take credits for it okay if it was a group effort um I just know you presented kimchi with someone else at CK Summit seven right with Joseph with Joseph yeah yeah I guess I Was An Architect there and a lot of my work was was to try and understand like where we were going and sort of like what was our strategy uh vis-a-vis of our code base and these zcap uh functionality that still hasn't launched but he's doomed to to launcher very soon I can't say much about that student TM um but it should be very soon
and yeah so yeah I worked on kimchi I I did to be honest I did a lot of old camo way way too much um it's it's a it's sort of a functional uh language uh functional programming shop um and so they're very very good people there because people who like these kind of things are insane um so why oh camel I thought oh camo was like just Jane Street or something right I think Isaac originally really loved it right yeah teammate forts you guys got it Isaac was at Jane Street of course [Music] that's the only reason why anything is in okmul right yeah James Street at some point right no way but also I okay tell
me if I'm wrong but I did hear that like there are places in the world where oh camel is like kind of championed and I heard France has like this epic o camel Community is this true well Kevin is French right like I think it was invented a Dean Ria and it's like yeah okay okay maybe that's interesting people working on that full-time um and I don't know if there are like serious companies using ocamo in France specifically but it definitely like impacted a bunch of people who love this kind of you know the language Theory and these kind of things yeah I mean if you okay rust was written in a camel right I don't know if you you guys really heard about like uh fun facts rust was originally written in ocamel
right I did not know Russ was you know camel no I didn't know that actually I asked for some reason I knew it was like a functional program but I assumed it was Haskell which is like you know like normal functional terminally from other programming people use right I think what so something important at Facebook so my first PR at Facebook was a no chemical PR oh my God and I don't know why I chose that and it was on some I think the flow compiler oh okay or maybe like the hack type uh type Shaker was like returning you know camel but I think they they're moving towards and maybe have successfully successfully moved to us so quick for quick context hack is like a home brewed version of I think it's PHP
right if I recall correctly yeah yeah but I'm not sure exactly what what it is now uh I think the fourth PHP and I hope so um but it's like uh it's Facebook's like home brewed language that they use for like a bunch of internal like web page buildings and for Facebook itself right like Facebook yes built in I know because I ever had to write some hack at some point first so horrible thing and I'm sure there's a PR of me and some that anyways it's a whole thing I like hit but you know I I like weird things so you know I understand to each their own David I am now curious though what language do you prefer now to work in like what is your so you know you would have been working in no camel at Mina but would you still prefer that is
that still kind of where you'd go are you rust based now let's go I I think I was always so it's an interesting question because when you're a consultant like basically every so actually now everything is in rust or circum or like these kind of things but back then like I used to I did like every every pen test would be a different language oh wow so I went through a lot and I would say rust is amazing Russ is the most amazing language I think today and I I don't think I'll ever write a camel again and say it like that yeah of these days and then it'll be great I haven't tried it so I I don't know I'm open to languages but I kind of want to
ask you about that though like so because we didn't really talk about sort of your early work that much but had you studied languages had you just been had did you pick up a lot of this in work yeah I guess that's like when you're a consultant it's just you're you're thrown into like whatever projects and you you have like a few days to like learn a new language usually okay um that's the you know the dark side of the behind the scene of uh of being being a consultant and so yeah yeah I just sometimes yeah learn the language just for for like two weeks of of pen testing and wow and then never touching it touch it again like that that happened a lot on that question actually uh is I actually don't really know what your background is
um I don't think we've ever chatted about it so prior to doing kind of security and cryptography Consulting what I did I did tell you that maybe you forgot I told you I used to do math believe it or not because I'm bad at math that's right you didn't tell me that yeah specifically but you know I'm gonna I'm gonna pretend for the sake of this episode that I've never heard of it before so you're coming more from math you didn't study CS I guess no I I didn't yeah I guess so I did a bachelor of math in party in Canada actually oh cool um and I I was deeply depressed uh oh no pure mathematics as all mathematicians are yeah and so I I guess that like one summer I didn't know what to do with my life I
just figured I'm gonna finish my bachelor and you know like end up under a breach or like I had no idea what work meant like what what people actually do that you know deserves to be paid money or yeah um did you do mathematics at a French Institute yeah French um actually that would contribute to the depression oh the French mathematicians and and Mathematics Curriculum is a it's a special one it's a special one reserved for a specific circle of hell for people who who are into that kind of thing um we could talk about it more later but anyways yeah I wouldn't say the curriculum but like the way of teaching also in France is like I have a lot of strong opinions on like it's basically going to jail and not it's horrible and in my time in Canada was so much better
like my teachers yeah like anyway I'm not going to say anything more because I don't want to make enemies um but uh okay where was I okay so so I did I did math and then I was deeply depressed and one summer because this is interesting so I'll tell that story um I was working in McDonald's making Making burgers in the kitchen right that's that's how we did it and I discovered so Coursera was something new at the time oh yeah and one of the first course on Coursera was the stanbone uh cryptography so during during my breaks or like days where I was off I would go to the library and I would just follow the cryptography 101 or cryptography one course from that money and I went through that and I was like okay this is
what I need to do like I like computers I had been like you know doing computer stuff forever and I I liked math but I just didn't like what I was doing so I was like this is my Escape I'm just gonna do a master um in math so I finished that course went into a master in the University of Bordeaux and yeah so everything falls from that I got an internship at some you know NCC group The consulting firm yeah and uh the rest is a history it's what we've just talked about this is awesome wow I'm so glad we actually dug into that because that I mean what a crazy connection point to also what Dan does now and like you work now in his world in a lot of ways that's so cool yeah so I'm so yeah Dan bunny for me and
I remember sending him an email like hey can I do a PRC with you and he actually responded and but back in the days and I can't remember what he said um but he wasn't he was not a no okay good um so it's I guess uh Chris yeah this is like what 2010 2011. I think later than that no 2012 maybe maybe 2012. yeah it's interesting because funnily enough that's the first course that I also saw at Coursera but the first course I actually took at Coursera was from uh equal polytechnique and it was the real analysis course their functional analysis course specifically okay all right um it's it's a terribly difficult course
for some God forsaken reason that was it it exposed me to the French uh mathematics system um the people that survived this these system are really good yeah but yes but it's hard to survive basically damn I want to ask you David at what point does writing a book which became real world crypto the book that I as I understand is now published in multiple languages around the world when did that idea pop into your mind like and were you doing this on the side and maybe talk a little bit about this book yeah so I guess I don't know if this is interesting but but like I've I've always liked writing and I so like one of my first successful maybe not
first successful but okay the first time I ended up in the newspaper was during my bachelor and I so I made a I heard that idea of like if you write three pages a day then you can like check like a checkbox and then it motivates you to keep writing because you see like a chain like a blockchain you know like this you've written motivation chain yeah exactly it's a thing right like chains and and so there was a website to do that but you had to pay so I made my own own application and I started using it to write like every day like three pages a day and then I published it online because I was like this is so useful for me so I'm gonna publish it and people have yeah like a huge amount of people in France have been using it people have written
books just using the app and so I've I've always like loved writing I've always wanted to like write books I actually wrote um one book before that's one that's a novel and that's unpublished uh but I was already in this kind of mindsets it's a when will you wait is it just sitting in your like it's a transcript on a bookshelf it's on a computer somewhere you're not in the 19th century I got it yeah I wanted to buy this this kind of uh how do you call that typewriter typewriter I never did and so yeah I've always liked writing I've always had a Blog I've went through many blogs and I guess the most recent blog that uh
usually people are more familiar with is the cryptology blog cryptology was a French spelling and which I started during my master so I've been blogging for I don't know for uh almost 10 years I guess why did I write a book from that so I always wanted to write a book on cryptography because I I just like teaching what I learned and I think we can all agree that reading papers is hard and it's always like very painful and so if you find like some resource for that someone wrote It's like nice because you can you can um understand things better and so learning cryptography I run I run into a lot of things I couldn't understand
myself and so I I by learning them I wanted to like teach them after and so so that's sort of the when I had the idea of writing a book I actually the real Clique also came when I was teaching a corset so I used to teach a crypto course cryptography course at black hat okay uh the conference and someone came to me one day and they were like oh can you give me like a recommendation for like like a course or whatever and I told them to check the Dan bunny course and they told me it's too theoretical like that's not for me okay interesting and so that's when I understood that I could do something that would be very useful for a lot of people wow so the book was essentially an outgrowth of kind of your blog uh and like its Associated writing I I actually
haven't read the book it's on my like shame on you I know I know I'm sorry oh you do I started that actually but it was okay is it essentially does it take your blog and kind of formalize it and like make it a narrative like what does it actually do also I have another question about the blog itself but we can get to that afterwards oh yeah so so the book is basically two parts the first part is the ingredients and the second part is the recipes that's that's how I call the the thing in the book okay any ingredients is just basically I reuse a lot of my blog posts but most of it is novel because I realized that it actually didn't know a lot of the things I was supposed to write on so I had to spend the time to like learn it and so I
could really teach it that's awesome and so yeah first part is like you know basic ingredients that that uh are pretty common in cryptography so like hash functions uh authentication tags Max encryption authenticated encryption key exchanges signatures all these things and the second part is what do you do with that so it's like uh SSL and TLS so session encryption uh sacral messaging with signal so so yeah end-to-end encryption uh what what else do I talk about so I talk about zika snarks an NPC and fhe wow I talk about post Quantum cryptography um so all sorts of like more advanced topics and yeah what else do I okay I I
should have the thing in front of me but um stuff like that stuff like that nice I mean it's interesting like I've seen a lot of people actually tweeting as they're going through it like I think this is It's become quite a like a the textbook that people will potentially go to first but this is not really for ZK only folks this is really for just general kind of blockchain topics right if you want to know the technology the cryptography that underlines a lot of that stuff this would potentially be a good starting point yeah and actually My slogan at the time was uh or for for you know our blockchain world was this is the first cryptography book with a chapter on cryptocurrencies oh neat so it's
actually if you're into cryptocurrency it's actually a good book to read if you want to get more into the cryptography of it because it actually talks about the bft consensus protocols and these kind of things nice I I also have it here's the second set of questions about this is you know it even if you want to write write like whatever you know you have your your little uh blockchain of uh you know achieved days that you've written three pages like why write about cryptography where I write about this specific thing like why not write you know you were interested in you wrote a novel earlier like why not do short stories you know or something like why was this the idea like yeah I guess I just like teaching and and it's easier to write about what you do I
guess so I I did you know crypto stuff cryptography stuff and and so I was like I'm writing this blog and I'm explaining a lot of the concepts and people really like them I'm making these videos people seem to like them uh and I seem to like add value uh to people's lives so I want to do more of that you know if I think if I write a book it's gonna be a book that doesn't really exist and so it sounds like a good idea you saw the need when that's when that person had come up to you so like someone did sort of say like I there's the things that are out there are not satisfying what what we're looking for right so yeah I think I really saw the need and I even to this day I think there is no other book like that that
that is like in between the theoretical and the the very practical um that's very cool I I have one slight side question um that you sort of talk about you you built your own version of this three pages a day isn't it is it just like an open source app or something what is it it's not open source but I guess you can use it but it's in French well I speak French oh yeah and it's I mean as long as you can register you can use it right okay cool cool what's it called yeah it's called threepages.fr ah um I wish you could I could like encrypt what people write that's that's sort of like the primary feature that people request it's like or
whatever I write is like goes in a database and and you know it's it's not really private so it would be cool if I could do that but I honestly I haven't had the time to to do this you could make it private with a zero knowledge proof Maybe not maybe there's something maybe there's something else that would be better soon actually you provides to make it private by having it on your laptop or something I feel like people have made crude versions of this elsewhere yeah it'd be good to use cryptography in that project because I went before I was really into cryptography and yeah but yeah lack of time yeah so but getting quickly back to um the blog post and and I assume the book as well but I unfortunately haven't sorry read it again
um so one thing I actually really appreciate about your blog post and it's very impressive that you could just write three pages every day and have them come out this good on average I guess it happens after a lot of writing is that it's actually very clear so you know you say oh it's it's only for people who aren't like too theoretical and I would D myself as like terminally Theory oriented right like there's kind of No Escape for me at this point right um but I actually still really appreciate your blog it's very good it's very well written it's very clear in ways that uh I will say almost know if any paper actually is um thanks and you're very good at kind of this conversion this this idea of like taking
you know 60 pages of something that could definitely be uh shrunken down to about five right and and have all the same content right and then explaining it even more cleanly than those five pages I was like okay like how do you what do you do that like what what is the process do you you know do you go take a 60 page paper and like a bottle of wine and sit in a corner of a room until you that's what I used to do oh that's right you used to do okay good I'm glad we're all in agreement at least on that one drinking is always a good like influence on the writing I think a lot of writers are you know do these kind of things too um but for technical writing it's a it's a different uh different process I would say
yeah I would say the the deepest secret you know like double quote secret is that um good writing is just a writing that has been Rewritten a number of times and I would say the same for like good code I think good code is code that has been refactored many times nobody writes well the first time like that's what I do I just write my drafts it's and it's shitty nobody should see that you know I would be very ashamed if anybody sees that and I sleep on it and the next day I look at it I cry a bit and I rewrite it and it rains and repeats you know how long did it take you to write the the book it took me a bit more than two years uh to write that book and I was slow I guess and when did it get
published actually when did it come out uh I don't know because it was kovid 2021 something maybe it must have been a year maybe or a year or two years yeah yeah and it's been translated I noticed you were tweeting this what is what's going on there yeah it's so weird because I I didn't know about that and basically people send me these things and that's why I learned um that's awesome but I think it's in German in Polish in Japanese in in Chinese uh I'm so sad that it's not in French yeah it's probably one day yeah how does that happen like are people do you have a publisher is the publisher doing it like how is this I have no idea yeah I have a publisher it's uh Manning
okay uh and I yeah I don't know how to do it it's just it's just magical you know wow they're localizing it this is really cool I like that it's like happening sort of just like out there um actually I should I should say that so I have a box of German real world cryptography in a box of Korean and so I'll probably yeah warn people so that I can sort of give them out because I don't know what to do with them at SBC cool so if I if I get a a copy of the book can I get it signed can you speak German or Korean is that oh no unfortunately I have a US version I can give you those
is there anything you think folks who are starting that book or who want to use that book should know about how to like use this textbook or how they should approach it uh no I would say just started you know just start reading and you'll you'll get it and just ask me questions if you don't get it on Twitter just ask me things on Twitter do you do you need to have a math or CS background do you think uh so I was I would say no so that's that's sort of why I wrote the book I tried to like use minimal amount of equations some chapters I didn't really have a choice um especially like when I get more into public key uh cryptography but I I try to stay away from you know writing equations and try to stay away from
Theory I do talk about how the theory cites see things but I I it's more of like like usually in small boxes that you can like ignore if this is not interesting to you cool um so so yeah no no prep needed I would say nice so let's move on then to your latest project zksecurity.xyz uh as mentioned the way that I first saw it was through the blog that is attached to this project but then as obviously I clicked in and then saw oh wow David's doing some sort of auditing firm or some like it's it's dealing now with ZK security so yeah share a little bit about uh what it is and how it came to be oh yeah so I guess uh me Brandon and Gregor from 019 so so
working me now we were so both of them are working on the higher level in the stack of the the mean attack and so they're they're talking to developers they're seeing developers use zcaps or try to write zcaps they're seeing a lot of bugs and they're telling me David I I think there's a there's a market for that like we're you know people write bugs in smart contracts like in ethereum and whatever and there's a whole Market of auditing firms doing work there we think there's going to be a need for um smart contracts but like CK smart contracts and so so we sort of like took the bets and decided you know to to to create this thing uh ZK security uh and I would
say that indeed um after doing a number of jobs we've realized that very good people will write a pretty uh bad bugs um and basically nobody can write uh it this new paradigm of like constraints is actually very hard to to um figure out and and I mean even good people who know what they're doing will make make pretty big mistakes there so it's it's been quite interesting to see uh people running circuits you know today if we look at the the different platforms for writing zcaps that that exists most of them are not launched and so I think what we do today is going to be very different from from a year from now when when Mina has launched
alio has launched Aztec has launched uh starknet is more of a thing and and so on interesting yeah when you said that you're sort of talking about the ZK app so it comes originally from this idea seeing people building ZK apps I guess in the test net phase but that's not the Deep cryptography part right like I guess when you're doing ZK security auditing today you're usually dealing with like the protocol Builders who are actually using the ZK in creating these platforms where you can use ZK apps all those teams you listed would you see yourself as a potential auditor of their code base or are you sort of waiting to like be more for the the things that are built on top yeah so our our bet was that smart contract security is a big
thing zika smart contract security is going to be a big thing or zcap security is going to be a big thing yeah but since a lot of these projects haven't really come out uh we've actually been auditing a lot of things lower down the stacks so so like privacy stems or very notable like you know manual R1 CS writings are interesting these kind of things uh but I think tomorrow or you know some someday in the future I think this is you know the proof systems are gonna osify solidify and we're gonna see more user apps and and more books or more work for us uh layer as as an auditor of those systems though like is it hard for an auditor to learn all of those different
languages to be able to audit all of those things or do think there needs to be like some sort of specialization I would say finding bugs is always finding bugs and so in the higher level higher layers I think it's not going to be you're not going to have to have like a deep pre-system background to do that work that's that's what I think hopefully that's gonna work because I have to train a generation of consultants for that yeah um but for the for for writing like low level constraints and and custom Gates or or very low level constraint things I think it helps to to understand things that at a lower level I think without that understanding it's gonna be hard to
to audit or to write these kind of things and so yeah I think today we're in a good spot because I don't think many people like us are interested in doing audits so so we're very few people with this kind of background uh with this kind of cryptography or or you know my co-founders like worked on like uh snarky.js and these kind of compilers for in languages for writing Z caps yeah so people who do that usually are are spending their time building these kind of things and so so there's not many people who have this kind of expertise to to audit things there are a few firms coming out like I did an episode with the folks from veridice John um and like they're coming I think more
from Smart contract auditing now doing ZK auditing not so much from like the Deep cryptography to now being an auditor which it sounds like your your path is more like that they were talking about fuzzers and phone verification other like tools where you just kind of like there's like types of bugs that happen enough times that there's like specific things that they're looking for do you have stuff like that too or are you doing much more of like a kind of I'm just sort of picturing like you know very careful through each line kind of audit so okay that's that's a very good question actually because I have strong opinions on that okay um so I guess formal verification fuzzing all of these things are all of these tools are like things are known by
Consultants it's nothing new you know and we're just like translating or transporting these tools to like these new paradigm and like these new Frameworks from my experience and I think a lot of Consultants would would agree with me although you know I don't want to speak for everyone but manual work is still very needed very much needed um maybe there's a future where we can throw a code at an AI and and they'll you know find bugs for us and actually I believe in that you know so I'm happy if there is a future like that but for now I think manual work is very important that's that's how most bugs are from and fuzzers okay let's talk about fuzzers and formal verification
so formal verification usually is more like like static analysis like you don't really run the code and fuzzers are like Dynamic analysis so you run the code and you're trying to find bugs uh just by running the code buzzers um I think are relatively recents you know in a sense where like we had a theory but people didn't really come up with like nice implementations and um I think AFL was like the first big implementation and at the time see programs were a big thing so like uh in C you have a lot of memory corruption bugs and so fuzzers become very useful because you can find all these uh these uh you know you're trying to write to
memory but you shouldn't write to memory there or you're trying to read from memory but you shouldn't and see is like a horrible language so it allows you to do that but now that we have rust fuzzing is not that useful anymore I still I still write fuzzers but I I would say that usually I I will find crashes at best um but you never find anything really interesting and maybe for constraints you might be able to find more like completeness issues where sometimes you're you you have some constraints that are supposed to like you know encode some program and the fuzzer will find some inputs that don't work you cannot prove them
you know you can create a proof and so you have some completeness issue but usually you don't need to write a fuzzer to find them that's that's what I've seen in practice so I I believe in them you can find low hanging fruits very quickly with them but depending on how much time you have sometimes it's not it's not worth the effort because because it's not always a good way to to find a um to find good bugs you know I also I the kind of bug that feels like it'll start coming up more and more which um it is it's a bit harder conceptually with kind of transparent contracts like solidity is like under constraining things normally when you do things you build an
object right and then like that object is is constructed and therefore has like some set of properties that are are interesting here it's kind of the opposite right like ZK requires me Nerf in order to build such an object I actually have to say what things are both like reasonable and not reasonable right by constraining it in a variety of ways by adding certain constraints and I feel like this is the kind of bug that is you know you it's easy to say because it's uh obviously you can construct objects that are like not reasonable in like a lot of ways but I feel like it's going to be way more common uh in ZK right where it's like oh crap I accidentally forgot a constraint to check that like something is I mean it does happen still but you know something is like non-negative in my specific way
I'm identifying a number right and I feel like Fosters would probably be very useful for that but I don't know I mean it seems like you you don't have that opinion so I'm curious like um yeah I would say I don't think fuzzers are going to be very useful for soundness issues so like so when I think of some messages it's like finding inputs that should not work but are working and so finding these inputs usually is hard because you have to like um you have to like construct them manually uh not necessarily all the time but in very interesting cases and for very interesting bugs you you need to like you know like compute the inverse of like another number or like something like that and then that will work but it's not supposed to work and so the fuzzer a fuzzer is like kind of a dumb
program that will just throw like random numbers of the program and it's not gonna do this kind of uh these more clever uh things and so I I think yeah I think we're going to be limited with fuzzers interesting in that episode I did with John from Paradise we talked also about this Middle Ground between fuzzer and formal verification which was like static analyzer I think that's what it was called is would you also put that in the same category as fuzzer or do you think it's more useful so so okay so this is interesting because that's where my strong opinion is oh but I I will okay I'm gonna shock everyone but I'll say that like insecurity like formal verification is more of a buzzword and it's usually a good way to like hire researchers or get
grants or you know I attract people and and or or have interesting things to work on because like these are interesting problems but usually they're not that useful they're usually pretty noisy or they don't really find anything uh useful I I've actually never found anything useful using static analysis I will always run them and I think most Consultants will like look at what to like what static analysis tool they have whenever they look at a project so like linters are is a form of static analysis so it's easy to run an inter um or you have more advanced ones and the more advanced ones that can find interesting things are usually way more involved and so if you want to use them you're
gonna spend way too much time and this is not time you have usually that being said I've seen people on projects that are paid to just formally write formal specifications and so these I believe are interesting exercises because it gives you another Insight on the protocol that you're writing or creating because it forces you to like write it in like in a different way and so by doing that sometimes you might find bugs or you might find issues and these kind of things but it's mostly the exercise of writing that you know in a different language or something like that um that I think is interesting not necessarily the running the the tool um to find bugs that being said I have a blog post coming where I do use
Tag analysis which is a form of static analysis to find these kind of bugs that I call Boomerang bugs in under constraint programs um so so there is somehow somewhere but it's today it's very there's so much friction to to use these tools David you just kind of used you used formal verification and static analysis sort of together in that last bit so which one are you critical of more just the way you said that I was sort of I hadn't really I had thought of them as like distinct but are they kind of connected yeah so static analysis is just tools that don't run the code so it will just uh either get information from the compiler or or like just you know just
look at the code and do like very nice things does this code contain the function eval and we know that aval is a bad function so you know just like wrapping like naively in the code so you can do a lot of things like that um formal verification for me is just like one like subfield of like study analysis got it okay um so so like for example linters or static analysis tools and to me they are amazing like give everybody should use linters if you use rusts you should run clippy on your projects for example um if you don't you're crazy what are you doing this basically I was uh my strong opinion is on formal verification and I see and how it's it's far from being
usable in practice and yet specking it out or do creating the formally verified spec is useful right in in the same way that writing a specification is useful like like an English you know purely English specification because it forces you to put IDs that you have in your head uh on paper and and by doing that you might realize that something is is kind of wrong or so it's not the it's not like using a formal verification tool on existing code but rather the writing of it like almost the first part of it is the useful part just like trying to put it in the format that you would need in order to run form formal verification yeah is the is the part where you
actually catch a lot of stuff huh it's also most of the work to be fair right like most of the work a formal verification is specifying the problem that you're attempting to solve interesting right and and this you know it's uh it's kind of funny this brings us a little bit back to writing it's like what's the best way of clarifying your own thoughts is writing them down in a formal way and then like having a thing that says okay here from point A to point B like here is everything that I want to you know have this thing satisfy or not satisfy and indeed that's like 99 of the work of writing is actually making it clean and reasonable much more than it is like the the high level idea yeah so it's kind of like if you if you you might think you don't need to write
a proof but by writing a proof you might actually realize that whatever you were your theorem is like not correct or that's right or your protocol is broken right so kind of revisiting the fact that you're currently not auditing smart contracts DK smart contracts on top of these platforms but they actually the underlying stuff we already mentioned one class of bugs or problems which is the a circuit being under constrained are there other types of bugs that you're looking for in in sort of that low level auditing or is it just that one I would say that the two bugs are basically this it's like completeness bugs it's like you you want to try to do something but you cannot because you you badly constrain something or sunless bug you you can do something but you should
really not be able to do this thing what does that mean like it like it's happening but it's not happening because of the logic yeah so I guess the easiest maybe the easiest example is like let's say you want to like add two values together in a circuits and what you can do is that you can create a constraint that adds the two values together and that would work right because the third value the results the Pervert can try to put anything there but it's not going to work because there's a constraint that's preventing you from doing that you're not going to be able to create a proof um but if you under constrain your circuits you might forget to create that constraint that says a plus b must be equal to C so a plus B minus C equals
zero right same thing if you forget to write that then the prover can put any value they want in into the C buckets and so then you don't know what's going to happen in the rest of the circuits because the yeah they can do whatever they want and and you have to think about that all the time like whatever values are in the circuits can be anything the proverb wants them to be unless you have a constraint right so if you don't constrain something then it can be anything your brother can choose whatever they want in both cases here so like a soundness bug would be because there's a constraint missing and a complete disbug exactly would also be because a different kind of constraint is missing or or a completeness book could be you you have too many constraints and one of the
constraints is actually preventing you from like it's saying oh wow okay B should not be equal to zero when actually you want B to be equal to zero you know interesting it's a it's a valid input and just to remind everyone like maybe in the completeness part why would a team create an under constrained system or circuit like like there's there's obviously some sort of trade-off that they're going for like they're getting more efficiency or something yeah why why would you have that happen why not just add a ton of constraints like why not just use all of them all the time yeah I'd say it says two two things so that you touch on the first one it's like when you're looking for to optimize things uh you can create bugs the other thing is uh human error right like human error is the source of most bugs and so
in this case um I mean it's hard you know like some of these constraints are hard to write the one thing I can think of which is like one of the trendy subjects and actually I'm a one of the architect for the Z price uh one of the Z price categories here and one of them is uh it's gonna be on that and so this Prime is called non-native arithmetic and so sometimes you want to do stuff in in circuits and and you know a circuit is instantiated on the field but you want to do addition or multiplication or whatever in another field and so it's kind of hard to think about that right like you you're doing things module or number P but you're trying to do
operations module Q like a different number and so most I mean most everybody is gonna be like brain at some point when they try to think about that and it's actually Avery I think every project that has implemented these things have had bugs like Aztec had like like a spec in the like they say like oh we had an under constraint here um Mina had a bug also at some point there I'm sure everybody everybody else must have had a bug do you think I don't know if you've thought about this and this is the topic kind of a few months ago in our chat we were talking a lot about disclosures and appropriate disclosures how like if you're an auditor who's working with a client obviously there's like a very
clear way that these things are communicated but as an auditor are you also looking into systems that are you're not working on what happens if you find something what do you do okay this is a great question like I at some point in my life in my life as a consultant I wanted to like do a talk just on that topic it's kind of a it's such a weird like so security is such a weird field it has like these kind of perverse like incentives sometimes where like if you have a client and they're you know they're paying you to find books and and you tell them here are the bugs I think that's fine or if you're an academic you know like you you don't have to be working for clients you could just be doing like pure research yeah like you're gonna find books and it's
like what do you do with these books and it and there's this whole like you know as an academic or even if you're a consultant you need to create a buzz you need to give a name to your to your attack so it's going to be I don't know the attack of the day everybody's gonna be mentioning the you know heartbeat or like like whatever um I don't know what's the latest actually there was one recently but basically you know there's this game that people are playing and they're you like sometimes I sometimes I you know I stop and think and I'm like are we still the good guys and how are we doing like is it actually good to Break Stuff well specifically in these moments where you find a bug and you cannot warn everybody about that book you know there's gonna be like devices
that are gonna have that bug that are not gonna be patch in time oh yeah and so the other side of the argument is that well if we don't do that the bad guys are gonna do that and the bad guys are gonna exploit that so we have to like you know disclose it to everybody uh everybody we need to let people people know and there is no perfect way to do it you know people will exploit that the bad guys will have some time to exploit it but this is this is the best uh outcome is it really a good thing he's like researching bugs and like breaking systems is it actually a good thing because I think most bugs actually never go um exploited like some bugs are dormant like forever basically yeah it's it kind of
accelerationist philosophy that I mean at least I think that's what some folks who are into the hacking and breaking is the sense that like what was going to break eventually so we might as well break it now and if we have a path to be ethical at somewhat let's do it that way or there's others who are just like it's gonna break anyway someone's gonna get the bounty on this and not even I don't mean like official Bounty like they'll get the payload they'll get the the money that you can steal so I might as well do it like that's definitely uh and and it is I I wonder if the way that that's rationalized is well this is helping push everything forward anyway because it was going to break eventually it's like who knows I can't understand both sides of the argument but I
I think the site that says this is good this is objectively good you know I I think it's more fine-grained like the reality is more nuanced yeah the ethics of uh of security have always been and I think we'll continue to be quite interesting right it's uh it's a funny arms race moral quandaries you know uh it's sometimes easy to point at a mirror and be like uh yeah are you sure you're getting up in the morning for the right thing you know yeah but so it goes right if there were a perfect answer I don't think we'd be having this uh discussion in the first place so I wonder like how do you even think David that we could even get that conversation going like who should be in that I think it's still like it's still early right
like um ZK security is like a very very field most of those applications are not born yet and um like I think we'll get many examples of what we just talked but I don't think I've seen an example so far in DK or maybe I'm not thinking enough there was a big Planck one but they were able to disclose that this is the one that trailer bits found I think they found something yeah that's a really interesting case study because it shows like they did disclose it to the most valuable networks I think in advance but there was there were so many teams that had been using it that they might not even had known who all of them were
and it was really hard to connect with all of them and that was sort of like that's I think of like a real world version of what we could imagine happening if someone's trying to do it ethically yeah that's a good example that frozen heart yeah yeah it's hard to warn everybody yeah that's for sure like you don't know who who else is using that that protocol in the wrong way totally um yeah we see a lot of I guess I was dealing with that the other day we're like there's a lot of threshold signature um issues also and and um there's many people reusing the same schemes or libraries and it's it's like a basically a hell to like contact everybody and you have we have these 90 days disclosure because I know somebody thought it was a good idea
to say nine 90 days is the gold standard right yeah um and so everybody's running around everywhere and everybody like is there any other project that we should learn is has everybody fixed the bug totally these kind of things I mean the the most famous one I think still in our space was the Z cash one in their case though it was like it was the only people who could figure it out they think were in the room were the people who built this thing because it was so there were so few people in the world who understood these systems yeah and it was Ariel Gabby's on who found it and they kept it even from the rest of the company they kept it in a group of three people who knew uh what was happening and they had to like strategize all these things to make
sure that they could do this upgrade without it being known because had they made it they didn't disclose it but it was internal but yeah there was risk to the users I guess during that time they could have shut down the protocol um but I'm not saying that they should have done it right like I'm not saying they should have but so this is interesting because at the time we were auditing zcash at NCC group and strad had told me I'm very curious of the results and he made this face when he told me that um and I thought it was weird I don't think strad knew I don't think part of the Inner Circle I mean I he should speak on this but uh yeah as far as that's interesting because at the time that's when I started thinking they did insert bugs just to see if we're doing
our job and then I started thinking if like clients can do that interview and this kind of things so he did have a weird reaction I remember that I should ask him yeah actually I shouldn't speak for them at all all on that front but um as far as I remember it was Arielle seanbo and Zuko who knew and maybe there was like one other maybe like the legal team or something but it was like a very small group I don't think the general engineering team knew it's such a difficult problem right it's just like it's crazy to me right because like even the mere knowledge that there exists a bug I know is like so useful in finding one right like it makes it just so much easier which is insane oh yeah okay so
oh okay I don't I don't know if I should say that but I know some people that ended up exploiting that bug on like Forks of zikash yeah that's enough although that was communicated at that point so I feel like yeah I I don't even know what these Forks are but yeah yeah that was I mean I think as a case study actually I think what we'll try for this episode will dig up I did an episode with Sean Beau where he goes through that timeline in a lot of detail so that might actually be something interesting for folks to listen to if they want to hear that story accurately and my apologies by the way if I'm also misrepresenting it because it's I think we did this it was episode 76 so and we're close to episode 300 now so yeah it's been a while anyway
right cool impress on your memory though do you remember 76 well I just know it was it was no I know it because it was one of the most popular episodes ever so it's like pops up on our kind of best of lists all the time that's why I know that one it was a really good one it was actually it was Sean I think it was the first time he had spoken about this issue after it had happened but it was already like nine months later or so so he digested it but it was very it was very cool to to get a chance to talk to him about it yeah I think that's the only place where he mentioned that he was Ariel that funded right like trying to understand the protocol if I remember though yeah the episode so crazy anyway so David what are the new sort of
research topics I know like your focus now on the auditing stuff but I'm imagining just given what you've described of your background and the fact that you tend to be reading and writing what are the research topics outside of security and auditing that you're interested in outside of security and auditing well are we still talking about zero knowledge or yes yeah yeah Taylor Swift of course oh of course um okay zero zero noise stuff I'm fascinated with the following work and this like line of folding with protostar and Proto Galaxy and yeah it's Proto Galaxy the last one for now because there's there's a new one every week so
yeah there's no lasso and something so so that's why angels are like yeah not not folding things but they're like so I guess there is like the folding there's a folding branch and the lookup branch and last one right looks amazing also um so I'm digging the lasso Gold Branch also right now and looking at in spark and high racks uh h-y-r-a-x hyrax um so this sounds like really interesting protocol and and uh to Me Maybe This isn't an interesting uh strong opinion also but it sounds like I'm wondering if if this is the death of starks actually that we're witnessing no I know we've talked about that before Guillermo um that's crazy I do not why because is it because snarks become
Starks no I think it's just that like Starks are quite limited because of the way they use hash functions and and these kind of things and the advances that we're seeing in in the the other side are so such important breakfast that I think we're gonna get to the point if it's not happening I I don't know if we're going in that direction but I right yeah I don't want to to you know getting anyone upset but I I'm if it's happening I'll be the first one to say then wow yeah I've never heard that that's wild though that's a hot egg yeah yeah that was the case in a weird way I feel like it would be I mean there's just been so much mind share around snarks there's been so many groups who've championed it
so many teams who've used it and added to it so it's not like completely out of mind that that could be the case right that like just with that much brain power focused on this particular system that it would like somehow go past it but yeah I wonder if it's just like Testament to open sourceness from the beginning Starks are now more open source but they didn't really start that way yeah if I if I would have to guess it's it's most I would say it's mostly that Starks are limited due to using hash functions and eventually this is a pretty big limiting factor you don't think that you could engineer around that and research breakthrough around that I I actually do you do okay okay the hot take is
um not around yeah not around Starks as we know them now TM you know using like standard hash functions but do think there is like very interesting work to be done in that area I would need the Mind chair yeah you could construct hash functions that are more structured than like shot 256 for example and uh that's an interesting fact yeah it's an interesting uh sort of thing so anyways I don't know maybe some listeners will scoop us but I think people have been trying to solve that for for a while so wow yeah yeah no this is also true it's my suspicion is if it was easy and probably would have been done right but but I I wouldn't I wouldn't Trump read the death of them yet but I would Trump with the death of maybe as we currently see it maybe interesting by the way I I
don't want to say that like you know there's still many projects they use Starks and and um that that doesn't mean that you know these projects are not good or anything but you know breakfast I think are gonna continue piling up on that side and I think we're gonna see more and more interesting designs and actually yeah maybe a note there because I think what you're saying too is like there's teams and systems that are built on Starks or snarks but they're usually built actually if they're in the building phase and implementation they're already built on like systems that were developed a few years ago and had sort of ossified and like yeah like now that those are secure enough if people feel comfortable enough that they're gonna implement it what you're talking about is like The Cutting Edge right like not tested yet research
style stuff and you can't you can like just like shut down your products and say guys we're just gonna rewrite everything from scratch because this new cool thing yeah like you're always you know like whatever you do you're always gonna see new cool stuff coming up you need to like restart your project I often ask teams that are building sort of like yeah more like protocol level or even like application Level like how do they how did you make your choice at what point do you have to just say I'm gonna go with this because I feel safe with it yeah David thank you so much for coming on the show sharing with us sort of all of the work you've been doing around communication education auditing security this is so exciting um and building actually I shouldn't
forget that you've also built a lot of systems that people are using really glad we got a chance to speak with you yeah and thanks again yeah this was uh I I really wanted to come here but I was waiting for the invitation yeah it's been an absolute pleasure having you and uh and thank you you know we covered a lot of ground but it's always uh entertaining chatting cool so I want to say thank you to the podcast team Henrik Rachel and Tanya and to our listeners thanks for listening