Closed c4-bot-5 closed 8 months ago
gzeon-c4 marked the issue as sufficient quality report
gzeon-c4 marked the issue as primary issue
gzeon-c4 marked the issue as insufficient quality report
rate updated before redeem
JustDravee marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/tokens/PrincipalToken.sol#L879-L894
Vulnerability details
Impact
_updatePTandIBTRates
method that decreases the PT rate has no protection against unbounded/repeated calls. An attacker could manipulate the parameters to_computeYield
to generate arbitrary negative yield amounts. They could then call_updatePTandIBTRates
repeatedly to drain the PT rate to 0.For example, they could:
Deposit tokens into the protocol to mint PT shares.
Borrow a flash loan of IBT tokens.
Use the flash loaned IBT to manipulate the IBT rate oracle downwards.
Call
_computeYield
with the manipulated rate to generate a large negative yield amount.Call
_updatePTandIBTRates
to decrease PT rate based on the false negative yield.Return flash loan and repeat process in a loop draining PT rate to 0.
Redeem PT shares for underlying assets while PT rate is 0.
This allows an attacker to arbitrarily drain value from the protocol by exploiting unbounded
_updatePTandIBTRates
calls.The reason is that protection against repeated
_updatePTandIBTRates
calls in a single transaction.The attacker can drain PT rate to 0 via unbounded manipulation.
The lack of protection against repeated
_updatePTandIBTRates
calls allows attackers to arbitrarily drain the PT rate to 0. This could enable attackers to extract full collateral value from the protocol after manipulating the rate.Proof of Concept
The
_updatePTandIBTRates
method decreases theptRate
based on detected negative yield. However, there is no limit on how many times it can be called in a single transaction. The issue is_updatePTandIBTRates
lacks a counter or limit on repeated calls: File: src/tokens/PrincipalToken.sol::_updatePTandIBTRatesSummary
Lack of protection against repeated
_updatePTandIBTRates
calls allows attackers to arbitrarily drain PT rate. This could lead to loss of collateral value from the protocol.Tools Used
Vs
Recommended Mitigation Steps
Add a
ptRateUpdateCount
state variable and limit_updatePTandIBTRates
to 1 call per transaction.Assessed type
Reentrancy