Skip to content
Business logic Audit finding Intermediate

Rebalancer can drain market funds via excessive bridge fees

The Rebalancer role can set an arbitrarily high bridge fee when transferring funds, causing the protocol to lose most of the bridged amount to fees. An attacker with control of the Rebalancer key could repeatedly drain market liquidity.

befree3x Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-07-malda-judging/issues/686

Found by

befree3x

Summary

The REBALANCER_EOA role, which is considered semi-trusted, can drain funds from any market by specifying an arbitrarily high maxFee when initiating a bridge transfer through EverclearBridge.sol. This violates the trust assumption that the Rebalancer "cannot transfer user funds" and can only perform DDoS-style attacks, as it allows for a slow but steady extraction of value from the protocol's liquidity pools.

Root Cause

The Rebalancer::sendMsg function allows the REBALANCER_EOA to pass an unchecked _message blob to the selected bridge contract. The EverclearBridge.sendMsg function decodes this message to extract bridging parameters, including a maxFee. However, the bridge contract fails to validate this maxFee against any protocol-defined limit, instead passing it directly to the external everclearFeeAdapter.newIntent call. A malicious REBALANCER_EOA can therefore set this fee to an extreme value, causing the protocol to lose most of the bridged amount to fees.

Internal Pre-conditions

  • A market (e.g., mWethHost) has liquidity.
  • The EverclearBridge is whitelisted in the Rebalancer.

External Pre-conditions

The REBALANCER_EOA private key is compromised or its operator acts maliciously.

Attack Path

A malicious actor controlling the REBALANCER_EOA decides to drain funds from the mWethHost market.

  • The actor calls Rebalancer.sendMsg, targeting the EverclearBridge and mWethHost.
  • It provides a valid _amount to extract from the market, for example, 10 WETH.
  • It crafts the _message parameter. Inside this message, which is decoded by EverclearBridge, it sets the amount to be bridged to 10 WETH but sets the maxFee parameter to an extremely high value, such as 9.9 WETH.
  • The Rebalancer contract extracts 10 WETH from mWethHost and calls EverclearBridge.sendMsg.
  • EverclearBridge decodes the message but performs no validation on the maxFee.
  • It calls everclearFeeAdapter.newIntent, passing along the malicious maxFee of 9.9 WETH.
  • The external Everclear protocol executes the bridge transfer. It sends 10 WETH but is authorized to take up to 9.9 WETH as a fee, which is lost from the protocol. Only 0.1 WETH (or less) arrives at the destination market.
  • The attacker can repeat this process, draining a substantial portion of the market's liquidity over time through exorbitant fees.

Impact

Rebalancer can cause permanent loss of protocol funds. This attack directly drains the liquidity provided by users from the market contracts. While the REBALANCER_EOA does not receive the funds directly, their action causes value to be extracted from the protocol and paid to third-party bridge relayers.

PoC

No response

Mitigation

The protocol should not blindly trust the maxFee parameter provided by the semi-trusted REBALANCER_EOA. A centrally-controlled, maximum allowable fee should be enforced.

  • The GUARDIAN_BRIDGE role (a more trusted admin) should set a maximum fee limit (e.g., as a percentage or basis points) on a per-token, per-chain basis within the Rebalancer or bridge contracts.
  • The EverclearBridge.sendMsg function must validate that the maxFee parameter decoded from the message does not exceed the configured maximum fee limit for that specific bridging route.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/malda-protocol/malda-lending/pull/139

CergyK

Fix looks good

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

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

Impact

The Rebalancer can cause permanent loss of protocol funds by draining market liquidity through excessive bridge fees, though the attacker does not receive the funds directly.

What the attacker needed

REBALANCER_EOA key compromised or malicious; EverclearBridge whitelisted in Rebalancer; Market has liquidity

The fix

The protocol was fixed by enforcing a maximum allowable fee set by a more trusted admin role and validating the maxFee against that limit.

How it was found

  1. The attacker calls Rebalancer.sendMsg targeting EverclearBridge and a market with liquidity.
  2. The attacker provides a valid amount to extract from the market.
  3. The attacker crafts the message with a very high maxFee.
  4. The Rebalancer extracts the amount from the market and calls EverclearBridge.sendMsg.
  5. EverclearBridge decodes the message without validating maxFee and calls everclearFeeAdapter.newIntent.
  6. The bridge transfer executes, taking most of the amount as fees, and the attacker can repeat.

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 trusted but not fully trusted role called the Rebalancer is allowed to move funds between markets. The code lets this role specify a fee for a bridge transfer without any upper limit. A malicious operator can set the fee very high, so almost all the moved money goes to bridge relayers instead of arriving at the destination, slowly emptying the market.

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 Malda

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.