-
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
OperatorProposal.sol: Leftover ETH is not refunded to the msg.sender #5
Comments
0xean marked the issue as duplicate of #30 |
0xean marked the issue as not a duplicate |
0xean marked the issue as primary issue |
Marking this as primary issue since it has a bit more context. Looking forward to sponsor comment on this. As described in my comment on #30 I am not entirely sure that this qualifies as M based on the fact that the caller presumably is able to call with the correct value. QA may be more appropriate |
@0xean
|
@HollaDieWaldfee100 is right, there is at least one case with the |
0xble marked the issue as sponsor confirmed |
0xean marked the issue as satisfactory |
0xean marked the issue as selected for report |
@0xean Sorry I was in a time crunch this contest and I didn't get a chance to finish my QA report... but this is what I meant for my low 2. Is there a chance I can get a partial-25 here? If not, I totally understand. |
No, I am sorry, the contests are time based for a reason and your report isn't satisfactory on its own. |
Lines of code
https://github.com/code-423n4/2023-04-party/blob/440aafacb0f15d037594cebc85fd471729bcb6d9/contracts/proposals/OperatorProposal.sol#L25-L49
Vulnerability details
Impact
The
OperatorProposal
contract is a type of proposal that allows to execute operations on contracts that implement theIOperator
interface.Upon execution of the proposal it might be necessary that the
executor
provides ETH.This is true especially when
allowOperatorsToSpendPartyEth=false
, i.e. when ETH cannot be spent from the Party's balance. So it must be provided by theexecutor
.The amount of ETH that is needed to execute the operation is sent to the operator contract:
Link
data.operator.execute{ value: data.operatorValue }(data.operatorData, executionData);
The operator contract then spends whatever amount of ETH is actually necessary and returns the remaining ETH.
For example the
CollectionBatchBuyOperator
contract may not spend all of the ETH because the actual purchases that are made are not necessarily known at the time the proposal is created. Also not all purchases may succeed.So it is clear that some of the ETH may be returned from the
operator
to theOperatorProposal
contract.The issue is that the remaining ETH is not refunded to the
executor
and therefore this results in a direct loss of funds for theexecutor
.I discussed this issue with the sponsor and it is clear that the remaining ETH needs to be refunded when
allowOperatorsToSpendPartyEth=false
.However it is not clear what to do when
allowOperatorsToSpendPartyEth=true
. In this case ETH can be spent from the party's balance. So there should be limited use cases for theexecutor
providing additional ETH.But if the
executor
provides additional ETH what should happen?Should the ETH be taken from the
executor
first? Or should it be taken from the Party balance first?The sponsor mentioned that since there are limited use cases for the
executor
providing additional ETH it may be ok to not refund ETH at all.I disagree with this. Even when
allowOperatorsToSpendPartyEth=true
there should be a policy for refunds. I.e. the necessary ETH should either be taken from the Party's balance or from theexecutor
first and any remaining funds from theexecutor
should be returned.However since it is not clear how to proceed in this case and since it is less important compared to the case where
allowOperatorsToSpendPartyEth=false
I will only make a suggestion for the case whereallowOperatorsToSpendPartyEth=false
.The sponsor should decide what to do in the other case and make the appropriate changes.
Proof of Concept
When the
executor
executes anOperatorProposal
,operatorValue
amount of ETH is sent to theoperator
contract (whenallowOperatorsToSpendPartyEth=false
all of these funds must come from themsg.value
):Link
Currently the only
operator
contract that is implemented is theCollectionBatchBuyOperator
and as explained above not all of the funds may be used so the funds are sent back to the Party:Link
However after calling the
operator
contract, theOperatorProposal
contract just returns without sending back the unused funds to theexecutor
(msg.sender
).Link
So there is a loss of funds for the
executor
. The leftover funds are effectively transferred to the Party.Tools Used
VSCode
Recommended Mitigation Steps
As mentioned before, this is only a fix for the case when
allowOperatorsToSpendPartyEth=false
.Fix:
The text was updated successfully, but these errors were encountered: