Skip to content
Business logic Audit finding Intermediate

Sandwich attack on MoneyBrinter_compound allows extracting rewards intended for LPs

The compound function of MoneyBrinter can be sandwiched: an attacker deposits just before a compound call and withdraws just after, capturing most of the rewards that compound distributes to liquidity providers. The attacker profits whenever the extracted value exceeds the withdrawal fee.

OldDingo56530 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#42553 [SC-Medium] Sandwich attack on `MoneyBrinter_compound` allows extracting rewards intended for LPs

Submitted on Mar 24th 2025 at 16:06:04 UTC by @OldDingo56530 for Audit Comp | Yeet

Description

Description

The MoneyBrinter::compound function is vulnerable to a sandwich attack that allows an attacker to extract rewards intended for legitimate liquidity providers (LPs).

An attacker can monitor the mempool for compound calls, front-run with a maximal deposit to capture a majority of the share supply, wait for compound to execute, then back-run with an immediate withdrawal to extract the share's inflated value. This attack is atomic within one block and remains profitable as long as the extracted value exceeds the withdrawal fee.

With a sufficient liquidity and infrequent compound calls, a significant amount of rewards will accumulate, making this attack even more lucrative for the attacker.

Recommendation

One solution could be:

  • Disallow deposits in the same block as the compound call to prevent front-running

This mitigation prevents the attacker from front-running the compound call with a deposit in the same block. By ensuring that deposits and the compound function cannot be executed in the same block, the attacker is unable to predict and front-run the compound call, rendering the sandwich attack infeasible.

Proof of Concept

Proof of Concept

  1. Attacker monitors the mempool for upcoming calls to MoneyBrinter::compound by the manager.
  2. Attacker front-runs the compound call with a maximal deposit to gain a majority share of the MoneyBrinter LP token supply.
  3. The sandwiched compound call executes, depositing previously harvested rewards from harvestKodiakRewards and harvestBeradromeRewards, which increases the underlying share value.
  4. Attacker back-runs the compound call with an immediate withdrawal of their inflated shares, extracting the harvested rewards (minus the 4% fees).
  5. Attacker repeats this attack on all future worth compound calls.

The original report as published on Immunefi, by OldDingo56530. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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

Likely the compound function increases share value in a single transaction without preventing deposits in the same block, so an attacker can enter just before and exit just after.

Impact

An attacker could steal unclaimed yield meant for liquidity providers; the attack remains profitable only while the extracted value exceeds the 4% withdrawal fee.

What the attacker needed

Ability to submit transactions to the mempool; sufficient capital for a maximal deposit; compound call worth more than the 4% fee

The fix

Deposits should be disallowed in the same block as a compound call, so an attacker cannot front-run it.

How it was found

  1. Monitor the mempool for upcoming compound calls by the manager.
  2. Front-run the compound call with a maximal deposit to gain a majority share of the LP token supply.
  3. Let the compound call execute, which deposits harvested rewards and increases the underlying share value.
  4. Back-run with an immediate withdrawal of the inflated shares, extracting the harvested rewards minus the 4% fees.
  5. Repeat on all future worthwhile compound calls.

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.

A liquidity provider puts money into a pool and earns rewards over time. The compound function adds collected rewards to the pool, raising the value of each share. An attacker can buy shares just before that happens and sell them just after, so most of the new value goes to them instead of the real providers.

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.

More from Yeet

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.