Closed code423n4 closed 1 year ago
bytes032 marked the issue as high quality report
bytes032 marked the issue as primary issue
Valid issue. One thing that the report is missing is the potential for DoS through the sync() function.
It has various different nuances:
Note that even if WETH is donated to resolve the block, the accounting of WETH reserves will still be completely wrong
psytama (sponsor) confirmed
Best to add the POC in the submission, I think I'll change the primary due to that
GalloDaSballo marked issue #2146 as primary and marked this issue as a duplicate of 2146
GalloDaSballo marked the issue as satisfactory
GalloDaSballo changed the severity to 2 (Med Risk)
GalloDaSballo marked the issue as partial-50
GalloDaSballo changed the severity to 3 (High Risk)
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L941-L968 https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L975-L990 https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L995-L1008
Vulnerability details
Impact
The contract's WETH amount gets permanently bricked.
Proof of Concept
A user can call
addToDelegate()
and give WETH, that other people can use for bonding with their rDPX in exchange for a certain percentage appointed by the delegatee.There the user gets added to the
delegates
array and also the delegated WETH amount gets added to a variable calledtotalWethDelegated
, which is used for keeping track of the part of WETH in the contract, which is owned by delegates. That variable is also used insync()
for setting the virtual balance of WETH in the contract.The issue arises due to the WETH amount not being removed from
totalWethDelegated
upon withdrawal.Consider the following PoC demonstrating the issue:
https://gist.github.com/CrisCodesCrap/fb5ad3b5a5c95670d2ae44c895b42ab5
Tools Used
Manual review, Foundry
Recommended Mitigation Steps
Consider removing the amount upon withdrawing the delegated WETH from the protocol.
Assessed type
Other