Open howlbot-integration[bot] opened 3 months ago
settleTrade
which disallows OOG reverts.distributeTokenToBuy
is itself is just a helper. The trades distribute automatically and this function only exists for when for some reason that didn't happen or more tokens were directly transferred to them.And distributeTokenToBuy and distributeTokenToBuy do not depend on setDistribution being called, they can be called individually, which makes it difficult to accumulate a large number of undistributed tokens. will downgrade it to QA.
thereksfour changed the severity to QA (Quality Assurance)
thereksfour marked the issue as grade-a
thereksfour removed the grade
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/3f133997e186465f4904553b0f8e86ecb7bbacbf/contracts/p1/Distributor.sol#L61-L71
Vulnerability details
Impact
Users who stand to gain more distribution after the change could prevent distribution so they gain an unfair distribution.
Proof of Concept
Distributor.sol#L61-L71
When setting/updating distribution shares, the distributor attempts to distribute all pending tokens before making any changes. This ensures that tokens are distributed fairly according to the pre-update distributions.
When using try-catch, the default gas sent is 63/64 of the transaction gas. Although distribution is set by governance proposal, anyone can carry out the final execution. The result is that an interested party could provide just little enough gas to cause the distribution to trigger a OOG error but still have enough gas to finish updating the revenue shares. After the new distribution is in place they can distribute the token and benefit unfairly.
Tools Used
Manual review
Recommended Mitigation Steps
The try-catch pattern in setDistribution and setDistributions should be updated with the pattern that reverts on OOG errors.
Assessed type
Other