The provide() function does not reset withdrawal requests, allowing an attacker to bypass risk-free yield tactics protection
The provide() function does not reset withdrawal request timestamps, allowing an attacker to bypass the risk-free yield protection by maintaining valid withdrawal requests across multiple accounts. An attacker could then provide a large amount of yin just before a profitable absorption and immediately withdraw, capturing yield without risk.
Originally disclosed on Code4rena
Submitted by minhquanym
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:
- Deposit a small amount of yin into 100 of his accounts. Note that the total value of these small amounts is negligible. Also please note that the value
100is just arbitrary value to describe the idea. It could be higher or lower depending on theREQUEST_BASE_TIMELOCKandREQUEST_VALIDITY_PERIOD. - Regularly request withdrawals for these accounts to ensure that at least one account has a valid request at any given time. This can be easily achieved by requesting a withdrawal from the first account at timestamp
X, the second atX + REQUEST_VALIDITY_PERIOD, the third atX + 2 * REQUEST_VALIDITY_PERIOD, and so on. The first account request will expire atX + REQUEST_BASE_TIMELOCK + REQUEST_VALIDITY_PERIOD, but now second request account becomes valid because it was requested atX + REQUEST_VALIDITY_PERIOD. - Since the
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 callsremove().
Recommended Mitigation Steps
Reset the withdrawal request in the provide() function.
Assessed type
MEV
tserg (Opus) confirmed, but disagreed with severity and commented:
The economic feasibility of the exploit is questionable, and it requires extensive infrastructure to be set up and maintained. Ultimately, no user funds are at risk.
0xsomeone (judge) decreased severity to Medium and commented:
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.
Note: For full discussion, see here.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The provide() function fails to reset the withdrawal request timestamp, so a user can add funds without invalidating an existing withdrawal request.
Impact
An attacker could manipulate reward distribution to gain a larger share of collateral from absorptions, though the exploit requires significant infrastructure and gas costs, reducing economic viability.
What the attacker needed
Multiple accounts; small initial deposits; regular withdrawal requests; gas for transactions
The fix
The provide() function should reset the withdrawal request timestamp when new funds are provided.
How it was found
- Deposit a small amount of yin into many accounts.
- Regularly request withdrawals from these accounts so that at least one has a valid request at any time.
- When a profitable absorption is expected, provide a large amount of yin to the account with a valid withdrawal request.
- Immediately call remove() to withdraw the provided yin and earned yield.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this protocol, users can deposit funds (yin) to earn rewards when liquidations happen. To prevent people from only depositing right before a profitable event and withdrawing immediately after, the system requires users to request a withdrawal and wait. The bug is that depositing more funds does not reset that waiting period, so an attacker can keep a withdrawal request ready on many accounts and use one to deposit and withdraw quickly when it suits them.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.