The rateLimiter
functionality in the Throttle.sol
contract can be bypassed
#209
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
🤖_primary
AI based primary recommendation
🤖_52_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/libraries/Throttle.sol#L37-L65
Vulnerability details
Impact
The
rateLimiter
functionality in theThrottle.sol
contract can be bypassed. Theissuance rate limiter
can be bypassed bysandwiching
theredemption transaction
withtwo issuance transactions
by aissuer
.Let's consider the following scenario:
Consider the
lastAvailabe
amounts are as follows:Now let's consider the following transaction execution:
In this scenario,
User A
was able toissue a total of 300 RTokens (100 + 200)
within a single block, effectivelybypassing the hourly issuance rate limit of 200
.The reason this exploit works is due to the way the
Throttle.useAvailable
functionupdates
thelastAvailable values
forissuance and redemption
. When aredemption occurs
, theissuanceThrottle.lastAvailable value is increased by the redemption amount
, allowing for ahigher issuance amount
.This behavior can be exploited by alternating between issuance and redemption operations, effectively accumulating a higher available amount for issuance than the configured hourly rate limit as explained in the previous example.
Proof of Concept
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/libraries/Throttle.sol#L37-L65
Tools Used
VSCode and Manual Review
Recommended Mitigation Steps
To mitigate this vulnerability, the
Throttle.sol contract
should be modified toprevent the issuanceThrottle.lastAvailable value
fromincreasing beyond
theconfigured hourly issuance rate limit
, regardless of any redemption operations. One possible solution could be tointroduce separate checks or constraints
toensure that the lastAvailable values
forissuance and redemption are capped by their respective hourly rate limits
.Assessed type
Other
The text was updated successfully, but these errors were encountered: