User withdrawals are dependent on admin actions
The contract owner can toggle a flag that prevents user withdrawals, and withdrawals only become possible again when the owner calls specific auction functions. If the owner loses their key or acts maliciously, users could have their funds permanently locked.
Source: https://github.com/sherlock-audit/2022-11-opyn-judging/issues/83
Found by
Deivitto, dipp, Jeiwan, thec00n
Summary
Users can deposit USDC and Crabv2 tokens at any time, but there are limitations around withdrawals. Users could have permanently locked up their funds if specific owner actions are not triggered.
Vulnerability Detail
The owner can call toggleAuctionLive() and prevent any withdrawals from occurring. User withdrawals are only enabled again when the owner calls withdrawAuction() or depositAuction(). If the owner loses their key or becomes malicious and never calls these functions, then the users have no way of withdrawing their funds.
Impact
Users could get their funds locked up in the Netting contract without a way to withdraw them again.
Code Snippet
https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L276-L283
https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L321-L327
https://github.com/sherlock-audit/2022-11-opyn/blob/main/crab-netting/src/CrabNetting.sol#L223-L226
Tool used
Manual Review
Recommendation
Lock up times are necessary for the system to work but users should always be able to withdraw their funds eventually without any dependecy of the owner. When users deposit tokens, a meaningful expiry timestamp should be set by the contract. Before the expiry deposits are locked and the funds can be used during auctions. After expiry deposits are skipped and users can withdraw them at any time.
Discussion
sanandnarayan
fix: https://github.com/opynfinance/squeeth-monorepo/pull/807
thec00n
It covers at least the case where the key or signing powers are lost. Owner could still push out the turnOffAuctionLive() time threshold by calling toggleAuctionLive() twice just before the auction can be turned off by users. Just saying ...
sanandnarayan
alternate fix: https://github.com/opynfinance/squeeth-monorepo/pull/809
jacksanford1
Comment for report: thec00n accepts the alternate fix.
pauliax
Escalate for 2 USDC.
"If the owner loses their key or becomes malicious and never calls these functions, then the users have no way of withdrawing their funds."
When reviewing contracts we are advised not to report admin overprivileged issues as per official guidelines:
Usually, such issues are acknowledged but closed, e.g. https://github.com/sherlock-audit/2022-10-illuminate-judging/issues/10
sherlock-admin
Escalate for 2 USDC.
"If the owner loses their key or becomes malicious and never calls these functions, then the users have no way of withdrawing their funds."
When reviewing contracts we are advised not to report admin overprivileged issues as per official guidelines:
Usually, such issues are acknowledged but closed, e.g. https://github.com/sherlock-audit/2022-10-illuminate-judging/issues/10
You've created a valid escalation for 2 USDC!
To remove the escalation from consideration: Delete your comment. To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
hrishibhat
Escalation rejected
The readme in this contest mentions the admin to be "restricted to specific actions", which changes the rules for this case, implying that the admin should not have access to or be able to influence actions like user withdrawals, which in this case it does.
sherlock-admin
Escalation rejected
The readme in this contest mentions the admin to be "restricted to specific actions", which changes the rules for this case, implying that the admin should not have access to or be able to influence actions like user withdrawals, which in this case it does.
This issue's escalations have been rejected!
Watsons who escalated this issue will have their escalation amount deducted from their next payout.
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 contract design makes user withdrawals dependent on owner-triggered functions, with no user-controlled fallback.
Impact
Users could have their funds locked in the contract without a way to withdraw them if the owner loses their key or becomes malicious.
What the attacker needed
Owner loses key or acts maliciously
The fix
The contract should set a meaningful expiry timestamp for deposits, after which users can withdraw their funds at any time without owner intervention.
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 smart contract, users can put money in, but taking it out depends on the owner doing certain things. If the owner disappears or turns bad, users cannot get their money back. This is like a bank where only the manager can unlock the door, and if the manager loses the key, everyone is stuck inside.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.