Linear Pool Post-Mortem Report

(ERN / bb-rf-USDC / bb-rf-USDT)

Beethoven X
5 min readAug 3, 2023

Introduction

Beethoven X contributors identified an issue with the previous iteration of the Dollar Dollar Bills (ERN / bb-rf-USDC / bb-rf-USDT) pool on Optimism:

The issue is the result of an incorrect deployment of the underlying linear pools:

Both linear pools were deployed with the original ReaperLinearPoolFactory instead of the ERC4626LinearPoolFactory. The ReaperLinearPool was designed to function with the Reaper single-strategy vaults, and are incompatible with the Reaper multi-strategy vaults, due to a difference in how the two vaults manage decimal scaling.

While this issue was identified by Beethoven X contributors, there was an improper evaluation of the potential impact, which created an opportunity for a malicious actor to remove approx $79,330 USD in liquidity from the pool.

Additional details on the events that led to this unfortunate outcome are presented below:

Timeline of Events

  • On June 19th, the Dollar Dollar Bills pool was deployed using the misconfigured reaper linear pools using the composable stable pool factory.
  • On July 24th, we identified an issue with the Dollar Dollar Bills pool during pool operations. The issue was investigated and the root cause was identified but unfortunately, the impact was mis-evaluated. A new pool was deployed on the same day to start the migration process of user funds to the new pool.
  • On July 27th, LPs were informed that a migration to a new pool was underway and that emissions were live to trigger the migration of LPs.
  • On July 28th, 8:30 pm UTC, a malicious user found the misconfigured pool and was able to drain the remaining funds from the pool, resulting in a loss of ~$79k of liquidity.
  • On July 28th, 11:15 pm UTC, users reported they were unable to withdraw from the pool.
  • On July 29th, 11:30 am UTC, an initial investigation confirmed that the pool was indeed drained by a malicious actor. Ongoing investigation revealed that the issue was a result of the underlying linear pools as referenced above.
  • On August 2nd, 9:30 am UTC, we reached out to the malicious actor offering a bug bounty.

Root Cause Analysis

The investigation revealed that the issue was introduced when creating the linear pools using the wrong linear pool factories in the following creation transactions:

While under normal circumstances, such a misconfiguration should not be possible, the Reaper multi-strategy vaults support both the ERC4626 interface as well as the custom Reaper vault interface, making it possible to create the linear pools using either factory. In this instance, the linear pools should have been created using the ERC4626LinearPoolFactory, but were mistakenly created with the ReaperLinearPoolFactory.

ReaperLinearPoolFactory:

ERC4626LinearPoolFactory:

The root cause of the issue lies in the difference in how the underlying vaults handle the decimal scaling. While the Reaper single-strategy vaults use 18 decimals for any underlying token, the multi-strategy vaults mirror the underlying tokens’ decimal scaling.

Because the linear pools were created using the ReaperLinearPoolFactory for the multi-strategy vault, the rate of the wrapped token (rf-USDC and rf-USDT) was inflated by 10¹², which led to a mispricing of the wrapped token, since USDC and USDT use 6 decimals.

The malicious actor was able to take advantage of the misconfiguration of the linear pool. The attacker swapped a very small amount of rf-USDC into a large amount of bb-rf-usdc. Using the large amount of bb-rf-usdc, the attacker was able to swap it for the underlying assets. The attack was conducted twice in a very short time, one after the other:

Impact Assessment

The incident resulted in a malicious actor draining approximately $78,950 worth of assets from the Dollar Dollar Bills pool on Optimism. Please find the detailed asset list below:

Immediate Response and Mitigation

While Beethoven X contributors investigated the issue on July 24th, the root cause was identified but unfortunately, the scale of the impact was mis-evaluated. As a result, a new pool was created to initiate the migration process, allowing the malicious actor to exploit the misconfiguration and drain the remaining funds on July 28th.

In addition, the following linear pools have been identified as impacted by the same misconfiguration:

All pools that have these linear pools nested have no TVL and have been blacklisted from the UI.

Communication and Transparency

LPs were informed of the migration to a new pool on July 27th, but the severity of the underlying issue was not identified correctly. The incident was reported by users who were unable to withdraw from the pool on July 28th, triggering further investigation. On July 31st, the incident was acknowledged and a preliminary announcement was made.

Post-Incident Analysis, improvements, and lessons learned

Following the incident, we conducted a detailed analysis to identify the root cause. It became evident that the misconfiguration of the underlying linear pools during their creation in combination with a misinterpretation of the impact led to the loss of funds.

Users’ trust in Beethoven X has always been at the center of our mission in DeFi and in hindsight we should have undertaken all possible measures to prevent such a security breach.

We are dedicated to implementing process enhancements to prevent similar issues in the future. This includes strengthening testing and QA procedures for all new pool creations to ensure early identification and remediation of potential misconfigurations.

  • We have added additional post-deployment tests that wrap the underlying assets of linear pools.
  • We have added additional tasks to our post-deployment review process for linear pools to check the rates not only of the pool but of the wrapped tokens.
  • Any deployment of a linear and boosted pool will undergo an additional post-deployment review conducted by a different person.

Through these measures, we aim to bolster the operational security of our platform and foster trust among our users and the DeFi community.

Conclusion

This incident with the Dollar Dollar Bills pool underscores the need for constant vigilance and proactive security measures. By learning from this incident and implementing necessary improvements, we aim to fortify the protocol against potential threats, protecting the assets and trust of our users.

We are committed to continuous improvement and are grateful for the support and understanding of our community during this challenging time.

We identified all wallets affected by this incident and will work with our committees and community to find a solution for those that lost assets. We are actively looking into it, and have reached out to the hacker to negotiate whether we can recoup the funds directly before moving to the next steps.

--

--

Beethoven X
Beethoven X

No responses yet