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.
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
EverclearBridgeis 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 theEverclearBridgeandmWethHost. - It provides a valid
_amountto extract from the market, for example,10 WETH. - It crafts the
_messageparameter. Inside this message, which is decoded byEverclearBridge, it sets the amount to be bridged to 10 WETH but sets themaxFeeparameter to an extremely high value, such as9.9 WETH. - The
Rebalancercontract extracts10 WETHfrommWethHostand callsEverclearBridge.sendMsg. EverclearBridgedecodes the message but performs no validation on themaxFee.- It calls
everclearFeeAdapter.newIntent, passing along the malicious maxFee of9.9 WETH. - The external
Everclearprotocol executes the bridge transfer. It sends10 WETHbut is authorized to take up to9.9 WETHas 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_BRIDGErole (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 theRebalanceror bridge contracts. - The
EverclearBridge.sendMsgfunction must validate that themaxFeeparameter 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
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
- The attacker calls Rebalancer.sendMsg targeting EverclearBridge and a market with liquidity.
- The attacker provides a valid amount to extract from the market.
- The attacker crafts the message with a very high maxFee.
- The Rebalancer extracts the amount from the market and calls EverclearBridge.sendMsg.
- EverclearBridge decodes the message without validating maxFee and calls everclearFeeAdapter.newIntent.
- 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.