Open c4-bot-8 opened 9 months ago
bytes032 marked the issue as sufficient quality report
bytes032 marked the issue as primary issue
tserg (sponsor) confirmed
tserg marked the issue as disagree with severity
The economic feasibility of the exploit is questionable, and it requires extensive infra to be set up and maintained. Ultimately, no user funds are at risk.
The Warden has demonstrated how a malicious user can game the queued withdrawal system of Opus and cycle withdrawal authorizations between multiple accounts to always retain one that can immediately withdraw at any given point in time. As a provision will not reset those requests, the account whose withdrawal authorization is valid at a point a lucrative absorption occurs can be exploited to acquire a bigger share of the collateral.
I believe a medium-risk grade is better suited for this finding as only the "reward" distribution is manipulated and it requires extensive money-translated effort (i.e. gas for maintaining positions active) that will further reduce the economic viability of this exploit.
alex-ppg changed the severity to 2 (Med Risk)
alex-ppg marked the issue as satisfactory
alex-ppg marked the issue as selected for report
Hi @alex-ppg, I would like to highlight that this finding shows a unique way to exploit the withdrawal queue using multiple accounts. The other mentioned reports are only able to bypass the time lock for a short period of time, while this report shows that it could be bypassed indefinitely. Thank you for your consideration.
Hi @alex-ppg, I would like to highlight that this finding shows a unique way to exploit the withdrawal queue using multiple accounts. The other mentioned reports are only able to bypass the time lock for a short period of time, while this report shows that it could be bypassed indefinitely. Thank you for your consideration.
hi @minhquanym, but the impact is still the same - implementing risk-free yield tactics
Lines of code
https://github.com/code-423n4/2024-01-opus/blob/04583e0411dbf8027952d668a8678fda0cb5b160/src/core/absorber.cairo#L441
Vulnerability details
Impact
In the Opus protocol, the absorber is a stability pool that permits yin holders to contribute their yin and participate in liquidations (also known as absorptions) as a consolidated pool. Provided yin from users could be absorbed during an absorption. In return, users receive yang, which usually has a higher value than the absorbed yin. However, in the event of bad debt, it could be less. This situation could lead to risk-free yield frontrunning tactics, where an attacker only provides yin when the absorption brings profit then removing all yin right after that.
The Opus team is aware of this attack vector and has therefore implemented a request-withdraw procedure. Users must first request a withdrawal and wait for a certain period before executing the withdrawal.
However, the
provide()
method does not reset these request timestamps, which allows an attacker to bypass this safeguard.Proof of Concept
The attacker's tactics will be:
100
is just arbitrary value to describe the idea. It could be higher or lower depending on theREQUEST_BASE_TIMELOCK
andREQUEST_VALIDITY_PERIOD
.X + REQUEST_VALIDITY_PERIOD
, the 3rd atX + 2 * REQUEST_VALIDITY_PERIOD
, and so on. The 1st account request will expire atX + REQUEST_BASE_TIMELOCK + REQUEST_VALIDITY_PERIOD
, but now 2nd request account become valid because it has requested atX + REQUEST_VALIDITY_PERIOD
.provide()
function does not reset the request, the attacker can simply select one account with a valid removing request and perform the "risk-free yield tactics". He does this by providing a large amount of yin to this account to earn yield and then immediately callingremove()
.Tools Used
Manual Review
Recommended Mitigation Steps
Reset the withdrawal request in the
provide()
function.Assessed type
MEV