Reproduced Exploit
Hanji LOB: receiveTokens credits fee-on-transfer tokens for more than it received
receiveTokens calls transferFrom and then adds the requested amount to the trader balance. A token that keeps 10% on the way into the book delivers 9000 of a 10000 deposit. The book still owes the attacker 10000. Withdraw pays 10000. The extra 1000 comes out of the victim's deposit. The victim was…
Chain
Other
Category
defi
Date
Jan 2025
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: 56840-incorrect-handling-of-fee-on-transfer-tokens-mixbytes-none-x. Standalone Foundry PoC and full write-up: 56840-incorrect-handling-of-fee-on-transfer-tokens-mixbytes-none-x_exp in the
evm-hack-registrymirror.
Vulnerability classes: vuln/defi/fee-manipulation · vuln/logic/state-update
Reproduction: cheatcode-free local synthetic.
LOB.receiveTokenscredits the nominal amount. Full trace: output.txt. PoC: test/56840-incorrect-handling-of-fee-on-transfer-tokens-mixbytes-none-x_exp.sol.
AuditVault taxonomy: lang/solidity · sector/dex · severity/high · MixBytes XPress / Hanji OnchainCLOB
Key info#
| Protocol | XPress / Hanji OnchainCLOB |
| Finding | MixBytes, AuditVault 56840, high |
| Vulnerable code | LOB.receiveTokens |
| Harm | Attacker withdraws 1000 FEE that the pool never received from them. Victim credit 5000 vs 3500 tokens left |
| Chain | local synthetic |
TL;DR#
receiveTokens calls transferFrom and then adds the requested amount to the trader balance. A token that keeps 10% on the way into the book delivers 9000 of a 10000 deposit. The book still owes the attacker 10000. Withdraw pays 10000. The extra 1000 comes out of the victim's deposit. The victim was credited 5000, delivered 4500, and the pool has 3500 left, a 1500 shortfall. The fixed function measures the balance delta and reverts with fee-on-transfer when it is not equal to amount.
The vulnerable code#
function receiveTokens(uint256 amount) external {
token.transferFrom(msg.sender, address(this), amount);
// @> VULN: credits `amount` with no check that the balance rose by `amount`
balances[msg.sender] += amount;
}
Diagrams#
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 56840-incorrect-handling-of-fee-on-transfer-tokens-mixbytes-none-x_exp (evm-hack-registry mirror).
- AuditVault finding: 56840-incorrect-handling-of-fee-on-transfer-tokens-mixbytes-none-x.
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.