Raydium Private Key Compromised

From Quadriga Initiative Cryptocurrency Hacks, Scams, and Frauds Repository
Jump to navigation Jump to search

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.

Raydium

Raydium is an automated market maker (AMM) built on the Solana blockchain that enables fast trades, shared liquidity, and new yield-earning features. Unlike other decentralized exchanges (DEXs) that can only access liquidity within their own pools, Raydium leverages a central limit order book that provides ecosystem-wide liquidity. The platform is faster and cheaper than other DEXs since it runs on the efficient Solana blockchain, which allows for faster transactions at a lower gas cost. The DEX UI also allows for more advanced trading features such as limit orders, which enhance the trading experience for users. However, recently Raydium suffered a loss of around $4.4 million in fees from its liquidity pools, due to a compromised private key to the owner account of Raydium contracts. The attacker drained accumulated trading/protocol fees via the withdraw_pnl instruction and also changed the SyncNeedTake parameter to withdraw extra funds. Most of the stolen funds have been moved to Ethereum and deposited into Tornado Cash, while 100k SOL ($1.4M) remains in the attacker's Solana address.

About Raydium

Raydium is an automated market maker (AMM) built on the Solana blockchain. It uses a central limit order book to enable lightning-fast trades, shared liquidity, and new features for earning yield. Unlike other AMM DEXs and DeFi protocols, Raydium offers faster and cheaper transactions due to the efficiency of the Solana blockchain, which allows access to third-party order flow and liquidity on the order book. Raydium's trading interface allows traders to view TradingView charts, set limit orders, and have more control over their trading. The swap feature allows two tokens to be exchanged quickly within liquidity pools, and the DEX UI allows for more advanced trading features such as limit orders, making for a better trading experience for users[1][2].

"An avenue for the evolution of DeFi. Light-speed swaps. Next-level liquidity. Friction-less yield."

"Raydium is an automated market maker (AMM) built on the Solana blockchain which leverages a central limit order book to enable lightning-fast trades, shared liquidity and new features for earning yield."

"Other AMM DEXs and DeFi protocols are only able to access liquidity within their own pools and have no access to a central order book. Additionally, many platforms run on other blockchains, such as Ethereum, where transactions are slower and gas fees are higher. Raydium offers a few key advantages: Faster and cheaper: Raydium leverages the efficiency of the Solana blockchain to achieve transactions magnitudes faster than Ethereum and gas fees which are a fraction of the cost. A central order book for ecosystem-wide liquidity: Raydium provides on-chain liquidity to a central limit order book, meaning that Raydium allows access to 3rd party order flow and liquidity on the order book. Trading interface: For traders who want to be able to view TradingView charts, set limit orders and have more control over their trading."

"Raydium's swap feature allows two tokens to be exchanged quickly within liquidity pools, while the DEX UI also allows for more advanced trading features such as limit orders. These make for a better trading experience for users."


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 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:

  • 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.

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.

Key Event Timeline - Raydium Private Key Compromised
Date Event Description
December 16th, 2022 7:01:00 AM MST Prism Aggregator Warning on Twitter Prism Aggregator posts a warning to Twitter that "[t]here seems to be a wallet is draining LP Pools from Raydium liquidity pools using admin wallet as a signer without having/burning LP tokens"[3].
December 16th, 2022 7:41:00 AM MST Raydium Acknowledges Exploit The Raydium Protocol acknowledges the attack on Twitter. They report that the "exploit" "affected liquidity pools" and "is being investigated"[4].
December 16th, 2022 8:57:02 AM MST Blockchain Transaction One of the transactions moving funds, suspected to be with the compromised private key[5].
December 16th, 2022 2:12:00 PM MST Raydium Announces Patch In Place Raydium posts an initial post-mortem on Twitter and announces that they are "working w[ith]3rd-party auditors and teams across Solana to gather additional info" and that a "patch is in place preventing further exploits from the attacker"[6].
December 17th, 2022 4:06:00 PM MST Follow Up Post Raydium posted a follow-up post and linked to a Medium article the next day[7]. TBD more information.
December 19th, 2022 Rekt News Article A new Rekt article is shared on the website about the incident[8].
January 4th, 2023 12:07:12 PM MST Compensation Plan And Next Steps Raydium publishes a compensation plan and next steps article on Medium[9].
January 18th, 2023 3:45:02 AM MST Blockchain Transaction One of the transactions moving funds, suspected to be with the compromised private key.
April 25th, 2023 6:17:00 AM MDT Bug Bounty Program Launched The Raydium Protocol launches a new bug bounty program[10].
April 27th, 2023 2:21:00 AM MDT Claim Compensation Deadline Extended The Raydium team extends the deadline for claiming compensation for the "final time"[11].
May 14th, 2023 5:59:00 PM MDT Compensation Deadline Expired The claim compensation deadline has officially expired[11]. Unclaimed compensation has now been returned to the Raydium Buyback Treasury[9].

Technical Details

This section includes specific detailed technical analysis of any security breaches which happened. What specific software vulnerabilities contributed to the problem and how were they exploited?

Solana Address: [12]

Ethereum Address: [13]

Transfer Transaction on Solana: [5]

OtterSec Technical Analysis

"According to OtterSec, the incident appears to have been down to a compromised private key to the owner account of Raydium contracts.

Raydium suspect “a trojan attack and compromised private key for the pool owner account”.

The account had authority over certain functions of Raydium’s pools, allowing the attacker to drain accumulated trading/protocol fees via the withdraw_pnl instruction. The hacker also changed the SyncNeedTake parameter to increase expected fees and withdraw extra funds."

Total Amount Lost

Raydium Protocol reported the pools affected and losses on Twitter[14].

5/ Pools affected:

SOL-USDC

SOL-USDT

