Sushi Swap New Routing Contract Bug
Notice: This page is a freshly imported case study from the original repository. The original content was in a different format, and may not have relevant information for all sections. Please help restructure the content by moving information from the 'About' section to other sections, and add any missing information or sources you can find. If you are new here, please read General Tutorial on Wikis or Anatomy of a Case Study for help getting started.
Sushi is a decentralized exchange (DEX) that allows users to trade cryptocurrencies without the need for a central operator administrator. Users can buy and sell across 11,700 cryptocurrency pairs and trade tokens across ten crypto networks. Sushi’s products include a decentralized exchange, a decentralized lending market, yield instruments, an auction platform, an AMM framework, and a payroll solution for vesting and streaming. The platform maintains decentralized governance of $SUSH token holders, while the day-to-day operations are done by a core team. However, over $3.3 million was stolen from SushiSwap users via a new routing contract. The attacker was able to create a fake Univ3 pool and drain tokens from any address which had approved it. Although the damage wasn't enormous or particularly widespread, this incident is a bad look for an already-embattled protocol.
About Sushi Swap
Smart Contract: [1]
"Buy and Sell Instantly on Sushi. Whenever. No registration needed. Over 400 tokens to trade at your fingertips."
"Sushi is a Decentralized Exchange (DEX) we aim to be a one-stop shop for all your decentralized finance (DeFi) needs. Sushi allows users to trade cryptocurrencies without the need for a central operator administrator, using their own preferred connected crypto wallet. Users can buy and sell across 11,700 cryptocurrency pairs and trade tokens across ten crypto networks (and counting) via the newly launched cross-chain swap (SushiXSwap). Next to trading you can: earn, stack yields, lend, borrow, leverage all on one decentralized, community driven platform."
"Sushi’s products are configured in a way that allows the entire platform to maintain decentralized governance of $SUSH token holders, while continuing to innovate on the collective foundations by design. Whereas major structural changes are voted on by the community, the day-to-day operations, rebalancing of pools and ratios, business strategy and overall development implementation is done by a core team.
Thus far, the core products, include:
a decentralized exchange (Swap) a decentralized lending market (Kashi) yield instruments (Onsen) an auction platform (Miso) an AMM framework (Trident) and a payroll solutions for vesting and streaming (Furo)"
"Your keys, your coins. Own your own crypto, just like cash in your wallet. Fully decentralized & self custody of your funds means your money in your wallet, as it should be."
"Move assets across networks in seconds. We will always find you the best rate, no matter what network you’re on, with no extra fees."
"Earn passive income with your coins. With multiple ways to passively earn yield on your coins, you can choose your own yield stack and make your money work for you, all in the background, 24/7."
"Over $3.3M was stolen from SushiSwap users over the weekend via a new routing contract.
All users who had approved Sushi’s 4 day old RouteProcessor2 contract at the time of the incident, were at risk, across 14 chains.
Sushi Head Chef, Jared Grey, acknowledged the bug, urging users to revoke approvals. He later stated that the protocol is now safe to use, and the exploited contract has been removed, as well as promising a full post-mortem on events.
Amongst the chaos, DeFi’s favourite villain got rekt for 1800 ETH, and there was plenty of whitehacking activity.
One user claimed to have targeted 0xSifu as a whitehat, though the attempt appeared to have been botched, with only 100 ETH eventually returned. BlockSec also got involved, adding to their impressive list of recent whitehacks.
Luckily, the days-old contract had relatively few approvers, and this didn’t turn out to be the AMM-ageddon it could have been."
"The new contract contained the function, processRoute, which is insufficiently protected against accepting arbitrary data.
The attacker was able to create a fake Univ3 pool, and insert their own contract address in place of a genuine liquidity pool. During the uniswapV3SwapCallback function, the contract is then able to drain (or 'yoink') tokens from any address which had approved it."
"SushiSwap router exploit comes from a bad callback. Although the line 328 comment is correct, line 340 does not check the pool deployer. So you can impersonate a V3Pool, do a no-op swap, call safeTransferFrom on an arbitrary ERC20 and arbitrary from address on line 347"
"The damage wasn’t enourmous, nor particularly widespread. Users were either drained or revoked quickly, and whitehat efforts certainly helped to soften the PR blow."
"But this is a bad look for an already-embattled protocol, nonetheless."
"Grey receiving an SEC subpoena, criticism of a paltry bug bounty programme, and large operating expenses (including 500k for Grey himself)...
It appears the drama is far from over for Sushi."
This is a global/international case not involving a specific country.
The background of the exchange platform, service, or individuals involved, as it would have been seen or understood at the time of the events.
Include:
- Known history of when and how the service was started.
- What problems does the company or service claim to solve?
- What marketing materials were used by the firm or business?
- Audits performed, and excerpts that may have been included.
- Business registration documents shown (fake or legitimate).
- How were people recruited to participate?
- Public warnings and announcements prior to the event.
Don't Include:
- Any wording which directly states or implies that the business is/was illegitimate, or that a vulnerability existed.
- Anything that wasn't reasonably knowable at the time of the event.
There could be more than one section here. If the same platform is involved with multiple incidents, then it can be linked to a main article page.
The Reality
This sections is included if a case involved deception or information that was unknown at the time. Examples include:[5][6][7]
- When the service was actually started (if different than the "official story").
- Who actually ran a service and their own personal history.
- How the service was structured behind the scenes. (For example, there was no "trading bot".)
- Details of what audits reported and how vulnerabilities were missed during auditing.
SEC Investigation of Jared Grey
The SEC has sent a subpoena to Sushi Swap head chief Jared Grey. Jared Grey shared information with the community[9].
Since my announcement that the SEC had served a subpoena on me related to Sushi, I have received numerous questions from the community concerning that topic.
In deference to the fact that the SEC’s subpoena reflects an ongoing and non-public investigation, I am very limited in the amount and type of information that is appropriate to share publicly.
Nevertheless, to give the community more information, my counsel and I have prepared a non-privileged “FAQ” below for the public to answer the most frequently asked questions I have received.
None of what follows is legal advice.
I am grateful for the community’s understanding and support.
What is going on?
Last month, Jared Grey received a subpoena from the U.S. Securities and Exchange Commission seeking documents and information relating to Sushi.
Has “Sushi” been served with a subpoena?
We do not know, one way or the other, whether the SEC has purported to serve a subpoena on any other person or entity that it believes represents the Sushi community.
Has anyone else been served with a subpoena related to Sushi?
We do not have first-hand knowledge, one way or the other, whether other entities or individuals have been served with a subpoena related to Sushi.
What is being done in response?
Jared retained counsel to represent him in response to the SEC’s subpoena.
Who is that counsel? Do they have experience representing clients in matters such as this?
Jared retained Jason Gottlieb of Morrison Cohen LLP. Jason Gottlieb and his partners have extensive experience representing companies and individuals in response to regulatory and law enforcement investigations, particularly in the digital assets and cryptocurrency space. Jason’s profile is available here: Jason P. Gottlieb | Morrison Cohen LLP 41.
What will happen next?
Jared, through his counsel, is cooperating with the SEC’s subpoena. Jared’s employer, Internet Three Software Company, is also responding to the subpoena voluntarily to cooperate with the SEC’s investigation.
Can you tell me more about the documents or information sought in the SEC’s subpoena?
Unfortunately, no. The subpoena is part of a non-public, fact-finding inquiry by the SEC. Therefore, in deference to the SEC’s process, neither Jared nor we can share more.
Should we be making the subpoena public, like some other projects do?
We do not think it would be helpful to the course of the investigation or to the Sushi community, to do that.
Who exactly does Morrison Cohen represent?
Morrison Cohen represents only Jared and his employer, Internet Three Software Company, in connection with the SEC’s investigation concerning Sushi. At present, Morrison Cohen does not represent “Sushi” (as a community) or any other members of the Sushi community in connection with the SEC’s inquiry.
Is Jared holding himself out as representing “Sushi”?
Jared can only produce documents and information in his own possession, custody, or control. “Sushi,” as a DAO, consists of a software protocol and people around the world who use it in various ways. Jared can advocate for the interests of the Sushi community but cannot possibly “represent” the entire community.
Does the SEC believe that Jared, Internet Three Software Company, or Sushi has done anything wrong?
The investigation does not mean that the SEC has concluded that Jared, Internet Three Software Company, or Sushi has violated any law. Also, the investigation does not mean that the SEC has a negative opinion of any person, entity, or asset. The SEC’s investigation is a non-public, fact-finding inquiry trying to determine whether there have been any violations of the federal securities laws. To the best of our knowledge, the SEC has not (as of this writing) made any conclusions that anyone affiliated with Sushi has violated United States federal securities laws.
Has the SEC made any findings of fact or law in connection with its inquiry into Sushi?
None of which we are aware.
Why did Jared propose to create the Sushi Legal Defense Fund (Establish Sushi Legal Defense Fund 11)?
The investigation will inevitably cost money, and Jared felt it was important to establish a fund to handle legal needs for operational continuity and protect core contributors. The Sushi DAO Legal Defense Fund will provide coverage for reasonable attorneys’ fees and costs for core contributors and multisig participants active since the ratification of Sushi 2.0 (Sushi 2.0: A Restructure For The Road Ahead 114) to the present.
Why is the amount 3 million USDT with provisions for total available funds of 5 million USDT?
We can’t predict the course of the SEC’s investigation, and Jared is trying to ensure adequate funds to protect the above-mentioned contributors.
What if the investigation ends and not all that money is needed?
As far as monies provided as a retainer to Morrison Cohen, to the extent there are unused funds that were supplied to Morrison Cohen such that the law firm’s time charges and disbursements do not exhaust any on-account payment (and to the extent that Morrison Cohen is not asked to provide additional services), any unused balance shall be refunded.
What if I get a subpoena from the SEC about this matter?
You can, if you wish, contact Morrison Cohen. Morrison Cohen may or may not be able to represent you, depending on various circumstances, but if you receive a subpoena, Jason would be happy to talk to you. His contact information is on his firm webpage.
Do you think that Sushi has done anything wrong?
Not to our knowledge.
What Happened
The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.
Date | Event | Description |
---|---|---|
April 8th, 2023 8:35:23 PM MDT | Exploit Transaction | A transaction occurred exploiting the Sushi Swap contract[10]. |
April 8th, 2023 9:36:00 PM MDT | PeckShield Analysis Published | PeckShield analysis is published on Twitter[11]. |
April 9th, 2023 8:03:00 AM MDT | Sushi Swap Reports White Hack Funds Returned | Sushi Swap posts on Twitter to announce that they have started to receive some funds back from white hackers[12]. |
April 9th, 2023 10:48:00 AM MDT | Jared Grey Bounty Criticism | Sushi Swap head Jared Grey is criticized by Twitter user 0xriptide for having a low bug bounty[7]. |
April 10th, 2023 9:40:00 AM MDT | RektHQ Article Published | Rekt publishes an article on the situation[13]. Over the weekend, a new routing contract at SushiSwap was exploited, resulting in over $3.3 million being stolen from users across 14 chains. All users who had approved Sushi’s four-day-old RouteProcessor2 contract at the time of the incident were at risk. The exploited contract has since been removed, and SushiSwap Head Chef, Jared Grey, promised a full post-mortem on the events. DeFi’s favourite villain was reportedly also rekt for 1,800 ETH during the incident. However, the days-old contract had relatively few approvers, and while this was an embarrassing incident for SushiSwap, it wasn't an existential threat. SushiSwap has been surrounded by drama since its launch, including stagnation during the 2021 bull run and infighting, as well as criticism of a paltry bug bounty programme and large operating expenses.[14] |
May 2nd, 2023 10:44:00 AM MDT | Sushi Swap Recovery Portal | Sushi Swap continues to encourage users to claim funds back through their recovery portal[15]. |
Technical Details
The exploit affected a smart contract called RouteProcessor2 [1].
PeckShield Technical Analysis
PeckShield shared a technical analysis about the exploit[11]. An example hack transaction was also provided[10].
It seems the @SushiSwap RouterProcessor2 contact has an approve-related bug, which leads to the loss of >$3.3M loss (about 1800 eth) from @0xSifu. If you have approved [the affected smart contract]…, please *REVOKE* ASAP!
0xFoobar Technical Analysis
0xFoobar shared a technical analysis. Though the original Tweet has been removed, an excerpt is still available in the Rekt article[14].
SushiSwap router exploit comes from a bad callback. Although the line 328 comment is correct, line 340 does not check the pool deployer. So you can impersonate a V3Pool, do a no-op swap, call safeTransferFrom on an arbitrary ERC20 and arbitrary
from
address on line 347
Ernestognw.eth Technical Analysis
There is a more detailed analysis available by ernestognw.eth, however the link on Rekt is broken[14]. TBD
Total Amount Lost
The total amount lost has been estimated at $3,300,000 USD.
How much was lost and how was it calculated? If there are conflicting reports, which are accurate and where does the discrepancy lie?
Immediate Reactions
How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?
Ultimate Outcome
The smart contract which was affected has been removed.
Total Amount Recovered
Recovery efforts remain ongoing[16]. Some funds which have been returned through a white hacker[12] can be recovered through an online portal[15], while others have to be reviewed on a case by case basis[17].
Ongoing Developments
The recovery/reimbursement process continues to operate[16].
The contract is updated regularly, if you've recently lost funds please check the claim portal for eligibility. Given the probability of further token recoveries, the claim process will continue to run on an ongoing basis
Individual Prevention Policies
Avoid the use of smart contracts unless necessary. Minimize the level of exposure by removing or withdrawing assets whenever possible. Aim to choose smart contracts which have obtained third party security audits, preferably having been audited by at least three separate reputable firms. Pay attention to the audit reports, which smart contracts are covered, and whether the smart contract has been upgraded or modified since the report. Ensure that any administrative functions with the ability to remove funds from the smart contract are under the authority of a multi-signature wallet which is controlled by at least three separate and reputable entities.
For the full list of how to protect your funds as an individual, check our Prevention Policies for Individuals guide.
Platform Prevention Policies
All aspects of any platform should undergo a regular validation/inspection by experts. This validation should include a security audit of any smart contracts, reporting any risks to the backing (of any customer assets, ensuring treasuries or minting functions are properly secured under the control of a multi-signature wallet, and finding any inadequacies in the level of training or integrity of the team. The recommended interval is twice prior to launch or significant system upgrade, once after 3 months, and every 6 months thereafter. It is recommended that the third party performing the inspection not be repeated within a 14 month period.
For the full list of how to protect your funds as a financial service, check our Prevention Policies for Platforms guide.
Regulatory Prevention Policies
All platforms should undergo published security and risk assessments by independent third parties. Two assessments are required at founding or major upgrade, one after 3 months, and one every 6 months thereafter. The third parties must not repeat within the past 14 months. A risk assessment needs to include what assets back customer deposits and the risk of default from any third parties being lent to. The security assessment must include ensuring a proper multi-signature wallet, and that all signatories are properly trained. Assessments must be performed on social media, databases, and DNS security.
For the full list of regulatory policies that can prevent loss, check our Prevention Policies for Regulators guide.
References
- ↑ 1.0 1.1 Affected SushiSwap Smart Contract (RouteProcessor2) - Etherscan (May 17, 2023)
- ↑ https://www.kraken.com/learn/what-is-sushiswap-sushi (May 3, 2023)
- ↑ What Is Sushi? | Sushi Academy (May 3, 2023)
- ↑ Sushi | Sushi (May 3, 2023)
- ↑ @jaredgrey Twitter (May 3, 2023)
- ↑ Remove Jared Grey as Head Chef - Proposals - Sushi Swap (May 3, 2023)
- ↑ 7.0 7.1 0xriptide - "Nice work keeping the bounty at an all time low @jaredgrey" Twitter (May 3, 2023)
- ↑ Rekt - Sushiswap's Grey area (May 3, 2023)
- ↑ Head Chef Jared Grey's Official SEC Statement & FAQ - General Discussion - Sushi Swap (May 3, 2023)
- ↑ 10.0 10.1 One of the SushiSwap Exploit Transactions - Etherscan (May 3, 2023)
- ↑ 11.0 11.1 PeckShield - "It seems the @SushiSwap RouterProcessor2 contact has an approve-related bug, which leads to the loss of >$3.3M loss (about 1800 eth) from @0xSifu." - Twitter (May 17, 2023)
- ↑ 12.0 12.1 Sushi Swap - "Sushi's secured a large portion of affected funds in a whitehat security process." - Twitter (May 3, 2023)
- ↑ RektHQ - "Over $3.3M was stolen from @SushiSwap users over the weekend via a new routing contract." - Twitter (May 3, 2023)
- ↑ 14.0 14.1 14.2 Rekt - SushiSwap - REKT (May 3, 2023)
- ↑ 15.0 15.1 Sushi Swap - "the easiest way to check if you're able to claim back lost funds from the RouteProcessor2 exploit is to go to the claim portal and check if your wallet is eligible." - Twitter (May 3, 2023)
- ↑ 16.0 16.1 Sushi Swap - "The contract is updated regularly, if you've recently lost funds please check the claim portal for eligibility. Given the probability of further token recoveries, the claim process will continue to run on an ongoing basis" - Twitter (May 17, 2023)
- ↑ Sushi Swap - "For users that can prove they've lost funds but can't claim through the portal: Sushi has set-up a separate claim process for this, where the claims have to be reviewed on a case-by-case basis." - Twitter (May 17, 2023)