-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: if a bug exists in a base contract of an in-scope contract or a library used by an in-scope contract and will manifest itself while interacting with an in-scope contract, treat the bug as in-scope #136
Comments
I agree this should be explained to the sponsor during booking/scouting and we should recommend including any library or base contract (unless it has been audited sufficiently). However, the contest's pool size is based on the total SLOC, so we have to know in advance what contracts are in scope. The sponsor can't just implicitly add more contracts to scope by agreeing to the question you presented.
This might be true for some contracts/libraries, but for many others there can be a big difference between having to just understand what the code is expected to do and actually deep diving and verifying that there are no bugs in the code. |
@0xA5DF , first of all, thank you for sharing your point of view! I really appreciate it. If you don't mind, I would like to respond to several points you stated.
The thing is that some Sponsors already do that - sometimes they state in contests' Readme that they will also accept findings from OOS files if they affect in scope contracts (it's even a broader category than only base contracts). Please correct me if I'm wrong, but I think that they don't have to increase contest's pool by providing such statement. My point here is, that if Sponsors can bring some OOS contracts in scope anyway, just by stating this in contest's Readme and not additionally paying for it, it's just unfair for other Sponsors who aren't aware that it's possible - if they were aware, I think that the vast majority would do it as additional findings will make them more secure for no additional cost.
I agree that the case can indeed be different for more complex contracts / libraries, but if an auditor already undrestands what the code does, it's easier to find bugs than if they had to start from scratch. Moreover, it's often the case that base contracts / libraries are forks of existing ones (from OpenZeppelin or Solmate, for example). It means that many auditors already understand them and even if they contain |
Can you please point out contests where sponsors did that?
You might be right in some cases, but we can't have a general rule to add additional files to scope without counting those lines in the total SLOC. |
I will give two examples, but I'm doing this only to prove my previous statement, not to complain about Sponsors behaviour (as I wrote earlier, I would actually prefer to have all files that in-scope contracts interact with to be in-scope). One example is foundation. Quote from Readme:
Another one is Maia:
While it may seem the ideal solution, I don't think it really is. Consider the following example:
One way of solving this, that comes to my mind, that will benefit both Sponsors and Wardens, would be to dedicate some % of H/M pot (say, 5% or 10% or any other number) for issues from OOS base contracts of in-scope contracts (and libraries used in in-scope contracts). If no such issue is found, it will be included in the "normal" H/M pot. I think that both Sponsors and Wardens would be satisfied with this solution because:
But that is just an idea that came to my mind. |
Integration is something that happens in the contracts in scope, therefore it makes sense to consider those issues in scope (the root cause is in the contract in scope). Anyways, I think that the rules of C4 should be simple, if the sponsor omits a contract from scope then it should stay OOS. If there's a bug that was discovered in the OOS contract (whether it's related to the contracts in scope or not) then the sponsor should consider awarding the warden besides the contest. |
Me, @trust1995 and @dmvt have spent quite some time on this I believe this boils down to how some people think As SWE, obviously the child contract is part of the scope, that is the definition of what the contract IS, if I'm A, then obviously A is in scope As Salespeople and as Security Researchers, that is not obvious, when quoting the contest, those lines are not part of the quote, and are not considered. I have had a chat with staff about ensuring that this is handled when scoping. If scoping was done in a way that:
Then we wouldn't have this issue Hence, why the SC has made the decision, changing the process avoids having a rule that can be bent. I believe all 3 from the SC would agree that:
Sent this to staff and would like to hear their thoughts on this |
I am discussing this with our Booking team, but I think @0xA5DF and @GalloDaSballo have summed up the salient counter-points quite well. In practice, since audits are priced in relation to LOC count, and sponsoring projects are well-positioned to understand the context of their own codebase and how libraries / base contracts interact with it, it's reasonable for sponsors to wish to have discretion over the scope definition rather than for C4 to have a hard and fast rule about including all base contracts and libraries in scope. I definitely understand @bart1e's concerns and arguments here, and am sympathetic to them, however practically speaking I don't know that we can reasonably insist on including all libraries in the scope for every audit. As I said, I'm consulting with other staff to check my assumptions here, but my inclination is to continue ahead with the approach outlined in the SC recommendation. |
I don't believe that's the case today, because this dynamic is not made explicit / clear The sponsor can without a doubt make these comments, but it seems like as of today this is not explicitly asked In lack of explicitly asking, you'd expect SWE to tell you to skip the libraries (because they think they are in scope) and business people explicitly add the libraries We have had an instance of one file being a governor (literally just a call to a constructor) that imports an implementation of the governor, this is an example of the disconnect because at that point, why even have the one line of the constructor in scope? |
I think we should make the general rule that Alex suggested - to not allow imports to be excluded from scope, with exceptions being made at the discretion of the scouts. The sponsor would be asked during booking whether they have such contracts that they'd like to exclude and the reason for that, and the scout will review that during the scouting phase. |
This is not what I said I believe the sponsor can mark OSS whatever they want, but the mechanics of how SLOC are calculated has to be explained to them Any SWE can understand that this process is ignoring inheritance, and can adapt, provided that this is made clear during scoping |
I was referring to an earlier comment you made:
I agree it should be better communicated to the sponsor, but I think the best way to communicate that to the sponsor is to raise a red flag once the booking team sees such a case, and let the scout review the case and ensure the sponsor is making the right decision and understands the consequences (+ count the OOS lib as additional LOCs when needed). |
Note: this case was already mentioned here and the following verdict by the Supreme Court was made:
However, I believe that there wasn't enough discussion on this topic and I would like to present arguments for treating such findings as in-scope.
Arguments
I will now shortly enumerate all of my arguments and I will elaborate on each of them in the next section.
The arguments are as follows:
Justification
X
andX'
is in-scope and inherits fromX
. The entire situation described in the previous points is just unfair for the Sponsors as they already booked an audit forX'
and it is natural to expect that after all reported issues inX'
are fixed, thenX'
is safe. But it won't, unless they explicitly put all base contracts in-scope. First of all, they may even be unaware that they have to report every single base contract and libraries thatX'
uses in order forX'
to be entirely audited. Secondly, even if they are aware, they may still miss some base contracts or libraries. I think that if we asked Sponsors whether, by includingX'
in scope, they would like Wardens to search for bugs inX
as well, the vast majority would say "Yes" - they are already paying for the audit, so having more valid issues submitted will not make them pay any more money (and it will make the code more secure), but if Wardens purposely don't report valid findings, Sponsors will pay for it, possibly even a lot of money in Bug Bounty program (or if the funds will be stolen using unreported exploit).Suggestions
As I have stated in the previous section, I believe that treating findings from base contracts (and used libraries) of in-scope contracts that are OOS, as in-scope would benefit both sides (Wardens and Sponsors), so my natural suggestion is to start doing it.
The change that I would suggest, is to treat all issues from base contracts (and libraries used in in-scope contracts), that can manifest while interacting with in-scope contracts, as in-scope by default.
Alternatively, the following question should be added to a questionnaire that normally is in the "Scoping Details" section of Readme of every audit:
It will make the case clear for everyone:
Adding this additional question to the questionnaire is a very small change and will help to find out what is Sponsors' view on this matter.
The text was updated successfully, but these errors were encountered: