The Confusing World of Smart Contract Security - Stefan Beyer (Solidified)
ETHMilan 2023 · 9 Nov 2023 · 17:19
Stefan Beyer, who runs the audit firms Solidified and Oak Security, guides teams through the confusing world of smart contract security. The talk compares traditional audits, audit competitions and bug bounties, and shows how a blinded multi-auditor process improves coverage. It then looks beyond contract code to key management, off-chain software, infrastructure and people, and urges early testing, tooling, domain expertise and documented economic models for financial software. The Q&A covers common audit findings and how to start a career as an auditor.
Speakers
Topics
From ETHMilan 2023, hosted by ETH Milan.
Transcript
okay hey sorry for the delay I hadn't shared my presentation properly so um I'm here about to talk about Security in particular on what can teams do to be more secure when they develop their smart contracts and what can they do to have them audited or tested or or whatever so just quickly about me I'm from a distributed systems background uh I moved into cyber security at some point and now I run two companies well one company under one legal entity uh Oak security and solidified we are called solidified in the solidity ethereum ecosystem for obvious reasons and Oak Security in other ecosystems so we've been around since
2017 uh We've audited more than 200 large projects and we have a methodology which we consider slightly unique but um I'm not here to talk about methodologies I'm here to talk about auditing in general and auditing really we became a thing after the 2016 Dao attack um when I used to talk about this most people in the room knew what the Dao was but since it's like a new generation now sometimes people don't so I recommend everyone who doesn't know to read about it but basically it was the first time re-entrancy uh and other security issues became public knowledge or or public awareness and people like us and our competitors
started to provide services for security audits of smart contracts and if you forward to 2023 I just looked at the statistics of the months of uh June I think uh there were three big exploits of re-entrancy uh the same attack Vector already used in 2016 and um that's a bit surprising because um it's not difficult to protect your smart contracts against re-entrancy at least these days so there's certainly a part of the message that still hasn't gone through and if we look at the wed uh front page W is sort of a news
aggregator for SM for blockchain exploits and we see there were eight uh exploits in a single month that's a snapshot from 6th of September but it look very similar now and another thing we can see on the rec leaderboard is that eight out of the 10 top exploits were of una audited projects right so these projects have not been audited that doesn't mean that audited projects cannot be exploited but but it's certainly an interesting fact so what are smart contract audits so very simple definition is that a smart contract audit is a a time box Security review of the smart contract
the code review basically by a security expert or number of security experts there are a lot of methodologies around and a lot of tooling involved and every company Works slightly different um but it's important that it's an external team and it's important to go at an audit with a certain mindset so the mindset of breaking things is not exactly the same as building things right so a lot of developer don't make very good Auditors and a lot of Auditors make very good um developers so there's a certain mindset involved and it needs to be a fresh mindset someone who doesn't know the project or is not biased in any way uh audits are very good at detecting
certain things like re-entrancy uh and maybe some more fundamental economic flaws but they're very bad at detecting certain things uh that could be easily found in testing uh that means there's no guarantees right we we generally I don't know any audit company that provides a guarantee um but in general it cannot be given because a lot of other steps projects must take to be secure so it's one step in a chain of uh of of methods or steps um an alternative to audits that have become popular recently are audit competitions so in an audit you have a
team maybe three or four Auditors looking at a project very deeply and in order to competition if it's open to anyone right so anyone can participate uh the budget for the audit it's usually time boxed as well but there's a budget and that's split between the findings uh it's an interesting model I'll compare it to traditional audits in a minute but just for completeness there's also bu bounties so bu Bounty is what you do as a last resort it's usually a lot of money involved it basically means there's a price for reporting a bug instead of exploiting it so the idea behind this is you know uh you might want to convince a black
hat uh to go white hat and not uh not exploit it but report it and get money in a legal way um that usually means the price needs to be quite high so just comparing these there's no single answer of to this question what is best but there are certain differences and and there are certain combinations that that Mak sense so an audit usually if it's well done it's very deep you get dedicated experts looking at everything every single line of code until time is up and usually if the time is up and we haven't we we haven't got full confidence we we extend the time
right so so we want to have full confidence that we we we we've gone through completely um in a competition instead you get a lot of breath right you get much more eyes but you don't have any guarant es on who these ice belong to what experience they have and also how deep they go we have a lot of part-time Auditors that we encourage to participate in in competitions and they all report the same thing that they spend a certain amount of time in each competition and then move on right so it's like a 8020 approach they don't it's not economic for them to go very deep another issue with for them is that in in audit competition if a project is
really but the the the the budget has to be split between more people right the more findings there are the the less um the less you receive so in in most audit competition platforms uh the more you work the less you get right the harder a project is uh the less benefit an audit I can get from it and The Bu bound I mean the the advantage is obvious you don't get exploited you get a a buck report in in if everything goes well uh but it's very expensive right so you should really only think about a bu Bounty once you've done other steps so now I quickly want to talk about our approach U this is not a sales presentation so I want to keep it short
and informative but um we've developed this process over many years and we are trying to combine the benefits of the competition model with an audit a traditional audit so the way it works we assign a number of experts to a project the guiding principle is that three pairs of eyes need to look at every line of code so that might mean four or five Auditors depending on how large the project is and they all have a different background and they apply their own methodology within our process but we deliberately pick them that the the methodologies and the the approach they apply is different so that we get a wider coverage and uh it's also blinded in the
way that these Auditors they speak to each other about architecture design things they don't understand but they don't disclose their findings to each other until the end of the audit in a consensus meeting and the idea behind this is first of all to avoid freeloading because it's very easy to subconsciously skip a couple of lines of code if they're very difficult thinking your colleague will cover them but nobody wants to turn up at the consensus meeting having missed something important so everyone looks very carefully but more importantly there's no bias right so so we don't it's very easy to bi each other particularly we noticed we can avoid a lot of false positives this way uh and thirdly we have quality control right so if we have a lot of
overlap we know that the audit has covered this fairly well if there's a lot of difference between the finding in the Auditors we know that there's probably some understanding missing and we have to look deeper and finally our results are always transparent right we don't work with projects that don't want to publish a final audit report so we always insist on publishing this okay but but that's enough about us and I said before audits there's no guarantee they can't find everything and there are certain type of bucks that are extremely difficult to find in an audit uh but there other things projects should do before an audit during an audit and even after an audit and um the first thing is to you know to try to
help themselves in using the tooling that is available right now there are a lot of security tools available in the ethereum ecosystem in particular not so in others but in ethereum there are uh testing Frameworks unit testing you should really get 100% code coverage 100% meaningful code coverage uh test cover s um it's very easy to do when you do it from the beginning it's very hard to do when you do it retrospectively and it's easy to do if you use an automated framework that integrates with your tool chain uh similarly you can integrated static code analyser they're very good these days in finding certain solidity foot guns um they symbolic execution and there's fast
testing which is very useful for larger projects such as economic models that where there are interesting parameter combinations that could lead to um to strange results um the problem with tooling is that it's ideal for auditing a project from 2017 right so the the the newer projects the good teams already know this and use these tools and they don't have standard solidity exploits in their code base what we do find in these uh audits are problems with the economic model or things like um wrong implementations of
the of the economic model and uh these things are are very difficult to find with automated tooling with the exception of fast testing which which can be quite good for certain things the other thing team should do is look beyond smart contracts so this is a slide I use when I teach about security and um there there are sort of five areas I I classify in a blockchain project that require attention in terms of Security First of all the smart contracts then there's Key Management usually there are some keys that have to be managed either on the user side or on even on the admin side if it's uh uh there there's some admin involved there's a lot of offchain code right there are websites that
connect to these smart contracts there are databases there there are all sorts of offchain software components there's infrastructure these things run on machines they run on notes uh they run on networks and they're humans involved right and every cyber security expert will know that uh humans are the worst sort of Link in the chain of security but only the first two are blockchain specific right and humans they're sort of differently involved because we sort of have this idea of the intelligent user that manages their own Keys uh non- custodian type of usage so though they have a bit more responsibility but other than that that's traditional cyber security right
so you have to apply all the traditional cyber security measures beyond smart contracts and the final thing is uh you you projects should realize that they're building Financial software right so most smart contract projects manage value that's you know even if it's not a defi project let's say say s an identity even an identity is an asset and is valuable and right so there's always something of value involved so let's call it Financial software uh it's important to get domain experience right if you're building Financial software get someone with a finance background on your team with we see so many projects with very good
programmers but they don't have a single Economist or Finance expert and they're building big Financial economic models let's assume you have a finance expert and you build an economic model the right way you need to documented right so there need to be specification and documents that make it clear to the developer what they have to implement quite often we find that the economic model is simply implemented in the wrong way or or a different model is implemented uh then you know Financial software is critical software so you have to slow down a lot of uh these smart contract projects are run like a mobile game startup right go to market quickly have
several iterations that's fine but not for financial software right the finance sector which we all try to get away away from you know the traditional Finance they've got 50 years of experience in developing software and they are slow for a reason in that sense uh testing very important I've already mentioned it from the beginning we see many projects that apply testing at the end that's the wrong way to to think about it you need to do testing from day one and above all keep it simple right a lot of projects try to revolutionize the finance system all at once just you know build on incremental changes one step at a time uh incremental
innovation so that that's all really I wanted to talk about uh as I said we audit uh but we're not the only Auditors um obviously you can find us here you can find us on Twitter and uh questions so thank you for the talk I just wanted to know from your team and experience what are the top five categories of problems that you have found in all the audits that you have done um w I couldn't give you a good categorization top of my head H but probably most things we find these days are just simple Logic box it used
to be when we ordered in 2018 that we had a lot of you know wrong use of solidity U that still happens uh but it happens with not so experienced teams the second biggest would probably be something like re-entrancy which which is a traditional solidity problem but for some reason it keeps coming up in new ways uh people not realizing that when they interact with other protocols or with other tokens they are uh doing external calls and things to do with project um composability assumptions on how other things work and that they may never change that's probably one of the top categories as
well but I couldn't list five now at the top of my head thank you thank you any more questions uh this is more like how do you become a professional auditor and how do you build a career in this field for the long term so it's I mean we recruit a lot of people from audit competitions uh people you know that make a name of for themselves by back bound this audit competitions finding many things um but to get there we always recommend
to you know to the first step obviously is to learn the platform so if you want to work on solidity learn solidity and with all the things then do the capture of flags that are available the ctfs on on various resources uh the secum Boot Camp or whatever it's called is quite good as well so and then just build experience it's easy to build experience these days because you have all these open platforms where you can just practice thank you okay thank you thank you
Related talks
- ETHMilan26 - Security Panel
- The Confusing World of Smart Contract Security
- The Next Generation of Crypto Antivirus - Michael Rosmer (De.Fi)
- The Current Landscape of Web3 Security, Krum Pashov, Pashov Audit Group | ETHSofia 2025
- DeFi Security 101 2025 - Smart Contract Auditing 101
- Zero to Smart Contract Auditor in 1 Month
- Securing Ethereum Pectra before mainnet - Zigtur | Spearbit & Cantina
- Solana: The Bugs You're Missing | DeFi Security Summit 2025
- The Next Era of Web3 Security | ETHSofia 2025
