Missing Pause Controls, ETH Refund Flaws, and Miscalculated Shares Enable Fund Loss and Protocol Inconsistency in depositAndBridge
The contract inherits Pausable but lacks pause/unpause functions, so the owner can never halt deposits during an incident. It also resets lastSender to address(0) before a possible ETH refund, so overpaid ETH sent back to the proxy reverts and is trapped, and it emits fee-ignorant share amounts in Deposit events.
Plume Network
Originally disclosed on Immunefi
50040 sc low missing pause controls eth refund flaws and miscalculated shares enable fund loss and protocol inconsistency in depositandbridge
- Submitted on: Jul 21st 2025 at 09:11:24 UTC by @Sharky for Attackathon | Plume Network
- Report ID: #50040
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/attackathon-plume-network-nucleus-boring-vault/blob/main/src/base/Roles/TellerWithMultiAssetSupportPredicateProxy.sol
Impacts
- Permanent freezing of funds
Description
Brief/Intro
The TellerWithMultiAssetSupportPredicateProxy contract contains vulnerabilities that compromise fund safety, emergency response capabilities, and protocol integrity. If exploited, these issues can lead to permanent loss of user/contract funds, broken emergency shutdowns, and inconsistent protocol accounting.
Vulnerability Details
Broken Pause Mechanism (Critical)
- Issue: The contract inherits
Pausablebut lackspause()/unpause()functions. - Technical Insight:
- The
paused()checks indeposit/depositAndBridgeare functional, but without externalpause/unpausecalls (enforceable only byowner), the contract can never be paused. - Inheriting
Pausablealone is insufficient; the OpenZeppelin design requires explicit pause control functions.
- Code Proof:
contract TellerWithMultiAssetSupportPredicateProxy is ... Pausable {
// Missing: pause()/unpause() functions
function deposit(...) {
if (paused()) revert ...; // Always false
}
}
ETH Trapping Vulnerability (Critical)
- Issue: ETH refunds fail after
depositAndBridge, causing permanent fund loss. - Technical Insight:
lastSenderis reset toaddress(0)afterteller.depositAndBridgecompletes.- If the teller (or bridge) refunds excess ETH after this reset (e.g., for overpaid fees), the
receive()function attempts to forward ETH toaddress(0), which reverts and traps funds.
- Code Proof:
function depositAndBridge(...) payable {
lastSender = msg.sender; // Set temporarily
teller.depositAndBridge{value: msg.value}(...); // Refunds might occur AFTER this
lastSender = address(0); // Reset too early
}
receive() external payable {
(bool success,) = lastSender.call{value: msg.value}(""); // Fails if lastSender=0
}
Share Calculation Mismatch (Major)
- Issue:
depositAndBridgemiscalculates shares inDepositevents, breaking fee-aware accounting. - Technical Insight:
deposituses actual shares minted (shares = teller.deposit(...)), which deducts fees.depositAndBridgeuses a raw quote (shares = depositAmount.mulDivDown(...)) that ignores fees.- This creates inconsistent event data, misleading off-chain systems about user balances.
- Code Proof:
// deposit (correct):
shares = teller.deposit(...); // Fee-aware
emit Deposit(..., shares); // Accurate
// depositAndBridge (incorrect):
teller.depositAndBridge(...); // Shares minted internally (with fees)
uint256 shares = depositAmount.mulDivDown(...); // Fee-ignorant calculation
emit Deposit(..., shares); // Inaccurate
Impact Details
- Fund Loss Scenarios:
- Stuck ETH: Users overpaying bridge fees lose refunds permanently (trapped in contract).
- Token Lockup: No rescue mechanism for accidentally sent ERC20 tokens.
- Operational Risks:
- No Emergency Pause: Attackers exploit vulnerabilities unhindered during crises.
- Accounting Corruption: Fee discrepancies in events break integrations (e.g., tax/reporting systems).
- Quantifiable Losses:
- Direct: 100% of overpaid ETH fees + any non-standard tokens sent to contract.
- Indirect: Protocol insolvency risk due to inconsistent state and loss of user trust.
References
- Contract Code: Provided in report
- OpenZeppelin Pausable: https://docs.openzeppelin.com/contracts/5.x/api/utils#Pausable
- Solmate SafeTransferLib: https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol
Proof of Concept
{% stepper %} {% step %}
Broken Pause Mechanism — Steps to Trigger
- An attacker discovers a vulnerability in the deposit logic that allows fund theft.
- Users continue depositing funds through
deposit/depositAndBridgesince:paused()always returnsfalse(unpaused state)- Owner cannot activate pause as
pause()function doesn't exist
- Attacker exploits vulnerability and drains user funds.
Result:
- All deposits are vulnerable during the attack window with no emergency mitigation. {% endstep %}
{% step %}
ETH Trapping Vulnerability — Steps to Trigger
- User calls
depositAndBridgewith excess ETH (example: 1 ETH for 0.9 ETH bridge fee):
depositAndBridge{value: 1 ether}(...)
- During execution:
lastSender = msg.sender(set to user address)teller.depositAndBridgeconsumes 0.9 ETHlastSender = address(0)(reset after call)
- Teller contract refunds 0.1 ETH to proxy:
payable(proxy).transfer(0.1 ether);
- Proxy's
receive()triggers and attempts:
(bool success,) = address(0).call{value: 0.1 ether}("");
- Call to
address(0)reverts → 0.1 ETH permanently locked in proxy.
Result:
- 100% of overpaid ETH is irrecoverable. {% endstep %}
{% step %}
Share Calculation Mismatch — Steps to Trigger
- Teller applies a 1% deposit fee in
depositAndBridge. - User deposits 100 USDC (price: 1 USDC = 1 share):
- Actual shares minted: 99 (after 1% fee)
- Proxy calculates shares incorrectly:
shares = 100 USDC * (10**18 / 1e6) / 1e18 = 100 shares
- Proxy emits event with 100 shares (vs actual 99 shares).
Result:
- Off-chain monitors see inconsistent share balances (100 vs 99).
- Protocol appears to steal 1 share from user in analytics. {% endstep %}
{% step %}
Unsafe Allowance Handling — Steps to Trigger
- User deposits 100 USDC via
deposit:
depositAsset.safeApprove(vault, 100 USDC);
- Later, same user deposits 50 USDC:
- Proxy tries:
safeApprove(vault, 50 USDC) - Reverts because existing allowance (100 USDC) ≠ 0.
Result:
- Subsequent deposits fail for any token with a prior non-zero approval. {% endstep %}
{% step %}
Missing Rescue Functions — Steps to Trigger
- User accidentally transfers 1000 USDC to proxy:
USDC.transfer(proxyAddress, 1000e6);
- Proxy has no
rescueTokensfunction. - Owner cannot recover funds → 1000 USDC permanently locked.
Result:
- Any non-standard asset transfer causes permanent loss. {% endstep %} {% endstepper %}
Summary of Exploit Paths
| Vulnerability | Trigger Action | Consequence |
|---|---|---|
| Broken Pause | Exploit during attack | No emergency shutdown |
| ETH Trapping | Overpay bridge fee | ETH permanently stuck |
| Share Mismatch | Use depositAndBridge |
Incorrect event emissions |
| Allowance Bug | Second deposit with same asset | Deposit reverts |
| No Rescue | Accidental token transfer | Funds permanently locked |
Context
The target is TellerWithMultiAssetSupportPredicateProxy.sol, a contract in the Nucleus Boring Vault repository used for the Plume Network attackathon. The contract sits in front of a teller and exposes deposit functionality, including a depositAndBridge path that forwards value to the teller's depositAndBridge. It inherits OpenZeppelin's Pausable and implements a payable receive() that forwards incoming ETH to the last recorded sender.
The report describes five separate issues in this contract: a pause mechanism that cannot be triggered, ETH refunds that get trapped, share amounts in Deposit events that do not match what was actually minted, unsafe allowance handling, and the absence of rescue functions. The stated impact category is permanent freezing of funds, and the report is rated Low.
Setup
No accounts, roles, tooling or versions are given beyond the contract itself and the libraries it references. The report links the OpenZeppelin Pausable documentation and Solmate's SafeTransferLib.
- Users call
depositordepositAndBridgeon the proxy, which forwards to the teller.
Finding it
The report describes the following observations about the proxy contract: Three observations stood out:
- The contract inherits
Pausable, anddeposit/depositAndBridgecheckpaused(), but nopause()orunpause()function exists on the contract. The check is therefore always false. depositAndBridgesetslastSendertomsg.sender, calls the teller, then resetslastSendertoaddress(0). Any ETH the teller refunds after that reset arrives atreceive(), which forwards tolastSender, now the zero address.depositrecords the shares actually returned by the teller, whiledepositAndBridgerecomputes shares from the deposit amount withmulDivDown, ignoring fees.
Two further issues are described in the proof of concept: repeated safeApprove calls on the same asset, and the lack of any token rescue function.
Exploitation
Broken pause mechanism
- An attacker discovers a vulnerability in the deposit logic that allows fund theft.
- Users continue depositing through
deposit/depositAndBridgebecausepaused()always returnsfalseand the owner cannot activate a pause, since nopause()function exists. - The attacker exploits the vulnerability and drains user funds.
The consequence is that all deposits remain open during the attack window, with no emergency mitigation available to the owner.
ETH trapping
- The user calls
depositAndBridgewith excess ETH, for example 1 ETH against a 0.9 ETH bridge fee:
depositAndBridge{value: 1 ether}(...)
- During execution,
lastSenderis set to the user, the teller consumes 0.9 ETH, andlastSenderis reset toaddress(0)after the call. - The teller refunds 0.1 ETH to the proxy:
payable(proxy).transfer(0.1 ether);
- The proxy's
receive()runs and attempts:
(bool success,) = address(0).call{value: 0.1 ether}("");
- The call to
address(0)reverts, and the 0.1 ETH stays locked in the proxy.
The report lists 100% of overpaid ETH fees as a direct loss.
Share calculation mismatch
- The teller applies a 1% deposit fee in
depositAndBridge. - A user deposits 100 USDC, with a price of 1 USDC per share. The actual shares minted are 99 after the fee.
- The proxy computes shares itself:
shares = 100 USDC * (10**18 / 1e6) / 1e18 = 100 shares
- The proxy emits an event with 100 shares against the 99 actually minted.
Off-chain monitors then see inconsistent share balances, and the protocol appears in analytics to take one share from the user.
Unsafe allowance handling
- A user deposits 100 USDC through
deposit:
depositAsset.safeApprove(vault, 100 USDC);
- The same user later deposits 50 USDC. The proxy attempts
safeApprove(vault, 50 USDC), which reverts because the existing allowance of 100 USDC is not zero.
The result is that subsequent deposits fail for any token that carries a prior non-zero approval.
Missing rescue functions
- A user accidentally transfers 1000 USDC to the proxy:
USDC.transfer(proxyAddress, 1000e6);
- The proxy has no
rescueTokensfunction. - The owner cannot recover the funds, so the 1000 USDC stays locked.
Summary of exploit paths
| Vulnerability | Trigger action | Consequence |
|---|---|---|
| Broken pause | Exploit during attack | No emergency shutdown |
| ETH trapping | Overpay bridge fee | ETH permanently stuck |
| Share mismatch | Use depositAndBridge |
Incorrect event emissions |
| Allowance bug | Second deposit with same asset | Deposit reverts |
| No rescue | Accidental token transfer | Funds permanently locked |
Root cause
The pause issue is a design omission: inheriting Pausable provides the paused() state and modifier, but the OpenZeppelin design requires explicit pause() and unpause() functions, normally restricted to the owner. Without them the state can never change, so the guard in deposit and depositAndBridge is dead code.
The ETH trapping issue comes from the ordering in depositAndBridge: lastSender is cleared immediately after the teller call returns, but refunds can arrive afterwards. The receive() function trusts lastSender unconditionally and forwards to it, so a zero value causes a revert and the ETH remains in the contract.
The share mismatch comes from computing shares twice with different methods. deposit uses the value returned by the teller, which is fee-aware, while depositAndBridge recomputes with depositAmount.mulDivDown(...), which ignores fees. The event therefore does not reflect the minted amount.
The allowance issue is the known safeApprove restriction: approval must be reset to zero before a new non-zero value is set. The proxy does not clear the previous allowance before approving again.
Finally, the contract has no rescue path for tokens sent to it by mistake, so any such transfer is permanent.
Impact
The report lists the following consequences:
- Stuck ETH: users who overpay bridge fees lose their refunds permanently, with the ETH trapped in the contract.
- Token lockup: there is no rescue mechanism for accidentally sent ERC20 tokens.
- No emergency pause: attackers can exploit vulnerabilities unhindered during a crisis.
- Accounting corruption: fee discrepancies in events break integrations such as tax and reporting systems.
Quantified in the report, direct losses are 100% of overpaid ETH fees plus any non-standard tokens sent to the contract. Indirect risk is described as protocol insolvency due to inconsistent state and loss of user trust. The report rates the overall severity Low and the impact category permanent freezing of funds.
Fix
The report does not describe any fix that was applied. The changes it implies are: add owner-restricted pause() and unpause() functions, keep lastSender valid until refunds can no longer arrive or handle the zero address in receive(), use the teller's returned share amount in depositAndBridge events, reset allowances to zero before re-approving, and add a rescue function for tokens sent to the contract.
Variants to test
- Other contracts inheriting
Pausablewithout exposing pause functions. A positive result is apaused()check in a state-changing function with no reachable way to set the flag. - Other payable proxies that record a sender for refunds and clear it before the downstream call can refund. A positive result is a refund path that reaches a
receive()forwarding to a cleared or zero address. - Other functions that emit events using locally recomputed amounts rather than the value returned by the downstream contract. A positive result is an event amount that differs from the minted amount whenever a fee applies.
- Other contracts calling
safeApproveon a token that already has a non-zero allowance. A positive result is a revert on the second deposit with the same asset. - Other contracts holding user funds with no rescue function. A positive result is a direct token transfer to the contract that no role can reverse.
Hunting notes
This class of bug hides in proxy and wrapper contracts that sit between users and a core protocol: they often duplicate logic from the contract they wrap, and the duplicate drifts. Signals during review are inherited mixins whose functions are never exposed, payable receive() functions that forward to a stored address, event emissions computed separately from the call that performs the action, and safeApprove calls without a preceding zero approval.
What happened, in plain words
A security researcher looked at a smart contract called TellerWithMultiAssetSupportPredicateProxy.sol, which is part of a project called Nucleus Boring Vault, used in the Plume Network attackathon. A smart contract is a small program that lives on a blockchain: it runs automatically, holds money (cryptocurrency and tokens), and nobody can change it after it is deployed unless the code itself allows it.
This particular contract is a middleman. Users send it money or tokens, and it passes them on to another contract called the teller, which does the real work of accepting deposits and, in one path, calling the bridge. A bridge is a service that moves assets from one blockchain to another.
The researcher found five separate problems in this middleman contract:
- A pause button that does not exist, so the owner can never stop the contract in an emergency.
- A refund path that sends ETH (the cryptocurrency of the Ethereum network) to the wrong address, so overpaid fees get stuck forever.
- A share count written into the contract's public records that does not match the number of shares actually created.
- An approval step that fails the second time a user deposits the same token.
- No way to recover tokens that someone sends to the contract by mistake.
The report is rated Low severity, and the impact category it lists is permanent freezing of funds. That means money ends up locked in the contract with no way to get it out.
The contract and the setup
The target is one file in the repository:
https://github.com/immunefi-team/attackathon-plume-network-nucleus-boring-vault/blob/main/src/base/Roles/TellerWithMultiAssetSupportPredicateProxy.sol
This is a link to the source code on GitHub, a website where code is stored and shared. The file name is long, so let us break it down. "Teller" is the contract that actually handles deposits. "MultiAsset" means it deals with more than one kind of token. "PredicateProxy" means this contract stands in front of the teller and passes requests to it. A proxy is like a receptionist: visitors talk to the receptionist, who forwards them to the right office.
The contract inherits from OpenZeppelin's Pausable. OpenZeppelin is a well-known library of ready-made contract building blocks, and Pausable is the block that provides a pause switch. "Inherits" means the contract takes that block and builds on top of it, the way a recipe can start from a basic dough and add its own ingredients.
The contract also has a payable receive() function. "Payable" means the function is allowed to accept ETH. receive() is a special function that runs automatically whenever someone sends ETH to the contract without calling any other function. Think of it as a letterbox: anything dropped through it triggers the same routine.
The report describes five issues: a pause mechanism that cannot be triggered, ETH refunds that get trapped, share amounts in Deposit events that do not match what was actually created, unsafe allowance handling, and the absence of rescue functions.
No accounts, roles, tooling or software versions are given beyond the contract itself and the libraries it references. The report links the OpenZeppelin Pausable documentation and Solmate's SafeTransferLib, a library of safe token-transfer helpers.
- Users call
depositordepositAndBridgeon the proxy, which forwards to the teller.
Finding it
The report describes the following observations about the proxy contract: Three observations stood out:
- The contract inherits
Pausable, anddeposit/depositAndBridgecheckpaused(), but nopause()orunpause()function exists on the contract. The check is therefore always false. It is like a shop with a "closed" sign that nobody is able to turn around. depositAndBridgesetslastSendertomsg.sender(the person calling), calls the teller, then resetslastSendertoaddress(0).address(0)is the zero address, a special value that means "nobody". Any ETH the teller refunds after that reset arrives atreceive(), which forwards tolastSender, now the zero address.depositrecords the shares actually returned by the teller, whiledepositAndBridgerecomputes shares from the deposit amount withmulDivDown, ignoring fees. A share is a unit of ownership in the vault, like a slice of a cake: the more slices you hold, the bigger your portion.
Two further issues are described in the proof of concept: repeated safeApprove calls on the same asset, and the lack of any token rescue function. safeApprove is a helper that grants another contract permission to spend your tokens, similar to giving someone a limited power of attorney over your bank account.
Exploitation
Broken pause mechanism
A pause mechanism is an emergency stop. If something goes wrong, the owner flips a switch and deposits stop being accepted while the problem is fixed. Here the switch does not exist.
- An attacker discovers a vulnerability in the deposit logic that allows fund theft.
- Users continue depositing through
deposit/depositAndBridgebecausepaused()always returnsfalseand the owner cannot activate a pause, since nopause()function exists. - The attacker exploits the vulnerability and drains user funds.
The consequence is that all deposits remain open during the attack window, with no emergency mitigation available to the owner. The report labels this issue Critical inside its own text, even though the overall report is rated Low.
The code proof in the report looks like this:
contract TellerWithMultiAssetSupportPredicateProxy is ... Pausable {
// Missing: pause()/unpause() functions
function deposit(...) {
if (paused()) revert ...; // Always false
}
}
Line by line:
contract TellerWithMultiAssetSupportPredicateProxy is ... Pausable {declares the contract and says it inherits fromPausable. The...stands for other inherited pieces the report does not spell out.// Missing: pause()/unpause() functionsis a comment noting that the two functions that would flip the switch are simply absent.function deposit(...) {starts the deposit function; the...stands for parameters the report leaves out.if (paused()) revert ...;checks whether the contract is paused and, if so, cancels the transaction.revertmeans "undo everything and return the money".// Always falseis the researcher's note: since nothing can ever set the paused state, this check never fires.- The closing brace ends the function and the contract.
ETH trapping
ETH is the native cryptocurrency of Ethereum. When a user sends more ETH than needed, the extra is normally refunded. Here the refund goes to the wrong place.
- The user calls
depositAndBridgewith excess ETH, for example 1 ETH against a 0.9 ETH bridge fee:
depositAndBridge{value: 1 ether}(...)
This line calls the function and attaches 1 ETH to the call. {value: 1 ether} is how Solidity, the language of these contracts, attaches money to a function call. 1 ether here means one whole ETH. The (...) stands for arguments the report does not show.
- During execution,
lastSenderis set to the user, the teller consumes 0.9 ETH, andlastSenderis reset toaddress(0)after the call. - The teller refunds 0.1 ETH to the proxy:
payable(proxy).transfer(0.1 ether);
payable(proxy) treats the proxy's address as able to receive ETH. .transfer(0.1 ether) sends 0.1 ETH to it. Because the proxy has a receive() function, that function runs automatically on arrival.
- The proxy's
receive()runs and attempts:
(bool success,) = address(0).call{value: 0.1 ether}("");
address(0) is the zero address, meaning nobody. .call{value: 0.1 ether}("") tries to send 0.1 ETH to that address with no data attached. (bool success,) captures whether the call worked; the empty slot after the comma ignores a second return value. Sending money to the zero address is not allowed, so the call fails.
- The call to
address(0)reverts, and the 0.1 ETH stays locked in the proxy.
The report lists 100% of overpaid ETH fees as a direct loss. The underlying code the report quotes for the ordering is:
function depositAndBridge(...) payable {
lastSender = msg.sender; // Set temporarily
teller.depositAndBridge{value: msg.value}(...); // Refunds might occur AFTER this
lastSender = address(0); // Reset too early
}
receive() external payable {
(bool success,) = lastSender.call{value: msg.value}(""); // Fails if lastSender=0
}
Line by line:
function depositAndBridge(...) payable {declares the function, marks it able to receive ETH, and leaves the parameters out.lastSender = msg.sender;remembers who called.msg.senderis the caller's address.teller.depositAndBridge{value: msg.value}(...);forwards the call to the teller, passing along all the ETH that came with the call.msg.valueis the amount attached.lastSender = address(0);forgets the caller immediately after the teller call returns.receive() external payable {is the automatic function that runs when ETH arrives.(bool success,) = lastSender.call{value: msg.value}("");tries to forward the incoming ETH to the remembered sender.msg.valuehere is the amount that just arrived.// Fails if lastSender=0notes that once the sender has been forgotten, this forwarding goes to the zero address and fails.
Share calculation mismatch
An event is a public note a contract writes to the blockchain so that outside software can see what happened. Off-chain systems, meaning programs that run outside the blockchain, read these notes to track balances.
- The teller applies a 1% deposit fee in
depositAndBridge. - A user deposits 100 USDC, with a price of 1 USDC per share. USDC is a stablecoin, a token designed to stay worth one US dollar. The actual shares created are 99 after the fee.
- The proxy computes shares itself:
shares = 100 USDC * (10**18 / 1e6) / 1e18 = 100 shares
This line scales the amount to the token's decimals and back. 10**18 is one followed by eighteen zeros, the number of decimal places many tokens use. 1e6 is one million, the number of decimal places USDC uses. The arithmetic cancels out and leaves 100, ignoring the fee.
- The proxy emits an event with 100 shares against the 99 actually created.
Off-chain monitors then see inconsistent share balances, and the protocol appears in analytics to take one share from the user. The report's code proof contrasts the two paths:
// deposit (correct):
shares = teller.deposit(...); // Fee-aware
emit Deposit(..., shares); // Accurate
// depositAndBridge (incorrect):
teller.depositAndBridge(...); // Shares minted internally (with fees)
uint256 shares = depositAmount.mulDivDown(...); // Fee-ignorant calculation
emit Deposit(..., shares); // Inaccurate
Line by line:
shares = teller.deposit(...);takes the number of shares the teller reports back, which already accounts for fees.emit Deposit(..., shares);writes that accurate number into the public event.teller.depositAndBridge(...);performs the bridge deposit, and the teller creates shares internally with fees applied.uint256 shares = depositAmount.mulDivDown(...);recalculates shares from the deposit amount alone.mulDivDownmultiplies then divides and rounds down. It has no knowledge of fees.emit Deposit(..., shares);writes the wrong number into the event.
Unsafe allowance handling
An allowance is a permission you grant to a contract to spend a set amount of your tokens. safeApprove is the helper that grants it. Some tokens refuse to change a permission from one non-zero amount straight to another; the old permission must first be set to zero. This is a known restriction of the safeApprove pattern.
- A user deposits 100 USDC through
deposit:
depositAsset.safeApprove(vault, 100 USDC);
depositAsset is the token being deposited. safeApprove(vault, 100 USDC) grants the vault permission to spend 100 USDC.
- The same user later deposits 50 USDC. The proxy attempts
safeApprove(vault, 50 USDC), which reverts because the existing allowance of 100 USDC is not zero.
The result is that subsequent deposits fail for any token that carries a prior non-zero approval.
Missing rescue functions
A rescue function is an owner-only tool that sweeps tokens accidentally sent to a contract back out again.
- A user accidentally transfers 1000 USDC to the proxy:
USDC.transfer(proxyAddress, 1000e6);
USDC.transfer sends tokens. proxyAddress is the proxy's address. 1000e6 is 1000 with six decimal places, which is how USDC amounts are written.
- The proxy has no
rescueTokensfunction. - The owner cannot recover the funds, so the 1000 USDC stays locked.
Summary of exploit paths
| Vulnerability | Trigger action | Consequence |
|---|---|---|
| Broken pause | Exploit during attack | No emergency shutdown |
| ETH trapping | Overpay bridge fee | ETH permanently stuck |
| Share mismatch | Use depositAndBridge |
Incorrect event emissions |
| Allowance bug | Second deposit with same asset | Deposit reverts |
| No rescue | Accidental token transfer | Funds permanently locked |
Root cause
The pause issue is a design omission: inheriting Pausable provides the paused() state and modifier, but the OpenZeppelin design requires explicit pause() and unpause() functions, normally restricted to the owner. Without them the state can never change, so the guard in deposit and depositAndBridge is dead code, meaning code that runs but can never do anything useful.
The ETH trapping issue comes from the ordering in depositAndBridge: lastSender is cleared immediately after the teller call returns, but refunds can arrive afterwards. The receive() function trusts lastSender unconditionally and forwards to it, so a zero value causes a revert and the ETH remains in the contract.
The share mismatch comes from computing shares twice with different methods. deposit uses the value returned by the teller, which is fee-aware, while depositAndBridge recomputes with depositAmount.mulDivDown(...), which ignores fees. The event therefore does not reflect the created amount.
The allowance issue is the known safeApprove restriction: approval must be reset to zero before a new non-zero value is set. The proxy does not clear the previous allowance before approving again.
Finally, the contract has no rescue path for tokens sent to it by mistake, so any such transfer is permanent.
Impact
The report lists the following consequences:
- Stuck ETH: users who overpay bridge fees lose their refunds permanently, with the ETH trapped in the contract.
- Token lockup: there is no rescue mechanism for accidentally sent ERC20 tokens. ERC20 is the common standard for tokens on Ethereum-compatible networks.
- No emergency pause: attackers can exploit vulnerabilities unhindered during a crisis.
- Accounting corruption: fee discrepancies in events break integrations such as tax and reporting systems.
Quantified in the report, direct losses are 100% of overpaid ETH fees plus any non-standard tokens sent to the contract. Indirect risk is described as protocol insolvency due to inconsistent state and loss of user trust. The report rates the overall severity Low and the impact category permanent freezing of funds.
Fix
The report does not describe any fix that was applied. The changes it implies are: add owner-restricted pause() and unpause() functions, keep lastSender valid until refunds can no longer arrive or handle the zero address in receive(), use the teller's returned share amount in depositAndBridge events, reset allowances to zero before re-approving, and add a rescue function for tokens sent to the contract.
Variants to test
- Other contracts inheriting
Pausablewithout exposing pause functions. A positive result is apaused()check in a state-changing function with no reachable way to set the flag. - Other payable proxies that record a sender for refunds and clear it before the downstream call can refund. A positive result is a refund path that reaches a
receive()forwarding to a cleared or zero address. - Other functions that emit events using locally recomputed amounts rather than the value returned by the downstream contract. A positive result is an event amount that differs from the created amount whenever a fee applies.
- Other contracts calling
safeApproveon a token that already has a non-zero allowance. A positive result is a revert on the second deposit with the same asset. - Other contracts holding user funds with no rescue function. A positive result is a direct token transfer to the contract that no role can reverse.
Hunting notes
This class of bug hides in proxy and wrapper contracts that sit between users and a core protocol: they often duplicate logic from the contract they wrap, and the duplicate drifts. Signals during review are inherited mixins whose functions are never exposed, payable receive() functions that forward to a stored address, event emissions computed separately from the call that performs the action, and safeApprove calls without a preceding zero approval.
Glossary
- Smart contract: a program stored on a blockchain that runs automatically and can hold funds.
- Blockchain: a shared, tamper-resistant record of transactions maintained by many computers.
- ETH: the native cryptocurrency of the Ethereum network.
- USDC: a stablecoin token designed to stay worth one US dollar.
- ERC20: the common standard that defines how tokens behave on Ethereum-compatible networks.
- Token: a digital asset issued on a blockchain, usually following a standard such as ERC20.
- Proxy: a contract that stands in front of another and forwards requests to it.
- Teller: the contract that performs the actual deposit and bridge work in this system.
- Bridge: a service that moves assets from one blockchain to another.
- Vault: a contract that holds pooled assets and issues shares representing ownership.
- Share: a unit of ownership in a vault; more shares mean a larger portion.
- Inherit: to take on the code of another contract or library and build on top of it.
- OpenZeppelin: a widely used library of ready-made smart contract components.
- Pausable: an OpenZeppelin component that provides a pause switch and a
paused()check. - Pause mechanism: an emergency stop that halts certain contract actions.
- Payable: a function or address that is allowed to receive ETH.
- receive(): a special function that runs automatically when ETH is sent to a contract.
- msg.sender: the address of the account that called the current function.
- msg.value: the amount of ETH attached to the current call.
- address(0): the zero address, a special value meaning "nobody"; sending funds to it fails.
- revert: to cancel a transaction and undo its effects, returning any funds.
- Allowance: a permission granted to a contract to spend a set amount of your tokens.
- safeApprove: a helper that grants a token allowance; some tokens require the old allowance to be zero first.
- Rescue function: an owner-only tool to recover tokens accidentally sent to a contract.
- Event: a public note a contract writes to the blockchain for outside software to read.
- Off-chain: running outside the blockchain, as opposed to on it.
- mulDivDown: an arithmetic helper that multiplies, divides and rounds down.
- Dead code: code that exists but can never have any effect.
- Severity: the rating of how serious a finding is.
- Permanent freezing of funds: an impact category where money becomes locked with no way to recover it.
- Protocol insolvency: a state where a protocol cannot cover what it owes.
- Attackathon: a time-limited security competition where researchers review a project's code.