Reproduced Exploit
Chiliz bridge: a 5 ether ERC20 deposit locks the 4 ether overpayment
Bridge.deposit requires msg.value >= fee and then sends msg.value - fee to the resource handler. The ERC20 handler's deposit never refunds that native value. A depositor who sends 5 ether against a 1 ether fee locks 4 ether in the handler. The fixed bridge returns the 4 ether to the caller and keep…
Loss
4 ether of native value stuck in the ERC20 handler
Chain
Ethereum
Category
untagged
Date
Undated
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack replays in your browser. Step through it by Solidity line or by opcode.
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid. Standalone Foundry PoC and full write-up: 50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/bridge · vuln/logic
Reproduction: a self-contained Foundry PoC that compiles and runs offline with only
forge-std- no fork and no RPC. PoC: test/50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid_exp.sol.
Key info#
| Field | Value |
|---|---|
| Loss | 4 ether of native value stuck in the ERC20 handler |
| Protocol | Chiliz Bridge |
| Bug class | No refund of native overpayment on ERC20 deposit |
| Source | AuditVault finding |
| Report | Halborn, Chiliz Bridge Updates |
| Chain / block / date | Ethereum model · block 0 · 1970-01 |
| Compiler | solc 0.8.27, cancun, via IR |
TL;DR#
Bridge.deposit requires msg.value >= fee and then sends msg.value - fee to the resource handler. The ERC20 handler's deposit never refunds that native value. A depositor who sends 5 ether against a 1 ether fee locks 4 ether in the handler. The fixed bridge returns the 4 ether to the caller and keeps only the fee.
The vulnerable code#
require(msg.value >= FEE, "invalid value");
uint256 valueToSend = msg.value - FEE;
if (valueToSend > 0) {
// @> VULN: excess native value is forwarded and never refunded
payable(address(handler)).transfer(valueToSend);
}
handler.deposit(resourceID, destinationChainID, 1, msg.sender, data);
Root cause#
The fee is msg.value minus a remainder, and the remainder is pushed to the handler with transfer. For an ERC20 resource the handler does not spend or return that ETH. Nothing in deposit sends the excess back to msg.sender. The user who overpays cannot recover it.
Preconditions#
depositis permissionless.- The resource id maps to an ERC20 handler.
- Fee is 1 ether. The caller sends 5 ether. The note's own test uses value 500 against the same function.
Attack walkthrough#
- Call deposit with 5 ether.
- Pass the fee check because 5 >= 1.
- Compute the excess as 4 ether.
- Transfer the 4 ether to the ERC20 handler.
- Handler.deposit returns without a refund.
- Handler balance is 4 ether. Bridge balance is the 1 ether fee.
Diagrams#
Impact#
The depositor loses 4 ether. It sits on the ERC20 handler with no withdraw path in the quoted code. The control refunds the 4 ether and the handler balance stays 0; the only amount kept is the 1 ether fee.
Remediation#
Refund msg.value - fee to msg.sender (the fix the Chiliz team applied in the handler), or do not forward native value to an ERC20 handler.
How to reproduce#
cd 50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid_exp
forge test -vv
run() is the harm path. The control test uses the corrected comparison or guard and does not produce the loss number.
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid_exp (evm-hack-registry mirror).
- AuditVault finding: 50982-lack-of-refund-mechanism-for-overpayment-halborn-chiliz-brid.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.