-
Notifications
You must be signed in to change notification settings - Fork 1
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
Impossible to remove the operator at index 0 of operators
array
#58
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Comments
code423n4
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
labels
Nov 15, 2021
maximebrugel
added
the
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
label
Nov 16, 2021
NoteThis issue also means that :
Every issues pointing this incorrect logic will be linked to this issue. |
This was referenced Nov 16, 2021
Note that we should use |
Using #220 as the main instead |
CloudEllie
added
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
duplicate
This issue or pull request already exists
and removed
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
labels
Dec 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
loop
Vulnerability details
Currently the operator at the 0 index can never be removed due to the require statement in
removeOperator
.Impact
If this is an operator which is no longer supported, it can't be removed.
Proof of Concept
Code of removeOperator:
(https://github.com/code-423n4/2021-11-nested/blob/main/contracts/NestedFactory.sol#L79-L86)
Let's say the value
bytes32(1)
is at index 0 of theoperators
array. If we callremoveOperator(bytes32(1))
the condition in the while loop will befalse
sincebytes32(1)
is equal tooperators[0]
. Sincei
does not get increased the require statement ofi > 0
will fail sincei
is equal to0
. The error will state that a non-existant operator can't be removed, but the operator does exist and it's impossible to remove it from the array.Recommended Mitigation Steps
Change the function code to something like this:
The text was updated successfully, but these errors were encountered: