Reproduced Exploit
Behodler — Double transfer in ERC677 `transferAndCall`
transferAndCall calls super.transfer and then _transfer again for the same _value, so the sender is debited twice and the receiver is credited twice.
Chain
Other
Category
untagged
Date
Jan 2022
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
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. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 42454-h-03-double-transfer-in-the-transferandcall-function-of-erc6. Standalone Foundry PoC and full write-up: 42454-h-03-double-transfer-in-the-transferandcall-function-of-erc6_exp in the
evm-hack-registrymirror.
Vulnerability classes: wrong-condition · direct-drain
Reproduction: self-contained Foundry PoC with only
forge-std— no fork. Full trace: output.txt.
Key info#
| Impact | HIGH — callers lose 2× the intended amount on every transferAndCall |
| Protocol | Behodler — Flan / ERC677 |
| Vulnerable code | ERC677.transferAndCall — dual transfer |
| Finding | Code4rena — Behodler, 2022-01 · #42454 · [H-03] |
| Report | code4rena.com/reports/2022-01-behodler |
| Source | AuditVault |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
transferAndCall calls super.transfer and then _transfer again for the same _value, so the sender is debited twice and the receiver is credited twice.
The vulnerable code#
function transferAndCall(address _to, uint256 _value, bytes memory _data) public returns (bool success) {
super.transfer(_to, _value);
_transfer(msg.sender, _to, _value); // @> VULN
if (isContract(_to)) {
contractFallback(_to, _value, _data);
}
return true;
}
Root cause#
Redundant transfer after the ERC20 base transfer already moved the tokens. Flan inherits ERC677, so all transferAndCall users are affected.
Diagrams#
Impact#
Direct double debit on every Flan transferAndCall.
Sources#
- AuditVault: https://github.com/Auditware/AuditVault/blob/main/findings/42454-h-03-double-transfer-in-the-transferandcall-function-of-erc6.md
- Report: https://code4rena.com/reports/2022-01-behodler
- Repo: code-423n4/2022-01-behodler
contracts/ERC677/ERC677.sol
Taxonomy: [[wrong-condition]] · [[direct-drain]] · severity/high · sector/dex
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 42454-h-03-double-transfer-in-the-transferandcall-function-of-erc6_exp (evm-hack-registry mirror).
- AuditVault finding: 42454-h-03-double-transfer-in-the-transferandcall-function-of-erc6.
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.