Open code423n4 opened 1 year ago
Hard to see this risk as M considering a time lock is already in place. The required set up for this which requires the melt ratio to be modified to extremes makes me think that QA is the appropriate severity for this.
We think should be downgraded to QA but is deserving of documentation that should make clear precise approvals should be used to protect against loss in this circumstance. maxAmounts
would work but is more gas intensive.
The caller can also redeem directly after for the same token amounts they sent in.
tbrent marked the issue as sponsor acknowledged
tbrent marked the issue as disagree with severity
0xean changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/RToken.sol#L132 https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/Furnace.sol#L66-L91
Vulnerability details
Impact
Similar protection like it has been implemented in redemption is missing in
issue()
andissueTo()
. This could lead to caller sending in significantly higher quantities of ERC20 than intended that could be preceded by a huge ratio increase in Furnace.sol to ease out a prolonged accumulation oflastPayoutBal
.Proof of Concept
Supposing full governance has been fully DAO enforced, here is the scenario:
FIX_ZERO
) on line 87 such that the Rtoken sent to this contract is increasingly stuck and accumulated aslastPayoutBal
on line 78:https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/Furnace.sol#L66-L91
After quite some time, another proposal successfully excecutes to set the melt ratio to a significantly higher value nearing to
FIX_ONE
so that the futuremelt()
will typically have all Rtoken received from the distributor melted and burned without decreasing the basket needed.Users not paying attention to the timelock annoucement will all be caught off guard when attempting to issue RToken by paying a whole basket of collaterals at much higher rates (as indicated on line 132 due to a smaller denominator,
supply
, and correspondingly relates todeposits
anddeposits[i]
on lines 136 and 148) with premium commensurate with the amount of RToken issued:https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/RToken.sol#L131-L150
Tools Used
Manual
Recommended Mitigation Steps
Consider implementing
maxAmounts
logic in the issue functions pertaining to the sending of collaterals to the Backing Manager.Introduce a sliding scale mechanism that only permits small incremental changes of melt ratio over time. This would make it more difficult for an attacker with high governance power to manipulate the ratio while also providing users with more predictability.
Consider also impleting a lower bound require check to prevent the setting of zero or near to zero ratio that circumvents the intended purpose of raising the exchange rate of RToken to Collateral.
Assessed type
Governance