Open code423n4 opened 1 year ago
hansfriese marked the issue as satisfactory
hansfriese marked the issue as primary issue
Marked as primary because of the concise explanation and the mitigation suggestion.
wukong-particle marked the issue as sponsor acknowledged
Acknowledged the issue, though the fix might not be the same as suggested. We will mitigate it with an upper bound on the treasury rate, and perhaps the timielock mechanism
wukong-particle marked the issue as sponsor confirmed
hansfriese marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-05-particle/blob/1caf678bc20c24c96fc8f6b0046383ff0e9d2a6f/contracts/protocol/ParticleExchange.sol#L800
Vulnerability details
Impact
In the protocol, lenders have to pay a small treasury fee when they claim their interest. The contract owner can change this
_treasuryRate
at any time using the functionsetTreasuryRate()
.However, when the admin changes the rate, the new treasury rate will also be applied to active loans, which is not the agreed-upon term between the lenders and borrowers when they supplied the NFT and created the loan.
Proof of Concept
Consider the following scenario:
_treasuryRate = 5%
._treasuryRate
to50%
. Now, if Alice claims the interest, she needs to pay 0.5 ETH to the treasury and keep 0.5 ETH._treasuryRate
is updated. The point is that Alice only agreed to pay a5%
treasury rate at the beginning, so the new rate should not apply to her.Tools Used
Manual Review
Recommended Mitigation Steps
Consider storing the
treasuryRate
in the loan struct. The loan struct is not kept in storage, so the gas cost will not increase significantly.Alternatively, consider adding a timelock mechanism to prevent the admin from changing the treasury rate.
Assessed type
Other