RAY-USDC

RAY-USDT

RAY-SOL

stSOL-USDC

ZBC-USDC

UXP-USDC

whETH-USDC

Approx total funds exploited by attacker

RAY 1,879,638

stSOL 3,214

whETH 39.3

USDC 1,094,613

SOL120,512

UXP 21,068,507

ZBC9,758,647

USDT110,427


"Raydium, a Solana-based AMM, lost a total of ~$4.4M in fees from its liquidity pools."

The total amount lost has been estimated at $4,400,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?

Initial Post Mortem By Raydium Team

Teh Raydium team published a post-mortem on Twitter after the exploit[6].

1/ Initial Post-Mortem: Raydium is working w 3rd-party auditors and teams across Solana to gather additional info. As of now, a patch is in place preventing further exploits from the attacker.

The following includes info up to now. Big thanks to all teams providing support

2/ Raydium’s upgrade authority is held by a @SquadsProtocol multisig. This attack was not related to upgrade authority on the program itself. The exploit appears to stem from a trojan attack and compromised private key for the pool owner account.

3/ The attacker accessed the pool owner account and was then able to call the withdrawalPNL function, a function used to collect trading/protocol fees earned by swaps in pools.

4/ The hacker was also able to set the SyncNeedTake parameters to change the out_put.need_take_pnl for quote and base tokens in the affected pools in order to modify expected fees and then withdraw those amounts

5/ Pools affected.

6/ As an immediate solution, previous owner authority has been revoked and all program accounts have been updated to new hard wallet accounts. As such, the attacker no longer has access authority and is no longer able to exploit the pools.

7/ If the attacker returns the funds, 10% of the total amount will be offered and considered as a white-hat bug bounty. The attacker is encouraged to reach out through normal channels or via the below address

8/ Thank you to the Solana community for the support, specifically @solanafm @HelloMoon_io @wormholecrypto @osec_io and exchanges that blacklisted the hacker’s associated addresses.

More details will follow as they become available. Everyone's support is greatly appreciated

Other Community Reactions

TBD - Not sure the source of this quote.

"There seems to be a wallet is draining LP Pools from Raydium liquidity pools using admin wallet as a signer without having/burning LP tokens.

We withdrew protocol provided PRISM/USDC liquidity from Raydium

WITHDRAW YOUR PRISM/USDC LIQUIDITY FROM RAYDIUM"

Ultimate Outcome

What was the end result? Was any investigation done? Were any individuals prosecuted? Was there a lawsuit? Was any tracing done?

"The majority of funds were bridged to Ethereum, swapped to ETH and have been deposited into Tornado Cash. 100k SOL ($1.4M) remains in the attacker’s Solana address."

Following Day Update

Raydium Protocol published an update the following day on Twitter[7] and linked to a new medium article.

Exploit update: Full medium post below w further details, solutions implemented, and next steps. Raydium greatly appreciates the support & help received from teams, the community, and security experts across Solana up until now. More to come.

Compensation Plan And Next Steps

The compensation plan was finally published on January 4th[11]. TBD need to fill in more details on the compensation plan.

Total Amount Recovered

Raydium launched a recovery and compensation plan, which was outlined in a Medium post[11].

Ongoing Developments

The compensation window has now closed, so there are no further developments underway in this case.

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 wallets, minting functions, and critical infrastructure should be implemented with a multi-signature requirement, with a recommended minimum of 3 signatures required. This means that making important changes or approving spending will require the keys held by at least 3 separate individuals within the organization to approve. The multi-signature should be implemented at the lowest layer possible, all key holders should have security training, and all key holders should be empowered and encouraged to exercise diligence.

All points along the communication and supply chain should be inspected for vulnerabilities. Common vulnerability points may include DNS, Discord, and customer information. What steps are required to access and/or modify the component? Do any third party companies or organizations implement a proper multi-signature approach? What additional security options are available?

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. https://raydium.io/ (May 4, 2023)
  2. ✌️ Say Hello to Raydium - Raydium (May 4, 2023)
  3. prism_ag - "There seems to be a wallet is draining LP Pools from Raydium liquidity pools using admin wallet as a signer without having/burning LP tokens." - Twitter (May 4, 2023)
  4. RaydiumProtocol - "An exploit on Raydium is being investigated that affected liquidity pools. Details to follow as more is known" - Twitter (May 4, 2023)
  5. 5.0 5.1 Malicious Transaction Moving Funds - Solscan (May 4, 2023)
  6. 6.0 6.1 RaydiumProtocol - "Raydium is working w[ith] 3rd-party auditors and teams across Solana to gather additional info. As of now, a patch is in place preventing further exploits from the attacker." - Twitter (May 4, 2023)
  7. 7.0 7.1 Raydium Protocol - "Exploit update: Full medium post below w further details, solutions implemented, and next steps. Raydium greatly appreciates the support & help received from teams, the community, and security experts across Solana up until now. More to come." - Twitter (May 31, 2023)
  8. Rekt - Raydium - REKT (May 4, 2023)
  9. 9.0 9.1 Compensation Plan and Next Steps - Raydium Medium (May 31, 2023)
  10. Raydium Protocol - "Raydium's bug bounty program is live on @immunefi Earn bounties up to $505,000 for Raydium's  Concentrated Liquidity program" - Twitter (May 31, 2023)
  11. 11.0 11.1 11.2 11.3 Raydium - "The deadline for claiming compensation for liquidity positions affected by the December exploit has been extended for a final time." - Twitter (May 31, 2023)
  12. Raydium LP Exploiter's Account - SolanaFM (May 4, 2023)
  13. Raydium Pool Exploiter - Etherscan (May 4, 2023)
  14. Raydium Protocol - "Pools affected" - Twitter (May 31, 2023)