Security Assurance Protocol - Steven Stewart (Quantstamp's CTO)
Devcon·Wed, Oct 9, 2019, 12:00 AM
Berlin Ethereum Meetup 2019/01/24
Transcript
so I'm here to talk about what we're calling the Quan stamp assurance protocol I guess I should introduce myself to you so yes I'm Steven Stewart and I'm the CTO co-founder of quanta prior to that I a computer scientist and I guess I guess I'm a PhD drop that I don't like admitting it but it seems to be the cool thing to say I noticed that Remco from 0x1 profile for him is his PhD dropout I prefer that you know think I'm going to go back and finish it but quantity I got too busy for me so last April I became a PhD drop dead but I was studying at the University of Waterloo working with Professor Derrick ray side using graphics processors for accelerating the operations of something called a Sat solver it's a tool used and formally verifying both as an example there are many applications but one employment application in software engineering is for a formal verification of software of course the word formal applying mathematics mathematical rigor verification meaning checking that certain property schools being able to prove it to do and so Richard mom myself we created quant stamp because I can't keep track back in 2017 and we had in common and I interest in the idea of securing code Richards background was in high frequency trading and he was quite familiar with all the testing and rigor that goes into that because if your strategy how you're coping strategy has a bug you can have a catastrophic effect and and so the two of us works are both had this interest and he also contributed to the Dow so obviously so we have these slides I the only show but I feel like it's getting dated now a rock remembers to that by the way these slides are yawning Thor's knees I've crossed his name so I will probably stumble a little bit through these because I don't normally present them but yawn is a ball chain researcher and he would normally be doing this so there's lots of motivation for caring about security I think most people already know about that and given the situation where once you deploy your code it's immutable then as noted here as he came out of contract security do you usually think about pre deployment options so your conventional kind of testing are they so Quan staff would do we actually do code audits as a service formal verification of baggies I always have this sort of conflict with the word security it's you know sometimes we're talking about bugs there can be a bug in there it's not necessarily issue we use these words kind of very loosely at times even though I think you know terms like security or do require precise definitions but I've come to taking a look at some of the literature and I see a lot of different definitions for computer security but anyhow my background is in more informal verification and parallel computing him I took me some time to get used to and of the branding of quant stamp as a security company security software engineering turns over in security so and so and then there's this notion of continuous security so baby the question you deploy though how can it be protected against new attacks maybe you've already done everything you could possibly do your code is absolutely perfect at that moment in time something changes in the future I don't know the EDM changes and someone discovers that they can now do a new reenter to exploit things like I could have it so my staff is interested in this idea of continuous security which is basically internally we call it monitoring basically observing a smart contract while it's live and alerting trading alerts if there's behavior some examples of what can be done there and I'll skip through that because that's not really I'm going to talk about it okay so security assurance assurance it starts with an A like quality assurance this notion of somehow being able to assure the let's say the owner or the stakeholder of a smart contract if you will that their code is secure and won't get hacked and so we have these these two actors in the ashram for code one is the stake holder the other is the security expert so the stake holder wants their code to be correct if something bad happens to make these funds digital assets and the security expert who wants to get paid for her skills for her expertise and also it has some funds available so so so yon doesn't nice job of couldn't visualize nice so as you can see here the stake holder this SSS has some amount of money that he or she is willing to competency and sorry what's this much money to compensate for an exploited contract and we have a security expert who wants to audit the code and get paid for so these this is the scenario we meet we begin with the security expert is so confident in his auditing skills that he says you know what I wanted to stake some of my own funds you know put my reputation my money on the line and else else take a certain amount to click to clean that the contract is correct now why would I why would I do that well now and why was something so this is the slide showing in somebody else bring two so not just a security expert but anybody in the world they could just say yeah I guess ten security experts have gone in and said this contract looks good maybe I'll come in - well what is doing you need we'll see we'll see momentarily but I'm talking about the staking of funds and what would it scent advise you to do that well the stake holder pays for this so it's kind of like like a premium kind of payout so stake holder pays for the stake periodically provided that the contract is not exploited because it is exploited then the security expert actually didn't you know dig there's something that he he didn't find so maybe I lose funds so so I was exactly what says here so I'm a stakeholder I said and I say okay my friends or somehow my contract is exploited actually more generically whether it's fun or something else like you might imagine namely there is some policy or some conditions that are that do not hold and as a result I want to clean these funds so I said from the security and expert perspective these are these funds are lost if the contract is exploited there let me clarify it's so the security expert and someone else they're speaking funds and they want to do that because they're getting paid by the stake holder but as soon as something bad happens to the stake holders contract that the stake holder claims what the security others of state I hope that was clear and then so this timeline simply it shows the sequence of events that would happen here contractors deploy potentially you'll see the sense down here the QSB Network report is published I actually just realized it didn't really tell you much about a corn stamps I don't know how much you know but we're building out the QSB network which is way of sourcing compute power to do formal verification or to do Co audits automated code audits so one potential step here is the automated audit is done so the sort of ticks off that checkbox and then you see the top first finger introduced times and there's a bunch of details there actually it's quite complicated we have extremely detailed diagrams on our internal wiki and too much to go into for this and I don't know what that's why this work and so obvious question is well what is an exploit so this question is being posed because we want to know when can the stakeholder claim to have suffered damages and can clean what was state so so as it says here it's up to the state holder to define the bad behavior it's up to the state her to watch her back doors basically this is the same folder at the very beginning we get into that to finding exploits defines the conditions I've lately because Paul yeah we call this policy and basically the says so here's a for example this function this is obviously a trivial example but in the body of this see here basically it says though if the balance goes to zero that indicates this is this has been hacked I think you can probably imagine the scenarios where you know balance minus zero doesn't give me was half maybe there was a deliberate reason why I went to zero this is just a toy example so naturally our team is working on creating a set of predefined policies that people could use you can probably imagine it fairly complicated I actually was pushing for this idea this is you know alternatively you could consult an Oracle to verify that as some event or curve so that that's been identified as another possibility I like the idea of being able to actually define the policy as a contract as a smart contract and that's defined up front and then the security experts who are supposed to be experts and reviewing code they can read the policy if they're comfortable with it then they're willing to state their own funds now you can also imagine maybe I'm really clever and I somehow write this off the stated policy make it really complicated actually I have my own backdoor and I'm actually trying to get the funds of their state yeah there's lots of scenarios we've talked through you know dozens of different scenarios that could happen but but I've always said if you agreed with the policy you agree with a policy so actually when I say the company is fired beware so I kind of push for this we'll see how this how this works out so guess this slide is just emphasizing a stakeholder with a smart contract and policy and content addresses and terms I [Music] just this is just another high-level representation of the same thing so the system of perspectives we have a lot of these so arguably so you'll see that the slide is titled spanking and I really in really which probably should be just titled assurance so this idea of security assurance arguably enables our helps to scale all the verification business to discuss that but by providing a marketplace for ours so code experts and others to state collateral as a claim on the contract security and a void for our deal in reports so since checks are automatic and rational actives won't stay on and secure contracts or policies which can be gamed by stakeholders I think Yanis getting at here since check- national hydras one state insecure contracts or policies so I actually don't remember always referring to Europe for reports but I think this is about where I'm saying I got earlier I said you can kind of game this you could imagine a stakeholder you can gaming it but a rational actor who studies the totem understands that they're not going to state collateral if they know there's a you know some kind of backdoor or vulnerability so so the summary here basically looping back to the beginning the idea that post appointment we can do some kind of continuous monitoring of a smart contract I kind of compare this so a few years ago I worked at a startup company called MACD and we were using GPS in memory GPU databases to do this really fast millisecond clearing of gigabytes of data actually we were thinking maybe I'd better we were talking to big fin tech companies I'm not sure if I'm actually the it's been a few years they probably can who are interested in fraud detection so it's kind of similar basically looking at certain transactions that trigger alarms certain patterns of behavior that would trigger a security incident and then the speaking which again is referring to the security assurance idea just as another sort another post-deployment approach to not quite securing but hopefully offering assurance increasing confidence in the security of that contract and that's that's the presentation yes if I was watching I saw the a very smart security expert put down say one a third on that contract then good I a non security expert then put down ten ether and then get paid ten times more than the actual expert that's a good question I don't think so I think the way we've designed this so that all the details but I'm pretty sure the way that there's it's designed to offer greater benefit to actual security experts and to incentivize them to participate there's a what's called a TCR a token curated registry that will maintain the list of I guess an accredited security experts but I don't have the exact detail the answer to your question but I can find it taking period or ten the security resource of a choice state every time and the Securities both withdraw mistake every time was people's thinking period so it's healthy before there are periods so actually we have been developing an user interface I forgot I still have needs to show you and you'll see things in here I realize the text is small for you but so this is defining what we call a pool so in the stakeholder so the pool of course this refers to the pool of state funds for assuring the contract and then there are all these different details that define how the payment works when payment period is all these different things in it expressed in terms of every block so there's minimum staging time yeah so this is just quite a bit there so this this is supposed to be the stakeholders view and then there's the speaker controls as well and this this is a prototype at the moment so if you're a state there's you state your father's you can withdraw and there you see actually in this I think the withdrawal stink but it looks like to me it's like faded because at that moment they're not eligible to whisper off oh there are a lot of details sort of go into this I'm afraid I don't have them all committed to memory but we do handle that welcome sir if you'll know what the ratio between steak and reward basically to be so MC my steak and we bought so you get promoted mistake right so what do you think what is the ratio like when do you have your money back basic for you that's a question too and so I don't know the answer what we're doing is we're running simulations so Sebastian researchers he's actually actually in the unit I was hoping he could come because he knows this inside out he's he's currently building this agent reinforced reinforcement learning simulation with an objective function to maximize the end balance for the stators and we're developing that right now and we're also doing a community quants camp community involved test trial of our current prototype and this is going to help us to get more precise answers to your question hope that makes sense so we're still very much so very much a believer some more questions the way how you define the whether there was an exploit or not if you try to encode this in smart contract it seems like it will be very very complex smart contract and I'm not even sure that is possible to to check whether what check every situation but even for every situation you can sync up you will create this mark contract that will verify and it seems like this use much contract which will verify whether there was exploit or not it also means so this is like yes the security that's good you're right but as the owner of the product or user of the product if you actually do the audit for the users of the product and this users cannot really like sure that this product is safe just because these security experts they know that they are doing what what they want so executed experts are safe because you cannot like you cannot find exploit that we were [Music] experts to QuickTime put their own funds and hopefully get paid is is a way to create greater confidence swabbies that were insurance greater confidence and the security of the smart contract I'm not saying this is perfect and I obviously the policy could be very complicate it could be it could be as simple as if the balance goes below or whatever then you know condition that could be that simple or it could be very complicated that's possible as well and I agree we would probably want to have Nationals are the policy as well because maybe you have a nefarious malicious security expert who sees a flawed and the publicity and they don't tell you because they actually want to explain it yeah yeah yeah so do you believe that the system is better than paying security experts directly oh I don't have the data to indicate that this needs to be and also who's supposed to write this contract xxi whether there was an exploit is it who's supposed to do that is there supposed to write it right so this complicated contract and yeah secure potentially actually I'm not sure where you're going yeah I mean whether you're poor as a service of right in this kind of context [Music] no author so many contracts of the service we don't do that but we do we do Arlene but we don't we don't break tomorrow contract perhaps a silly question one of the follows from that is like could there then not be a flaw in the agreement itself yeah yeah firey where we expendable touchin my thinking about wings we keep getting this there definitely creepy ways the policy is a very important part you know you obviously have to get it right but hey could you know use the security assurance protocol to stake a lot of the policy it is a yeah it will be attended it'll be in a test state for the foreseeable future and we hope to see it become a product that we share with the community it's not a product we will be selling it's a will be designed to use our token interacting with our automated audits so although it doesn't have to be someone could certainly you know fork the code and use it in a different way but something with that you know one of the one of our aims is to build utility for our token for our token motors are very important responsibilities that we have so there are various R&D projects that we work on to that end this is one of the more mature projects but still still early anybody else one most small question so imagine a 1 C 2 T except already didn't out it and then come to second and find the flow there do you do you have to analyze the first security X but already at that time because they didn't find the flaw or you will have to wait until the contract well I really appreciate your questions and feel free to reach out if you have any more questions or ideas to help us
Automatic transcript — names and jargon may be misspelled.